0 votes

Hello,

I started with the implementation of multiplayer for a RTS game. I don't want to implement lockstep architecture, so I decided to create a server, to which all the clients report commands, and the server returns the unit position/rotation/state/etc on each frame.

There are a lot of rpc calls, as there can be up to 1000 units. The game will be capped at 60fps. So I have next questions:

Does underlying logic aggregate the rpc calls (setposition, setrotation etc) into large UDP requests, and sends them once per frame, or does it send an UDP request for each rpc call (which would be like 1000 * 60 * ~5 = 300k calls per second in my case? Or is an "In between" solution implemented?

If it sends an request for each rpc, I have to manually create a function that sends all the parameters for all units once per frame?

asked Jul 12 in Engine by gmaps (196 points)

I don't know about optimizations done by Godot (AFAIK it just uses ENet), but I'd consider not sending things every frame if there are many, maybe once every 4 frames maybe, so you can spread out the load and interpolate on the client.

Yeah, it makes sense not to do it every frame. I implemented a simple master - slave configuration, and its working well for now. Master is computing all the physics, states (animations) and other parameters (HP, number of bullets, etc) and sending transforms and events with timestamps to puppets. Puppets then interpolate between the transformations for location and are latency + fixed 50ms interval behind the master, so the game runs smoothly. In this way, the master has slight advantage, but unless the latency's really high, it's no big deal.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.