Rick's Blog
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).
The game board and the player interface should be relatively siimple; an HTML structure running javascript with OpenGL for the visual elements, and using socket.io to transfer messages back and forth to the node.js server. The main program will be mainly responsible for managing messages.
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!🤷🤞
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.
Comments