Life On The Farm - Episode 2 - Structure
The first task was to design an overall program structure that would share data efficiently between the server (running node.js), the game board (planned to be served in a web browser) and several player mobile devices (also in web browsers).
Inside the main program will be a Game Class. The Game object will be responsible for managing all of the generic game activities (keeping track of turns, handing out cards when required, tracking player locations on the board, etc.). The Game object will contain an array of Player Class Objects.
The Player object will be responsible for keeping track of each player's details (current position, assets, score, which mobile connection corresponds to the player, etc.)
I considered duplicating the Game and/or Player class in both the Player and the Board. That would require constantly synchronizing the objects which turned into a lot of overhead that wasn't really necessary. The current plan is to have a single master object and pass information when required. Sort of a Just In Time data delivery system! 😊
The first draft player interface will be simple text. The first draft of the game board will need to be OpenGL to help with future development. The lesson learned from my failed first attempt will be to keep the visuals simple until game play is working.
Next Step: Getting the basic game logic working!🤷🤞