Can I control dmengine_headless fps? (DEF-2054)(SOLVED)

Hi – I am considering using dmengine_headless to run an authoritative server side version of a multiplayer game and then use that to sync state between a couple of clients.

When I run the dmengine_headless executable it runs much faster than when it is rendering graphics.

What I was wondering was whether there was a way to put a kind of restricter plate on the game so that it doesn’t go faster than X game loops per second in headless mode?

I see there is an update frequency in the project, but it is under the “display” heading, so perhaps all of those settings are out the window in headless mode (which makes sense).

What a cool function btw (headless mode)-- thanks for including it.

Cheers,
Alex

1 Like

Hi @goodgoblin!

As you suggested, controlling the fps works fine:

> ~/Downloads/dmengine_headless --config=display.update_frequency=10

However, this is probably not what you wanted to achieve, since the game is essentially still running as fast as possible, with that new (fixed) time step.

And, unfortunately, there doesn’t seem to be a proper sleep function in lua, but there are some alternatives here (quick google). Perhaps one of them could work, depending on your requirements.

3 Likes

Hi @JCash :slight_smile: – thanks for the reply and the tip about using that config flag.

I guess I don’t really understand what is going on in the engine loop.

If update_frequency is set to 10, does that control how many times the update loop is executed per second or how many times the frame is rendered per second or something completely different?

Cheers,
Alex

Hey! It only controls how fast the engine thinks it’s updating, it still relies on the vsync to make sure it follows the real world time. In headless mode this is not active, which makes the update-loop unbounded. Please add a feature request to throttle the update speed of the engine.

2 Likes

Thanks @Ragnar_Svensson! Will do.

Cheers,
Alex