The Universe Game

August 20, 2008

I have not been writing Angie these past two weeks, but instead I have spent the time working on an old project called "The Universe Game". This is a computer game that I have been programming over the years. Usually once every year I will start the project anew, as brand-new ideas for how it might be structured present themselves to me. The game itself is imagined as a "conquer the universe" style of game, and my friend and I have been discussing various features of it for many years (I think it was 2000 when we first started).

I program in Visual Basic, and at first I just used the windows API and VB draw commands. Within the first year I migrated to DirectX (version 7 at the time, and 8 came out right on the heels of my learning 7). My earliest stuff was 2D, flat, planar space combat and a galaxy. In 2001, I made the most complete galaxy (still 2D), with trade freighters, and orbits, and an economy, resource gathering, etc. I stopped working on that while adding the ship combat. Combat AI was frustrating, and I rearranged the scale of the universe as I was working on this, which broke apart a lot of what I had already made. The next year (2002), I started again three times, finally learning DirectX 8 (though still 2D), with a galaxy simulation at true scale. (That is, the ratio of orbital radius to planetary radius was accurate to the averages of our own galaxy.) The next year, I wrote a ship designer + combat simulation, creating a new AI. My old AIs were based on ship destinations: that is, determining where the ship wants to go, and then trying to figure out how best to get there. The new one was based on projecting ahead what the enemy ships would do, and several choices the ship could make, then determining which choice would be best (in the short term only). The "best" scenario was "voted" on based on weighted needs: defense, offense, flocking, etc. This created very dynamic fleet battles (with a few peculiar bugs), but it was still 2D.

That version I wrote in the windows API again with VB 6, not DirectX, but it would not run on my friend's computer. I blame his graphics card. Because of that, the project stalled, as he could not give me any decent feedback. I decided to port it into DirectX, but in the process, I learned how to do 3D. Translating the combat AI into 3D rendering, but keeping it 2D revealed the limitation in a strikingly visual way. I decided I would have to do everything in 3D, so I scrapped that whole project.

The next stage of the project I started again intending a ship-design + combat simulation suite, like the previous. I spent a long time working out a 3D "lego"-styled ship design process, and a skinning algorithm that wrote Meshes. These ships were not elegant, but they served the completely user-definable vision we had for the game. Unfortunately, at that point we digressed into a peculiar path of how ships would be made of different kinds of materials, each of which would transmit energies in different ways. I wrote several material/energy simulators (which looked very cool: my favorite was the "sound" energy interaction, where longitudinal/transverse waves would shake apart the blocks, transmitting and reverberating the energy through the structure until it broke apart. It looked awesome. So did the thermal exchange, with heat dissipating through the structure). At some point, we decided we had gone way overboard, and we stopped working on that.

Afterward, I stepped away from the specific aspects of the Universe Game to work on what I thought of as Universe Systems. One of the frustrations of starting each project over was rewriting the UI (buttons and controls). The latest stuff I had done, through the material/energy phase, had included scripting, the ability to edit the UI on the fly, and many other cool features. This had taken a lot of time away from the specific Universe Game implementations. So I decided I would now get that all out of the way so I could then delve into the Universe Game from a working UI framework.

Then I moved on to Visual Basic NET. This happened because I was programming a medical records database, and we were using PDFs for viewing. Adobe released Acrobat 7, whose plug-ins did not have COM support, only NET half-way through development. So I had to move to VB.NET in order to incorporate that into the software. I'm glad I did, as I love the VB.NET framework so much more than VB6. This also let me move to DirectX 9.

But I have not done much with the Universe Game since then. I tried a few other projects (a port of the Supremacy Board Game, 3D Nibbles (something I banged out in one day), etc). For some reason, I had three ideas for the Universe Game this month, and decided to pursue them instead of writing Angie. The first idea was a way to do dynamic meshes that were redefined every cycle, based on seeds, and generated procedurally, and making the Universe Game (theoretically) infinitely scalable. The next idea was how to structure a 3D ship design process, both visually and functionally, so that it would be easier to use (than the lego interface I had made before). The last idea was how to alter the ship AI (building from the "voting" system I had made in 2003), as well as using vectors.

(Vectors are an interesting place to return to. In 2000, when I first started the first version of the game, a friend of mine [not the one with whom I have been working on the game all these years] suggested I use vectors to define the ship movement. I thought that would probably be cool, but probably unnecessary. I was using angles and position, and it was functional, so there was no real need for vectors in 2D. However, in moving to 3D, I was always thinking along the same lines I had been for years (with angles and position), and it was difficult to think how to work it out, though not impossible. When writing Nibbles 3D, I made extensive use of vectors, and that reminder gave me a lot of ideas for the Universe Game Ship Combat. If only I had listened to my friend way back in 2000.)

Anyway, I have worked on the Universe Game over the past 2 weeks quite a bit, with all these ideas of how to make the Design and Combat AI and rendering engine, and I've started to slide in my focus again... And guess what. All I have finished is the UI. I barely scratched the problem of the Design interface, but I do have gorgeous buttons and sliding frames, and a beautiful interface. I've burned myself out on making that. The second problem I've encountered is that while I do really like the look and feel of the interface, I am really unhappy with the structure of the code that runs it. It has been a long time since I wrote a large project, and it seems I completely forgot how to properly use objects. I've made too many objects, and most of the objects I've made are under-utilized. So, now that I stand on the edge of the UI, ready to delve into far more interesting things, I want to rewrite all of it. I fear that if I don't, I'll only regret it later as the messy tangle grows and grows, until it would be impossible to extract all its tentacles. I need to do that work now, before I go much further. Alas, but again I stall.

I'm not sure if I'm going to work on rewriting the UI code, or if I'm going to return to Angie now. We shall see.