Getting the Interface hooked up again
Our first goal in the development phase of Gal Civ 2 is to have Gal Civ 1's functionality working with the 3D engine. While Joe was working on upgrading the engine that we created for Political Machine, I began cleaning up our code library Pear and continued my work from Political Machine of converting it to use 3D code. It's now much lighter, more flexible, and generally just better written than the stuff that was written in 1995 (although, to be fair, Pear was great back in the day--we've just outgrown it). We're now calling this new and improved library Kumquat, which will probably continue to evolve as we work on Gal Civ 2. Once that was done, I used the files from Kumquat to create a new project and started adding the files from Gal Civ, minus the interface files. I then had to strip out all of the code that referenced the graphics or interface, replacing calls to the interface with blank functions that could be filled in as we created the screens. Now, in Gal Civ 2, we could completely strip out the interface and still be able to compile it. It's kind of like plug and play for programming. Having the data not be dependant on the interface means that we should get better performance and stability because now we can destroy a ship without worrying about whether or not the engine is trying to paint it. When a ship is destroyed, it sends a message to the interface that it was destroyed, and then the interface removes the graphic associated with it when it receives the message.
So the last few months we've been working on hooking up the interface to the Gal Civ 1 code, and cleaning up some of the messier code like Trade Routes. We also had to make some changes since planets are now objects on the map. We've had the artists just make "dirty screens", screens that are only supposed to be place holders. The idea behind this is that we'll be able to get the screens working and then be able to figure out what needs to be changed before the artists spend a lot of time making the interface gorgeous. Like in Poltiical Machine, we're using our product DesktopX to design the interface which allows the artists to modify and test the screen without needing any code changes as we would have with Gal Civ 1, and it's much easier to change the graphics too.
I got a lot accomplished this week. I eliminated a lot of memory and resource leaks, added functionality to the string parser to replace strings (which will allow us to use tags rather than format specifiers in our data files, like the RandomEvents--you modders will like that), hooked up the cutscene window (It uses the Random Event Window like in Gal Civ 1, at least for now), and got the new invasion window working along with some other dialogs. Since the invasion code was in the actual invasion screen in Gal Civ 1, I had to extract it from the old code and turn it into a process that is independant of the actual window. The invasion screen is actually two windows: the Invasion Options window and the Invasion window. The Invasion Options window lets the user pick which invasion tactic to use and now has a CANCEL button (yay). So now instead of the "Are You Sure" prompt coming up before the invasion options screen, the invasion option screen comes up first. You can then click cancel, or attack. If you hit attack and you are not at war with the civ you're invading, then it brings up the "Are You Sure" prompt. If you say yes, you declare war on the person you're invading and the invasion screen comes up.
Another thing that will be a lot better in Gal Civ 2 will be our management of screens popping up. We now have a PopupManger that only lets one popup open at a time, and queues the rest. This will include any screen that is opened by the game and not by you, the user, clicking on a button or hitting a hot key. Anyone remember the bug where sometimes when your planets had completed projects, you couldn't go on to the next turn until you had opened the planet screen and hit the done button? This won't be a problem in Gal Civ 2 because of the popup manager.
One of the good things that we did in Gal Civ 1 was make a generic function that called a dialog window, set the message and an image, and unhid the dialog. Once I had the message box coded and hooked up to the popup manager, I hooked up that function to it. So now, there's all these messages that popup without me having to do any additional code, like the "out of range" message. That might seem kind of lame, but I really love it when things just work the way that they're supposed to work.
Next week, I'll fill in more of those blank functions and work on one or two of the screens, probably the Trade screen since that one is ready and the Domestic Policy screens don't appear to be done yet. Also, the AI pops up the Trade screen occasionally, so that'll be a good thing to have done.
As a side note, you'll notice that beta versions of updates went up for Gal Civ and Altarian Prophecy. Yay! Check out the version history, but you'll notice that I mentioned tweaking the trade routes. I used the new and improved code from Gal Civ 2 to help me fix the ones in Gal Civ 1. So you shouldn't have any more crashes after destroying colonies or stars. I played through a couple of games and didn't have any problems, but some of you metaverse warriors seem to be able to break Gal Civ a lot better than me, so let me know if you have problems.
Edit: I see that Joe has put a screenshot in his. Well, maybe I'll update this on Monday with a screenshot, but it's 7:12 PM on a Friday night and I want to go hang out with my friends.