darozak / Advolition

1 stars 0 forks source link

Major Change: Pass Robot objects to a Game object for parallel execution #16

Closed darozak closed 7 months ago

darozak commented 7 months ago

I wan to try restructuring the game so that rather than having one robot create and call upon a game object, a game object will create and call upon multiple robot objects, which will operate in parallel.

In this new model, each player will define a unique robot subclass that extends a general robot superclass. The subclass will have an execute function that, when called by the game, causes the robot to evaluate it's environment and propose one or more actions based on the subclass's unique programming. Control will then be passed back to the game engine, which will log the robot's requested actions and move on to calling the execute functions of other robots in the arena. Once all robots have submitted their actions, the game engine will execute the actions in the order that they become due.

The advantage of this approach is that it will allow the player to team up with and/or play against other robots in the same dungeon. Additionally, the NPC robots will be functionally indistinguishable from PC robots.

darozak commented 7 months ago

I've restructured the code so that the game engine holds and manages robot objects rather than the other way around (https://github.com/darozak/Advolition/commit/cc68a5311172cc802c33a66a2bb6128c36650448). Everything works great. This will allow me to have multiple robots playing against one another or serving as NPCs.