Sunday, 27 November 2011

Evolution of the code #8

Right, enough skyrim and assassins creed - time to get back on the code.

Saving time and unit stats
Time can now be saved along with everything in the world. Unit stats (such as primary or secondary) are contained into a .NET dictionary regardless if they are player units or npcs. The problem is that serialization(or saving) of the instance is not included out of the box in .NET, but with a few tweaks im managed to force remember every data in that dictionary into the file.

Ive also managed to fix the player vs npc vs smarter npc problem which was present before. As i see it, in fallout there are 3 bases of units regarding the special character creation system. One which is very complex (the player), one which shares some features with the player (such as the primary status) and another which is simple (much like the non combatant standard civilian). The problem was that I had to differentiate these somehow and implemented the perfectly optimized solution.

Basically, right now every unit holds the character statuses in the .type definition file (including the player and those statistics will be set once the character creation window pops up). This ensures that no further memory is eaten up unless its needed. Once any of these statistics are modified, the unit will save the statistics differently from the .type file.

Having default statistics is as simple as setting the correct values into the unit .type file.
defaultStatistics
{
strength = 5
perception = 5
endurance = 5
charisma = 5
intelligence = 5
...
}

I suppose what is left now is to make the character creation window which spawns every time to work.

Objective window (and possibly other ones) will be non functional this week
Since I've begun working on the pip boy, I'm planning on doing a "modular" window similar to the one from the tech demo. Therefore some windows may not work until its completed.

No comments:

Post a Comment