Forcing client/server with GNet

BlitzMax Forums/BlitzMax Programming/Forcing client/server with GNet

Hi,

Client/server is very much a conceptual thing, and you should be able to fake it with GNet.

For 'pregame' setup stuff (ie: lobby/client/server bit), I recommend creating a separate GNetHost on a different port from the main game host.

This host would have no game objects attached, only 'connection' objects that describe the state of players attempting to join the game. Each connection object could also have a 'chat' slot...instant lobby!

When a 'client' wants to join a game hosted on a 'server', it connects to the server host port and uses GNet messages to negotiate a game connection.

Once the client has been accepted by the server etc, it can then connect to the real game host.

This also allows you to really isolate the server/setup code - it could easily be a separate executable.