Sneak Peeks of Project Cerebus [Game Development]

game_dev_demoscreen-1

So I’ve been making use of my long holiday break this year by working on developing a game.  I’m finally at a point where I’m comfortable posting the first screenshot of it. It’s still HEAVILY in development and so it doesn’t look like much yet, but…Side noteA while ago I mentioned, very vaguely, a software development project that I’m working on called Project Odin — this is not in reference to that. (That’s something else entirely)

Since this game is going to be released as freeware (due to licensing issues), I’m at a little more liberty to talk about the details here. (I’m going to keep a few things secret just to add some mystery and keep Chris Hardie in suspense, though) 

Project Cerebus is, ironically enough, based on a card game that is based on a computer game. Sort of brought things around full-circle I suppose. The card game is not particularly well-known, but the computer game is. It is being developed in Visual Studio 2008 using the XNA 3.0 Framework. [Seriously, XNA is phenomenal. I don't typically applaud Microsoft because I think they're a bunch of shysters, but this framework is absolutely TERRIFIC.]

I started developing Cerebus over a year ago with my co-worker Zak. Initially, we had talked about doing it as a web application, but constantly ran into the issue of multiplayer-communication. (And realistically, a lot of the interactive components would be rather difficult to implement in a web app, even with fancy JavaScript libraries)

At the time, he and I were taking a course in Linear Data Structures, using the Java language. Java is pretty neat. I don’t know that I would want to code production-level stuff in it (because of the JVM’s clunkiness), but it’s an awesome primer into OOP. 

So I pseudo-coded up most of the game logic, and then coded it into Java. It compiled successfully and I could do some simple test cases of the logic. Awesome. 

But then when it came to implementing the graphical stuff, well forget it. Swing and AWT (Java’s graphical frameworks) are ok, but I couldn’t find any good documentation for someone with only a loose familiarity with the language. After that, the project got shelved for a while.

Moving into C#

Earlier this year, I discovered a book called “Head First C#” (part of the “Head First…” series). I had been dinking around with C# for a while; It’s similar enough to Java (and close enough to C++, my previous compiled language of choice) to be a comfortable language for me. The book is very well written, I highly recommend it for anyone interested in learning C#. 

The book dealt with writing Windows Applications using the Windows Forms framework (ever notice how Notepad, Wordpad, Internet Explorer, Microsoft Word, etc. all have similar appearances? That’s because they’re all using the WinForms framework). I worked through about half the book before having to attend to other things. I had a pretty solid grasp on using Visual Studio though, even though I haven’t yet finished the book yet.

So I got the bright idea to dust off my old game logic and convert it from Java to C#. It took a little while, but it wasn’t too bad. I started learning about Project Resources (.resx) and primitive image management. I learned how to read and parse an XML file (for storing the deck details).  

It was becoming a pain in the butt having to cart it between different computers (like from my home PC to Zak’s laptop, for example), so I  installed Subversion on my server and loaded the Visual Studio plugins. (Subversion is a “Version Control System” that allows you to “check in” and “check out” files — it’s mostly intended for when you have multiple people working on the same codebase, but in this case I’m just using it for the convenience of keeping my code managed in an accessible location).

I located the original developer of the card game and contacted him by email, asking for permission to create the game. I felt confident enough in my ability to finish the project (eventually, anyways) that it was worth letting him know. He was very cool about it, thought it was a great idea, and said to keep him informed. Cool!

So at this point, I had a more or less functional (but very primitive) version of the game logic, implemented as a WinForm. It looked pretty ugly. But the big problem was going to be dealing with multiplayer again. I found numerous Server/Client model libraries online; I favored Chat server/client applications since those would be the easiest to modify for the purposes of a card game. I posted some questions on gamedev.net and a few other Game Developer fora, which was a little helpful.  But try as I might, I just couldn’t seem to get it to work correctly. Discouraged, I shelved it again.

Discovering XNA

Fast forward to about 2 months ago – I discovered the book “Beginning Game Programming with XNA 2.0″ on the Apress label. What a great book. In spite of the errors in the book’s code examples (some of them very frustrating!), it was extremely helpful. Making a game seemed…well… more accessible. The framework handles all the tedious details of passing data around and constantly refreshing the screen (dozens of times per second). All you focus on is the logic. Which is exactly what I had!

Even better, and this was the deciding factor for me, XNA has a native multiplayer framework: “Gamer Services”. It allows simple integration into the Xbox Live network, but it will also auto-locate other clients on the same subnet, if they’re playing. Wow! 

I dusted off the code, yet again, and dove into some refactoring. I had to change a lot of things around to fit the framework, but it was making the code more robust. User Interface methods were finally being pulled out of game logic, encapsulation was improving, and, perhaps best of all, I was starting to see GRAPHICAL results. 

Progress

So I’ve been staying up rather late every night over my break, working on this. 

I’ve had to re-trace my steps a few times — XML deck storage is scrapped temporarily (technical reasons), and I’ve had to re-combine many of the images into single files for easier management. Every once in a while I’ll find a bug to squash, but the game logic has been holding up very well so far.  I’m pretty proud of my work with it. 

When the code was to the point where it was ready to start becoming visual, I drew up some comps in Photoshop. I’ve been pulling various icons and images from the original Computer game — it just seems appropriate. The screen layout and everything is the result of many pencil sketches and mental-models that I mull over.

Tonight, I just finished the “player data” component, where you would see the statistics about how you’re doing in the game. I ran some test cases and all of the details work correctly. The icons auto-scale based on quantity, the numbers sum up correctly, and certain status symbols only show up when they should. Awesome!

The last thing I did tonight was to get a mouse cursor to show. There is no default mouse cursor with XNA, you have to define one specifically XNA can show a really basic mouse cursor (if you do “this.mouseVisible = true;” in your main Game’s Initialize() method) — but I wanted something cooler. So I pulled the cursor from the computer game, coded it into a Sprite (jargon for a visual object that moves around the screen), and linked it into the framework. I had a few problems with it being invisible (it was hiding behind the background) but figured that part out.  Score!

The screenshot above shows how the game looks as of right now. If I had to guess, I would say that I’m about 10% done with the game. There’s a lot to go, even though the core of the game (the game logic)  is essentially already written. 

I’ll post more updates on here — I promise they won’t be quite as lengthy!