Lead Developer, Stardock Entertainment
No Screenshot this week
Published on February 25, 2005 By CariElf In GalCiv Journals
It took me longer than I would have liked to work on the save game code this week, and I don't even have it hooked up to the interface yet. However, I was finally able to save a game and load the data back in without crashing. The save game code itself is mostly the same as it was in GC1/AP, but I had to go through and update the places where new data types were added and old ones needed to be changed. However, now it is smart enough to check and see if the data saved is the same version as what is loaded in memory. That should save some time when loading.

Some of you may be familiar with one of our programs called SmartException, which prints out a log for us when a program crashes. I also spent some time this week working on a function that will be called when SE detects a crash, allowing me to add information to the crash log. It works, but SmartException will only call the export function if it recognizes the name of the exe, so GalCiv2 needs to be added to its list.

One of the issues that we knew that we were going to have to deal with is that with the angled map, the up key no longer represents north. And with the user able to rotate the camera, that complicates it even more. So we couldn't leave the direction keys hardcoded for directions on an overhead map. We decided to make the arrow keys move you in their respective directions in relation to the screen, rather than the world coordinates. So if you hit the up key, your screen coordinates move up. We already had a function that converts screen coordinates to world coordinates for mouse hit detection. So now when you hit the up key, it doesn't automatically send you North, whatever direction North happens to be in the world. I convert the screen coordinates for 100 pixels above the center of the screen to world coordinates, get the world coordinates for the center of the screen, and calculate the direction vector between them. That gives me the direction to send the ship in the world space.

While I was working on this, I realized that the camera was re-centering itself every time I hit a direction key, so I fixed that.

Anyway, those were the big things for this week. Have a good weekend everyone.

Comments
on Feb 25, 2005
reusing segments of code where applicable?
on Feb 25, 2005
The impression I get is that they are reusing old GalCiv1 where applicable (as in, when they can get away with it), but for the most part, writing entirely new code.

At least, that's what I picked up.
on Feb 26, 2005
ce key to my fifth mouse button. ) But it's good to have the functionality there, many people will use it.
on Feb 26, 2005
Awesome news! I can't wait for the beta to come out.
on Feb 26, 2005
s a whole new engine (for starters) with lots of new features.

on Feb 27, 2005
LeegleechN:

You never throw away good code - ever. If you do, you end up having to reinvent it again. Since it's the sequel, a lot of things will be similar while others are different. There's no reason to reinvent those similarities, and it says nothing bad about the game. The only time it's bad is if a company simply doesn't add anything new.

Look at Blizzard - they used the same code on numerous games, the Baldur's Gate series, IceWind Dale, NeverWinter Nights, etc... When they brought out World of Warcraft, it was a completely different type of game than the previous WarCraft games, and therefore necessitated completely new code (which I'm guessing).. Look at the constant "issues" they're having to tackle.

Part of the value of a game company is in the code it already owns, because that code is not dead once it has been used.
on Feb 28, 2005
actual game engine. That way, you can completely change the graphics without affecting the core game. 

on Feb 28, 2005
know other people experienced similar strangeness with SE. Has the code for SE been tinkered with since the GC1 beta or is it still the same?