Page 1 of 1

weird logic and or connection and destroying

Posted: 09 Jul 2012, 02:16
by foxter888
hi i been creting a multiplayer game with a fps setting and i have encountered some weird issues and i'm here to see what are the ingishts about it.
for example when i go onto a game scene i join the room and set several events such as on room join, on user enter and so on. now the weird part is that it works fine normally and sometimes all of the sudden is like they where fired off late so when i join a scene i don'g get to the the remote representation of the other player. it's not a issue with instantiating or anything like that it works fine but at some times it gets unstable, anyone would know?

second would be when it comes to destroying a player such as having to do respawning it seems that smartfox doesn't likes it, before i was able to destroy a player example died due to loss of health then reinstantiate him. so i end up getting some null referencer as if they lost a reference to the smartfox connection. i have tried doing things like smartfox = smartfoxconnection.connection and so on. so the work around was to not destroy them and hide the meshes instead which becomes a bit of a hassle since i have to make shure they don't send messages still and so on.

the last one would be is there still a problem with threading or so? or am ijust running the messages weirdly meaning right when someone connects you can tell visually that the screen becomes a bit jittery and i don't mean like position lag or so, i'm already doing interpolation in which i'm still trying to learn it's worings. what i mainly mean would be such as it seems that when some events gets fired it kinds of feel a bit uneasy on the server.

Re: weird logic and or connection and destroying

Posted: 10 Jul 2012, 12:58
by foxter888
i think i'm being able to answer some of my own questions lol, k well when working with unity if you are destroying a gameobject that has or that is using the smartfox events such as event handlers and request handlers it seems to loose a reference of smartfox, before as a way to get around instead before getting destroyed i tried removing those handlers before destruction but it doesn't fully solve the case and i tried doing things like hide the mesh instead of destroying it in which kind of fixes it as a quick fix but still once someone logs out and comes back in i see te issue arise again in which sometimes i'm not able to see them properly because of the reference being lost. so it seems that i have to code it using some form of manager of a main handler inside unity. for some of it.

Re: weird logic and or connection and destroying

Posted: 19 Jul 2012, 07:57
by ThomasLund
Hi,

Have you checked out the examples and seen how they handle connections with a static class?

/T

Re: weird logic and or connection and destroying

Posted: 20 Jul 2012, 00:16
by foxter888
yes i have, i did end up having to change my way of coding such as making managers that would handle the connections and the message sending, so if i end up using any of the smartfox related stuff wheter they are event handlers and so on and if it gets destroyed inside unity i start to see all kinds of errors so yep the problem would pretty much be solved by not destroying any asset that has any type of smartfox code.

now about joining a room, the on join room event does seems to have some issues as an example i just have a simple code where if you join the room it will instantiate all of the users in the scene.

it works fine normally and no errors. but for the most part there is always a user that doesn't see that it fired off for them and normally those or one they are a bit far away from me or they just have a not so great connection. so it's like the message got lost somewhere in the net.