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
Get Horse Game 2 - Early Access Demo
Horse Game 2 - Early Access Demo
A sequel to a game about horses
Status | In development |
Author | CovalentBonds |
Genre | Adventure |
Tags | 3D, Atmospheric, Experimental, Farming |
More posts
- devlog - 2022-12-01 - v0.2.7Dec 01, 2022
- devlog - 2022-06-11 - v0.2.6Nov 07, 2022
- devlog - 2022-4-02 - v0.2.5May 09, 2022
- devlog - 2022-3-24 - v0.2.2Mar 25, 2022
- devlog - 2022-3-07 - v0.2.1Mar 08, 2022
- devlog - 2022-2-14 - v0.2.0Feb 14, 2022
Leave a comment
Log in with itch.io to leave a comment.