Thursday, 29 December 2011

Weekly Break #2

Second weekly break? This cant be right :D

Ive had to basically redesign the whole player spawning and map transitioning system to make the player transition across maps without fear of losing his statistics, inventory or objectives.

The major problem I've encountered is that a mapobject can't have the player intellect set as parent. I do not quite understand why this is the case but i know it is hard coded to throw an exception upon creating it. So to go around it, I got the idea of storing a list in the player intellect which contains a "dumbed down" version of the player unit class (since this will remain the same with each map load and transition). Why a list? Well, I've created this system while keeping in mind that the user might want to be able to control multiple player units.

Therefore, the actual player units are not stored upon saving the map. After a map is loaded the intellect loads the list which contains what players it had, then physically creates them and applies the corresponding information.

Ive also modified the world creation function so now each map requires at least a spawn point. If one is not defined then it will search for a default spawn point. If any one of these does not exist then the game will throw an exception. Valve had a good idea to make spawn points mandatory with source, and im going with their method.

A quick example of a saved intellect below:

entity
{
    type = PlayerIntellect
    entity
    {
        type = ControlledObjectInfo
        name = Adrian
        life = 50
        inventory
        {
            item
            {
            itemType = WP_9mmAutoloader
            actionMode = 0
            juice = -1
            }
        }
        statistics
        {
            item
            {
            key = strength
            value = 7
            }
            [...]
        }
    }
    entity
    {
        type = Objective
        missionFile = mission00
        logEntries = 0 1
        objStatus = 1
    }
    entity
    {
        type = Objective
        missionFile = mission01
        logEntries = 0
        objStatus = 0
    }
}

Objective updating and log has been fixed as well. Map transitioning is still done by console only but its next on the list.

No comments:

Post a Comment