Looking for some advise in how to use Gnet

BlitzMax Forums/BlitzMax Programming/Looking for some advise in how to use Gnet

Digital Anime(Posted 2011) [#1]
I want to start writing a multiplayer game and I want to give GNet a shot, because it does what I want according to the explanation given.

I noticed that GNet doesn't have much commands, and I want to know if my approach is the correct way of doing it.

One downside I noticed from the examples is that the host cannot tell who send the packets. So I'm thinking of getting the MAC address first on the client (which in normal cases should be unique using brucey's bah.inet) and send that to the server so the server will know the difference between the clients. Is this approach a good way of doing it?

My first goal of the game is the following:
The server will need to update several players and and players are able to add/remove objects in that world, or make changes to the world.

So my guess is that every single object that is editable in that world needs to be a new local GnetObject on the server.

If a new player joins it will mean it has to sync every single object first and that will take some time, but it's more important for me that every player has exactly the same objects at the same location on his screen.

I hope to see your opinions in this.


Rixarn(Posted 2011) [#2]
Hi,

Well, i'm not very experienced with multiplayer programming and i've just used Gnet once, for a LAN App. If you don't need "real time" updating, then perhaps GNET is what you´re looking for. The app i did was a jigsaw-like game, and i used gnet to sync an object from each side that represented the gamepad's input (arrow pad and buttons). Since i didn't made code to periodically check the consistency of the gameworld, when ugly lag spikes happened then things get screwed :) But since it was an app used only over Lan, it never happened thus i didn't bother to fix it.

As for your approach, you can send the machine's IP address to identify players. Try this:


	Function Iplocal:String() 
		'get local ip address
		Local ip_array:Int[] = HostIps("") 
		Return DottedIP(ip_array[0])
	EndFunction



HostIps and DottedUP are functions of the brl.socket.mod

Since Gnet syncs objects is slower than other methods, why don't you try Brucey's RakNet Module? It's obviously more complex, but from what i've read here in the forums it's worth the trouble. And personally i'll trust more raknet that gnet. :)