Forcing client/server with GNet

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

Tom(Posted 2005) [#1]
Hi,

From what I can tell from the documentation, and from testing, GNet doesn't indeed use a client/server method.

It seems that with a session setup where 2 clients discreetly connect to 1 server, both clients will see GNetObjects from other clients after a GNetSync().

It's easy enough to ignore objects that don't originate from the server, but it would be more efficient if we could pass a TList (of recipient peers?) to GNetSync(). That would save on bandwidth.

Other than that, GNet is working pretty good!

Cheers
Tom


cermit(Posted 2005) [#2]
Woah! I was counting on GNet the time i decide to make an online game...


marksibly(Posted 2005) [#3]
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.


Tom(Posted 2005) [#4]
Thanks for the info Mark, I was just concerned that the bandwidth requirement for each player will increase with the overall player count. Traditionally clients only need enough bandwidth to handle 1 peer, the server. Also, that the game is kept syncronised in that 1 host should do all physics updates. I'll keep testing!.....

Quick Q. Are objects sent reliably?


GW(Posted 2005) [#5]
Quick Q. Are objects sent reliably?

Yes, Its TCP/IP.


Tom(Posted 2005) [#6]
Ewww :)


Cruis.In(Posted 2005) [#7]
doesn't use UDP as well? Or that is not ready yet? being worked on