Monday, 26 December 2011

Evolution of the code #10 - Hearths Warming Edition

Ive been busy lately with the save / load, profile and map transitioning system.Ive also (hopefully!) fixed a few flaws in the objective system design.

I never thought attempting to remake some features from a game could create such coding horror stories. Really... I didnt...

The save and load system
As i have specified a few weeks ago, this game will heavily rely on the actual save system for map transitioning and simply copying the saved files into a different folder to back them up.

Therefore the map transitioning will behave as such:
Player attempts to transition from MapA to MapB.
  • MapA is saved.
  • MapB is loaded.
  • MapB and game world is saved as currentWorld.
and when returning to MapA
  • MapB is saved.
  • MapA is loaded.
  • MapA and game world is saved as currentWorld.
Ive also added a continue button in the main menu, which is visible if a previous game was started (and a currentWorld file was saved).

Why this system? Well, neoaxis can either save the map or the world and the map altogether. Naturally, the world should only be saved once. So i thought it would work by saving the world in a file, then the map in another file... which is not possible due to the saving issue specified before. Since that was impossible to achieve, i decided that saving each map in distinct files and a different currentWorld file which should contain the world and the last known loaded map. Its a lot more complex then i would like it to be but then again what isn't...

The objective system
Ive encountered two major problems with the old design:

1. Every objective was saved as a mapobject - that means each map was saving the objectives. These should be saved only once and remain the same regardless of any map transitions.

2. The objective list should have been saved into the intellect which controlled the entity and not the other way around. This means that the same objectives would remain - even if the user would control more than one unit.

So I had to rectify these problems and make huge design changes of which I honestly dont know which price these will come with. Right now i can only hope i won't run into any un-fixable issues later.

Well that should be about it for now. Happy holidays!

No comments:

Post a Comment