More zombies in GNet

BlitzMax Forums/BlitzMax Programming/More zombies in GNet

deps(Posted 2005) [#1]
Got another problem with Gnet and zombies.

"Zombies cannot be synced" is a message I get from time to time while playing my game. It only appears when one player is standing on top of another player and shooting. This means that the bullets hits the target as soon as they are created. Looks like I create and remove bullets too fast for Gnet. :P

I had the same problem earlier when a player was shooting outside the screen. (The playfield is warping so players going too far to the right will end up on the left side of the screen, but bullets cannot warp)
I solved that problem by giving bullets a limited life time instead of just removing them when they leave the screen, but I have no idea of how I should solve the stand-on-top-of-foe bug.

I call GnetSync and flushmem so that's not the problem. I used the gnet demo over here http://www.blitzbasic.com/Community/posts.php?topic=50966#568079
as a guide on how to use gnet and can't find what's so different between that one and my code.

Anyone had this problem before and some ideas I could try?


deps(Posted 2005) [#2]
Some other problems I have. (Previous one is still unsolved)

* Computer A is listening and accepting new players.
* Computer B connects.
* After some time the player on Computer B quits the game.
* The game on computer A also quits the game for some strange reason.
No error messages are shown. Why is this happening?

And the other problem.
The local player is looping through all bullets. If they are localy created their position is updated. If they are remote ones their position is compared with the local player to see if they hit:

				If Abs( x - localplayer.x ) < 16 And Abs( y - localplayer.y ) < 16 Then
					Local msg:TGNetObject=CreateGNetMessage( host )
				
					If localplayer.damage() Then
						' Frag
						SetGNetString msg,SLOT_TYPE,"died"
					Else
						' Just some damage
						SetGNetString msg,SLOT_TYPE,"gotme"
					EndIf
				
					SendGNetMessage msg,obj
				EndIf


This is similar to how the gnetdemo is doing it. The local player are later going through all messages:
	For Local msg:TGNetObject=EachIn GNetMessages( host )
		Local typ$=GetGNetString( msg,SLOT_TYPE )
		Select typ
		Case "gotme", "died"
			If typ = "died" Then
				Local frags = GetGNetInt( localplayer.nobj, SLOT_FRAGS )
				frags=frags+1
				SetGNetInt( localplayer.nobj, SLOT_FRAGS, frags )
			EndIf
			Local obj:TGNetObject=GNetMessageObject(msg)
			If obj.State()<>GNET_CLOSED
				CloseGNetObject obj
			EndIf
			
		End Select
	Next


Again, this is similar to how the gnetdemo is doing things. But the frags isn't always updated. The gnetdemo is updating the score inside the If obj.State()<>GNET_CLOSED .. EndIf part, but I moved it outside because it got a little bit better on updating the frags. But it doesn't always update them.

Anyone got any ideas about these problems?


kfprimm(Posted 2005) [#3]
I had the exact same problem. Just comment out line 213,"Assert _state<>GNET_ZOMBIE Else "Zombies cannot be synced",of the gnet source code an rebuild the module.

[EDIT] It shouldnt effect anything because if you run the program in non-debug mode, you wont get the error.[/edit]


deps(Posted 2005) [#4]
Thanks for the tip. Going to try it out.