I'm currently designing a server-client game and would like to lower the amount of tightly-coupled dependencies within the game. Basically, I would like the client to change its state when receiving a message from the server. The pseudocode would look something like this:
switch(inputThread.getMessage()){
case "dead":
die();
break;
case "heal":
heal();
break;
}
The problem is that changing what gets sent on the server end requires me to also change the client end, which could be problematic if I want to send a large variety of messages. What design pattern could I use to separate the client and server?
Aucun commentaire:
Enregistrer un commentaire