Greetings denizens,
I'm making my first game in LÖVE for a school project. It's a 2d shooter, a remake of Stick Soldiers 2. I want to have online multiplayer, so it has client and server components. Both use the same 'Game' object. Game has a 'getState' method which grabs the status of each in-game object (xy coords, which weapons each player has, how much ammo/capacity each weapon has, etc.). Game also has an 'unpackState' method that, for each part of the state passed in, it updates or creates the corresponding object in the game.
Right now I'm running getState on every update on the server side, and sending it to the client, who runs 'unpackState' on their end. This is waaaaay too slow, but I'm not sure what the best way to make it good??? Help???
Rate my client/server structure
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- lazershark3k
- Prole
- Posts: 27
- Joined: Tue Apr 10, 2018 3:20 pm
Rate my client/server structure
*pew pew*
Re: Rate my client/server structure
Don't update every frame. Send only things that change when they change(such as key presses and stat/inventory changes).
This will cut back on a lot of net traffic.
Have some kind of sync packet that can correct any deviation every half second or something for movement and a lot slower for stuff that does not change often. For movement make sure your lerping if there is deviation so stuff does not pop around.
This will cut back on a lot of net traffic.
Have some kind of sync packet that can correct any deviation every half second or something for movement and a lot slower for stuff that does not change often. For movement make sure your lerping if there is deviation so stuff does not pop around.
- lazershark3k
- Prole
- Posts: 27
- Joined: Tue Apr 10, 2018 3:20 pm
Who is online
Users browsing this forum: Google [Bot] and 3 guests