A few GNet questions

BlitzMax Forums/BlitzMax Programming/A few GNet questions

ozak(Posted 2006) [#1]
First. When a connect fails, I can no longer listen with my host. It says the port is already in use?!

Second, I maintain my own objects so I need to know when a client connects, and I need to keep track of which GNet objects belong to which local objects.

Anyone have any insights of using GNet like this, they would like to share?

Thanks

Ozak


Winni(Posted 2006) [#2]
I don't know about GNet, since I have not used it, yet. But I came across a similar behaviour with other development tools, and I think the explanation simply is that the operating system does not free the used sockets/ports immediately. On Mac OS X I observed that it could take up to a minute before a port became available again.


AlexO(Posted 2006) [#3]
make sure you close the socket that failed the connection afterwards. Otherwise it is still occupying that port.


Dreamora(Posted 2006) [#4]
Which gnet object belongs to which local is no problem. There is a method to assign an object to a gnet object.
This does not transfer the local object when syncing, its only a easier way to manage "relations".


ozak(Posted 2006) [#5]
Ok. How do I tell when a new player is connected?
What I need to do is detect new connections, and then attach an object to them. Once I recieve updates to them, I need to update the attached objects to their new state.
I totally dig the GNet sample, but there you just draw players/bullets right away. I'm using MiniB3D so entities exist in the MiniB3D system as well.

Maybe I could check if GNet objects have an attached object, and if not so, assign them a new one?
Would this work? (I'll test more tonight when I get off work)

When a client disconnects, can I check for Zombie states to remove local objects?


Dreamora(Posted 2006) [#6]
Thats a "little tricky", as you will need 2 objects:

- Remote Object that comes in from the player when he connects. Thats the one he updates and whichs change you send to other players

- Local Object: To this you connect your entity. This is the object you feed with the data you got from remote object as this one will be synced with all players.

This means for the client, that he must check for his own remote object from server as well and react to it (changing health etc)

I'm not sure if zombie state works. If the client leaved successfully, then yes, it will be flagged as zombie.
But what I'm not sure about is what happens when it just crashes/shuts down and thus does not close successfully.

PS: The methods are SetGNetTarget / GetGNetTarget


EDIT:

I think I need to correct myself or add something: Depending on your desired setup, it might be possible that you don't want to clone the objects on the server or in case a player is player and server, this wouldn't be a good idea at all.
In that case you can use SendGNetMessage to send Remote objects a message with the updated information.


ozak(Posted 2006) [#7]
Thanks. I'll do some more testing and get back to you :)