devlog - 2022-4-02 - v0.2.4


currently, the relationship system is a dictionary

it contains

key                            : value

{ object reference : int}

where object is a reference to the node representing the entity the NPC has a relationship with, and int is a the value of that relationship

the problem, is nodeID is randomly assigned by the game engine when nodes enter the scene. if these references are stored, loading them in will be meaningless across game sessions.

what needs to happen instead, is there needs to be a global manager for mediating between persistant UIDs and references to node.

one solution could be to have every entity which can have a relationship implement a few methods.

generate_uid()

called when the node enters the scene. generates a random uid for the node and saves it to its entityID value

in actuality, this is handled by the GEIDR and is just an int that increments every time a new entity is registered.

register_uid()

check if a node with that entityID has already been registered. if not, registers it in the GEIDR (Global Entity ID Registrar)

the relationship system will change to track entityIDs instead of references to node, and will use a getter method to get the corresponding node reference from the GEIDR.

# problems

if generate_uid() is called when a node enters the scene, on newgame that works fine. but on load game, there is an issue. it will get called again when nodes are loaded in.

if our set(param, val) method for entities handles updating the references in GEIDR, it will work fine but there will be lots of extra entries with broken references.

the set method also needs to remove the newly generated entry before updating the GEIDR with persistent data.


actually, after implementing it became apparent that the number of entities would always be the same as when the game was exited, so there won't be any extra allocations. collisions don't matter since they get resolved after persistent data is assigned and it "just works."

this new entityID system also solved some problems with trainers for tamed horses being null references after loading a save.

there's also a new item: Apples, which increase relationships with horses, tho they are currently unattainable

Files

horse-game-2-demo-win.zip 1 GB
Version 5 Apr 03, 2022

Get Horse Game 2 - Early Access Demo

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.