1 min
The GameCore (server side) and the GameScene (client side) cpps were getting too big and unreadable. To sort this I changed the switch case I had with the states in different classes all inheriting from an abstract state class (similarly to my scenes). The code in the switch case was moved and it cleaned up the cpp. Now to update the game the code is ..
state[static_cast<int>(current_state)]->update();
A problem occured when I needed to send packets back to the client. I had functions that did this is in the game core called sendMap(), sendPlayers(), etc. But with the code now in different classes I couldnt call these function as they were in the game core and I needed access to them in each state. This would of meant duplicating the code and having the same function for each class. The code was put in a namespace called Packet Compiler and whenever I want to send a packet to a client I call this one of these functions from the namespace and it sends the data to the clients.
PacketCompiler::sendPlayerTurn(server, *current_player_turn);
Subscribe to this blog via RSS.
Low level programming dev diary 28
Text based adventure dev diary 6
Level design developer diary 3
Game engine programming dev diary 14
Audio-visual production dev diary 7
Audio-Visual Production: Particle System Mesh Spawning Issues
Posted on 20 Feb 2020Low level programming dev diary (28) Text based adventure dev diary (6) Level design developer diary (3) Post mortem (4) Ex-machina dev diary (11) Game engine programming dev diary (14) Network game dev diary (11) Audio-visual production dev diary (7)