20151020: Structure of The Nest
I have collected all parts of the project and defined them as sub-objects to my main object “TheNest”. So when calling the world-method to draw, “TheNest.World.CtxDraw()” is used, and the loading of data uses “TheNest.Data.Load()”. This makes it easier to add and remove functionality without getting errors of undefined objects since “TheNest” is always defined and it´s properties/methods will return false if they don´t exists.
While working on the AI part, I decided to reorganize the “Brains”.
My idea of The Nest as a world would define it as a “living” thing where everything inside it is made of and connected to it. The creatures are born only to do some part of work which they are programmed to do, and when they eventually don’t perform enough they are recycled to make place for new creatures.
I try to keep this in mind while choosing where to put abilities.
So when I looked into the game-loop, I found it more appropriate to have a “Tracker” operated by the world-brain instead of letting every creature use their “Orientation”.
TheNest.World will handle all the drawing/rendering, the new gravity, collision detection, status checking, requests for a free lair and things like that. This will be the largest object.
TheNest.Objects will hold all currently loaded objects and definitions of types. (Simulated Enums to check against, like this “object.type==Types.Creature” for better readability instead of this “object.type==1”) and some defaults when creating new objects.
TheNest.Meshes will create, remove, construct, load and update everything that involves 3D-objects as an addon.
TheNest.Brains will hold prototypes for all AI (world-brain included). A “TheNest.Brains.Creature” is added to every loaded creature and is given a “pulse” in every game-loop (their main function get called) so that they can do their tasks like moving/working/sleeping. Without this part, nothing would be happening besides interactions from the user.
Then there is Data, Camera, Console, Pointer & Editor as usual.
20151021: Redesigning Editor (Again)
After editing the console to take up more space, I needed to redesign the editor too.
20151022: Node.js
Started reading about node.js while searching for multiplayer-solutions. Will write more about this later.