glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[glob2-devel] Re: Core Rewrite Why & How


From: Bradley Arsenault
Subject: [glob2-devel] Re: Core Rewrite Why & How
Date: Thu, 26 Apr 2007 00:06:37 -0400

5) Want an example? Look at all of the init functions in Engine.cpp.
Right now I'm replacing the majority of that code with code that
manipulates MapHeader and GameHeader. There will be one init function
that takes the two headers, loads the map, and initiates a game.
Another function would generate a GameHeader for a campaign map.
Campaign maps have the properties that there is one local player, and
several null AI's. GameHeader can also be created by the GUI, when the
user selects options they want for a particular custom game.

The GameHeader could also be received over the internet. And it could
also be loaded from an existing game save. And as a new feature in the
future, the game header could also be saved as a "preset settings" for
a custom game. In all these examples, the same init function would be
called, just different GameHeaders would be supplied. If you
implemented  a related new feature, you could place it in GameHeader,
and everything would work. Why? Because everything uses GameHeader.
That is maintainability.

Implementing this isn't much of rewriting. Instead I'm reorganizing.
I'm taking the code we already have that generates one local player
and several null AI's, and just moving it to a new function, and
changing it slightly to operate on GameHeader. Again, much of our
existing code works and I respect that fact, and I use it to save
myself time. I'm doing mostly reorganizing, on both large and small
scales.

Why do this? Well, the original system didn't have a game header. It
had SessionInfo, which was constantly created on the fly for loads and
saves, and a large assortment of other places. That means to change
SessionInfo, you changed many places, most of which you had to find
yourself after reading megabytes of code, or grep'ing code for more
advanced users. The GameHeader sovles this problem. GameHeader is
dynamic, and its in GameHeaders nature to be completely replaced at
game time. This isn't side effect or design flaw. Its defined
behavior, that I personally believe makes GameHeader very open ended
and flexible, so that doing a large scale rewrite in the future won't
be nesseccarry.

--
Really. I'm not lieing. Bradley Arsenault.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]