a simple site for sharing ideas




tech tantra thursday
   - behind the cosmic curtain with Bill Eberle

prev/first       next/last       toc


for thursday may 12, 2011

Cosmic Encounter® Online at Facebook     tech tantra illustration


Challenge Questions - How does ranking work?   How much do we know about each game played?


Our MySQL database “cosmic” manages all information for our website and online Cosmic Encounter® game sessions.

cosmic database schema

Click on the diagram on the left to see all of the important tables and relationships we use to keep track of information about players, members, membership transactions, aliens, alien combination sets, . . . and Cosmic Encounter® Online game sessions and to manage our dynamic game-by-game information for ranking players and aliens.

(To simplify a bit I've left out tables we use for tracking promotions and new members who came to us via a special cosmic web links.)

We use Flash® as our browser client for both the website and game experiences.

For the website experience, our Flash® client talks to Perl scripts which connect to our MySQL cosmic database. Probably more code in the Flash® but plenty of interesting Perl code also. We also manage subscriptions via a PayPal™ Perl script and “unsubs” via a cron and a Perl script. Greg Olotka did all of the movie, graphic, and Flash® “resource” work for the website client and I created and managed the cosmic database and the Perl scripts and did most of the ActionScript object code and the more complicated .fla code for interacting with the user, the database and the game site client and server.

Peter Olotka, Greg, and I were the designers of the online version of Cosmic Encounter®.

For the game experience, our Flash® client talks to a game multi-plexer called Fortress which is coded in Java™. The basic job of a multi-plexer is to handle messages (encoded as XML) from many different sources (browsers or clients) and always be able to keep track of who's who. Fortress did that and a lot more in both Java™ server objects and Flash® browser objects - we extended the Fortress multi-plexer to create our “game engine”.

The original and principle author of both the Cosmic Encounter® Flash® client and the Fortress-Cosmic Encounter® game engine is Alan Queen who recently helped found Greg was the principal developer who organized and managed the Flash® “resources” and worked with Alan to integrate Alan's ActionScript objects and .fla code, the artist's animations, and the composer Mark Sutton-Smith's alien music to create the final product. Peter had the difficult task of organizing and “managing” - keeping us all moving forward - and also helped anyone who had encountered a problem talk it through until we discovered a solution and, as time went on, he found himself doing a little bit of almost everything that had to be done.

I did all of the original database and Perl code for the website and the game and, following our release in the spring of 2003, took over working on the client and the game engine to add bots and all of the aliens that followed. Greg, Peter, and I worked together to add new features to Cosmic that required extending the Flash® client. When it came to the Java™ game engine, I was on my own . . . but Alan had given me a lot to work with.

First I had to get the bots to play the game. Alan had given me methods to identify and capture the messages sent to players for all player interactions and methods for using the data structures behind our player ui widgets but I had to figure out how to actually bring bots to life and that took awhile. Then I had to make them just a little bit smart or as Peter said “Just make it so they don't do anything that's really dumb.” When you're playing against the bots, you're playing against Java™ code I wrote in 3 or 4 days . . . with a few adjustments over time e.g. I seem to remember a day working on improving how the bots handle the fact that they have a Zap.   Java's object coding environment is a wonderful playground for that sort of thing - perfect for the Cosmic Encounter® Online game with a basic alien class and the different aliens overriding methods as needed for their special abilities. The Fortress Cosmic game engine talks to Perl scripts to get information from and post information to the cosmic database shown in the diagram.

Two key Perl scripts I created also do some magic to calculate alien “effects” that change the numbers that show in the ships and to do a final calculation to resolve the final outcome of an interaction between or among different aliens. Perl was perfect for those tasks because of its powerful data and text expression handling and its ability to evaluate a complex mathematical expression with both the expression itself and the ship and pod variables changing based on which aliens were in the interaction as main players and allies. Those two scripts are pretty interesting, and I can talk about them in more detail in another article if I hear there is interest.

The most difficult feature I added to Cosmic was the ability to join games which are in-progress. The second most difficult was the Ghost.

My favorite Perl to MySQL script is the one which handles ranking after a game completes. After I hit a roadblock (translation after I figured out that my understanding of the problem was incomplete), both Peter and I dug in and worked together to come up with a detailed algorithm for what the Perl code would have to do. Then I coded it and we tested and tweaked until it worked the way we wanted it to.

I look forward to talking more about all of this with any Cosmic Encounter® fans who are interested.

Thanks. — Bill Eberle (for Cosmic)


Cosmic Encounter® Online at Facebook     tech tantra illustration




events        prev/first        next/last        tech tantra



just thinking . . . for fun