GNet Stops working/closes or app wont close

Started by William, August 10, 2023, 20:58:52

Previous topic - Next topic

William

Initially Local newx:Float = EntityX(loc.playerentity) - loc.X() returns 14. i assume this is because i moveentity x 14 degrees.

afterwards, this variable returns 0 and i do not know why. I can try positionentity at absolute locations just that i believe moveEntity is the best way to do this via udp networking for smooth movement with high latency/long distances etcetera so that the player is not skipping movement.

i also do not know whether this variable is the correct method for telling the client how much to move a player, subtracting the x coordinate from the current player position.
loc.x returns getgnetfloat from object, setgnetfloat is set entityx()  every while loop when the w key is pressed, i am stuck on this.

http://github.com/zarosath/medievaldream.io
im still interested in oldschool app/gamedev

William

essentially there is no difference so this variable returns 0 i believe. is it something wrong with GNet? Sometimes Gnet stops responding and stops working. i close the object and host of each client before exiting.

the server stops working after the player has been moved with moveentity.
im still interested in oldschool app/gamedev

Midimaster

I told you already all the thing you need to know to solve this problem. I dont want to write it again and again. You need to read posts carefully and react on it with minimum give it a try!

I dont know how to help you if you do not listen and do not follow!

I never get a reaction from you on my posts. You only ask questions but do not read the answers. So please go back to my answers two weeks ago in Discord and in SyntaxBomb Messages and in SyntaxBomb WorkLog and study what I hav written. The discuss with me, what you do not understand.

Hope you will do it
best regards
peter
 
...back from Egypt

William

@Midimaster i looked at private discord messages and did not find anything pertaining to gnet stopping working, can you share about that here? previously it were the result of not closing Gnet Objects and hosts while closing the application that caused the app because of Gnet the application would not close and the memory leaks.

it is most likely something simple and i love bmax, i believe this is the result of having a single developer because these memory leaks and functions should not be. when i get cash in my visa i am going to donate. i think it is too large of an application for a single developer to maintain and develop.

can you explain why newx variable returns 0? i am not sure, is getGnet and SetGnet, is it regarding the Gnet Objects how they're handled somehow?
i will post the Gnet class file i created and the code examples you've of had shared.
im still interested in oldschool app/gamedev

William

Function ScanGnet()
    ' find new
    For Local obj:TGNetObject=EachIn GNetObjects( host, GNET_CREATED )
      TPlayer.Addplayer obj
    Next
    DrawText "TPlayers:" + TPlayer.All.Count() , 30,130

 For Local obj:TGNetObject=EachIn GNetObjects( host, GNET_CLOSED )
 TPlayer.ClientHasClosed(obj)
 Next
 
 For Local obj:tgnetobject=EachIn GNetObjects(Host, GNET_MODIFIED)
       For Local loc:TPlayer = EachIn TPlayer.All
 If loc.GObj=obj
 Local newx:Float = EntityX(loc.playerentity) - loc.X()
 If newx = 0 Then Return
 Print newx
 MoveEntity(loc.playerentity,newx,0,0)

 'loc.y
 'loc.
        EndIf
      Next
 Next
End Function
im still interested in oldschool app/gamedev

William

main loop:
   GNetSync(Host)
ScanGnet()

If KeyDown( KEY_D )=True Then MoveEntity Pivot,0.1,0,0
If KeyDown( KEY_S )=True Then MoveEntity Pivot,0,0,-0.1
If KeyDown( KEY_A )=True Then MoveEntity Pivot,-0.1,0,0
If KeyDown( KEY_W )=True
MoveEntity Pivot,0,0,0.1

SetGNetFloat(LocalPlayer.GObj,1,EntityX(localplayer.playerentity))
EndIf


and NewX variable + Tplayer.X() method

    Method X:Float()
        Return GetGNetFloat(GObj,1)
    End Method


im still interested in oldschool app/gamedev

Midimaster

Quote from: William on August 11, 2023, 16:32:15...when i get cash in my visa i am going to donate....
No donation needed! I already have to much money!

To check if the server really stopped working I suggested this:

SERVER HANG
https://www.syntaxbomb.com/index.php?msg=347058629

I wrote this in your WorkLog here on SyntaxBomb. But you never answered there or started a discussion. If you do not understand my ideas ask further questions related to my article.



And in this post I also explained, why your GNET reports Zero

And also I descriped a solution. And pointed to another bug in the code.



...back from Egypt