Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well one aproach would be to setup a client/server architecture. So the server would handle all game world updates and internal logic and the client would only ask the server if it can do certain actions. The server would then respond and the client would only then draw and update the game screen. Non player entities would do the same. The only difference would be the client is human controled and the other entities are computer controled. This would at allow you to seperate the game world setup and events and updates from entity logic. </p> <p>The "message system" you mentioned is called the application protocol and can be a complex esoteric binary system, or simple human readable strings which I would recommend. As the player moves the server will send it a list of entities that are within sight of the client. Non player entities would operate the same way. That is by asking the server for permission to do things, or for information about another entity that the server previously sent it as it moved about and came into the entity's view, and the server responding with the appropriate answer or information.</p> <p>If you were to implement this with sockets you would have the obviously benefit of intrinsic network play as the server would not care if the client were connecting on the same machine the server is running on or if the client is across the continent. This may not have answered your question specifically with code but I hope it was at least food for thought.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload