0
\$\begingroup\$

I'm my Client-Server-based game I'm using the following stack:

  • libGDX (Engine)
  • Ashley (ECS)
  • KryoNet (Networking)
  • Box2D (Physics)

Server =========> Client

I've got a Box2DSyncSendingSystem on server-side and a Box2DSyncReceivingSystem on client-side. This will create a list of all body-values from every entities with a BodyComponent in its update()-method and till than send this list via a BodyUpdateMsg to the clients. The client therefore receiving it and adjust all the values to the local bodies.

Client =========> Server

On the other Hand the clients will keep sending their Input values to the server via a InputSendingSystem so the server can adjust the velocities.


The problem that concerns me is that these steps happen every time the update methods are run. So several times a second. Somehow it doesn't seem very well resolved to me.

Sure: You could only send body updates if values have changed. But even if you follow this approach, you could not do without the repeated and permanent sending of the input update messages from the client to the server.

It is also clear to me that there are topics where client-side prediction should compensate for the high latencies, but the problem with the input updates is still there.

I don't want to implement a rocket science like high-end solution (the project is not big enough for that), but rather to implement a good and classic approach, which is typical for network games.

My previous approach may also not be wrong and absolutely common.

Thanks in advance!

\$\endgroup\$
  • 3
    \$\begingroup\$ "Can problems arise?" Sure. Game development is an unending series of problems and solutions. It sounds like you're still in an early speculative phase, and haven't encountered a measurable problem with your implementation yet. If you're just looking for background on generally well-regarded practices, Glenn Fiedler (of "Fix Your Timestep" fame) has a great series of articles on the topic. Try getting started with that and similar resources, and post here if you hit a demonstrable problem. \$\endgroup\$ – DMGregory Jun 18 '20 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.