top of page
Search

Getting Server and Client Working

  • Writer: Hubert Zhou
    Hubert Zhou
  • Dec 24, 2023
  • 2 min read

Since we needed multiple computers to communicate with one central PC, having a robust way to synchronize and communicate is important. The timing analysis showed it could be done reliably, now it's time to build the framework that the PC uses to contact these "servers" that control different parts of the room.


I could bore you with all the code here but that's not very effective. Let's just explain the principle of how the communication works.


The PC is acting as a client and the auxillary computers in the room in this distributed computing network are acting as servers. The PC needs to take in user input for level and needs to get all the servers ready for the game. It needs to also listen back for any sudden, urgent messages from the servers. Two threads are used along with an outgoing message queue to allow for all this to happen essentially simulatenously. The servers will need to reply to the PC while also getting information from it. They too need these two simulatenous threads.


The sequence at start is simple. PC waits for user input. Then send "Client, INITIALIZE_GAME,<level_number>". It waits for every server to send an ACK Frame back: "Server,ACK". And then the PC can send START_GAME. The servers will run their games simulatenously, offering up point and life updates to the client.


As of now, the game mechanics are being controlled by PyGame event messages. This allows for custom events to be passed easily from the server communication threads to allow for preemption and other concurrent processes to occur during the game.


The next blog post will have a very simple game running to show this in action!





 
 
 

Comments


About Our Project

Our team has partnered with Activate to create a new gaming room to keep adults and children active. Our "Protect" room features engineering design concepts from various Mechatronics engineering coursework such as controls, circuits, and machining. Stay tuned to get updates on our design process!

bottom of page