Gamespeed

Gamespeed

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Gamespeed

Post by zerver »

Since many games get ruined because of low gamespeed, I'm opening this thread to discuss the issue.

Low gamespeed is mainly caused by:
* Players that have slow machines.
* Accidental adjustments of the gamespeed during gameplay that go unnoticed.
* Intentional adjustments of the gamespeed made by players who have slow computer or network.

I suggest some changes to remedy the problem:
* Gamespeed locked to 1.0 by default when hosting.
* The code in GameServer that adjusts the gamespeed should be based on the median player instead of the slowest player.
* The code in GameServer that currently allows speed to drop to 0.5*userspeed should be changed to 0.8*userspeed, and perhaps configurable
* The ability to pause the game may need to be restricted somehow, because players who cannot keep up the speed tend to abuse it.
* I previously considered the possibility to make some kind of voting system that triggers automatically and suggests kicking of slow clients, but I'm not so sure this is needed with the above changes.

FYI, the CPU usage has a different meaning for those who will be running the multithreaded version. With multithreading, any CPU usage less than 100% means that your system can keep up the speed, while the single threaded version can start to slow down the game at any CPU usage really (usually around 50%). It will be highly dependent on the graphics card since the rendering must be run on the same CPU, at least once every 15 game frames. This complicates things further for the algorithm that adjusts the speed based on CPU usage.
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Gamespeed

Post by Auswaschbar »

zerver wrote:* Gamespeed locked to 1.0 by default when hosting.
set[min|max]speed
zerver wrote:* The code in GameServer that adjusts the gamespeed should be based on the median player instead of the slowest player.
Useless. Having lots of fast clients doesn't make the slowest faster.
zerver wrote:* The code in GameServer that currently allows speed to drop to 0.5*userspeed should be changed to 0.8*userspeed, and perhaps configurable
Too less to be effective.
zerver wrote:* The ability to pause the game may need to be restricted somehow, because players who cannot keep up the speed tend to abuse it.
nopause
zerver wrote:* I previously considered the possibility to make some kind of voting system that triggers automatically and suggests kicking of slow clients, but I'm not so sure this is needed with the above changes.
Yay, instead of slow games, we have ruined games. Beside that, only the host should be allowed to kick people.
zerver wrote:FYI, the CPU usage has a different meaning for those who will be running the multithreaded version. With multithreading, any CPU usage less than 100% means that your system can keep up the speed, while the single threaded version can start to slow down the game at any CPU usage really (usually around 50%). It will be highly dependent on the graphics card since the rendering must be run on the same CPU, at least once every 15 game frames. This complicates things further for the algorithm that adjusts the speed based on CPU usage.
Indeed an issue. Any ideas?
Masure
Posts: 581
Joined: 30 Jan 2007, 15:23

Re: Gamespeed

Post by Masure »

When a speed down occurs, logging it in the console could be useful for host to manage players.

As you can't see the speed downs, after 30mn of intensive gaming, you realise "WTF the game runs at 0.35 !? Is a single player screwing the whole game ?".
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Gamespeed

Post by zerver »

Auswaschbar wrote:
zerver wrote:* The code in GameServer that adjusts the gamespeed should be based on the median player instead of the slowest player.
Useless. Having lots of fast clients doesn't make the slowest faster.
The purpose is to get rid of the slowest players. If I understand correctly, players will drop if they cannot keep up with the server gamespeed.
Auswaschbar wrote:
zerver wrote:* I previously considered the possibility to make some kind of voting system that triggers automatically and suggests kicking of slow clients, but I'm not so sure this is needed with the above changes.
Yay, instead of slow games, we have ruined games. Beside that, only the host should be allowed to kick people.
This is a matter of taste. Personally I'd much rather have a fast game with some people that get kicked than a slow one without the kicking. The remaining players can always take...
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Gamespeed

Post by zerver »

Masure wrote:When a speed down occurs, logging it in the console could be useful for host to manage players.

As you can't see the speed downs, after 30mn of intensive gaming, you realise "WTF the game runs at 0.35 !? Is a single player screwing the whole game ?".
It is even worse when u discover that the game has been set to run at 0.6 the whole game, for no particular reason.
YokoZar
Posts: 883
Joined: 15 Jul 2007, 22:02

Re: Gamespeed

Post by YokoZar »

Just put a dot next to the slowest player when the game is running at full slowdown, then let the players decide what to do. Having to guess from CPU usage isn't helpful.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Gamespeed

Post by lurker »

I don't know if the engine should really be doing that, and such a marker should be able to show how much faster it'll go without that person. If it's something like 2%, kicking isn't a good idea.
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Gamespeed

Post by zerver »

lurker wrote:I don't know if the engine should really be doing that, and such a marker should be able to show how much faster it'll go without that person. If it's something like 2%, kicking isn't a good idea.
Good point. But focusing on one player at a time raises another problem - suppose we have two equally slow players. The system will have a hard time detecting which is the slowest, and it will also say that it will be 0% faster if either of them is kicked.

I think it is much better and simpler to enforce the gamespeed and simply let some players drop - Any player being slower than the median player if the game speed is not within the acceptable range.
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Gamespeed

Post by zerver »

Auswaschbar wrote:
zerver wrote:FYI, the CPU usage has a different meaning for those who will be running the multithreaded version. With multithreading, any CPU usage less than 100% means that your system can keep up the speed, while the single threaded version can start to slow down the game at any CPU usage really (usually around 50%). It will be highly dependent on the graphics card since the rendering must be run on the same CPU, at least once every 15 game frames. This complicates things further for the algorithm that adjusts the speed based on CPU usage.
Indeed an issue. Any ideas?
I think so. The necessary time spent in Draw() should be counted as "Sim time" for the single threaded version. One Draw call every 15 Sim frames, that is.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Gamespeed

Post by AF »

YokoZar wrote:Just put a dot next to the slowest player when the game is running at full slowdown, then let the players decide what to do. Having to guess from CPU usage isn't helpful.
Mystery meat GUI?
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Gamespeed

Post by zerver »

YokoZar wrote:Just put a dot next to the slowest player when the game is running at full slowdown, then let the players decide what to do. Having to guess from CPU usage isn't helpful.
That won't work. In the heat of the battle, do you expect anyone to have time checking for small dots? ROFL
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Gamespeed

Post by Tobi »

IMO none of these automatic things should be changed, but possibly a menu should pop up when the game is lagging badly (whether it's network or CPU). This menu should pause the game.

If it's network lag and the player(s) kept up again, then the menu should disappear silently and game continue.

If it's CPU lag the menu could offer the host the possibility to kick this player, or to continue (in which game menu shouldn't come up again for CPU lag).
Auswaschbar wrote:
zerver wrote:FYI, the CPU usage has a different meaning for those who will be running the multithreaded version. With multithreading, any CPU usage less than 100% means that your system can keep up the speed, while the single threaded version can start to slow down the game at any CPU usage really (usually around 50%). It will be highly dependent on the graphics card since the rendering must be run on the same CPU, at least once every 15 game frames. This complicates things further for the algorithm that adjusts the speed based on CPU usage.
Indeed an issue. Any ideas?
Don't send CPU speed over the net, but send some corrected CPU speed over the net.

If Sim has a single full core this would be wallclock time used for Sim divided by total wallclock time.

If Sim has to share it's core with rendering, use wallclock time used for Sim divided by wallclock time spend doing pointless things while waiting for next NEWFRAME message. (pointless things = rendering second, third, fourth etc. time after a single NEWFRAME)
Auswaschbar
Spring Developer
Posts: 1254
Joined: 24 Jun 2007, 08:34

Re: Gamespeed

Post by Auswaschbar »

zerver wrote:I think it is much better and simpler to enforce the gamespeed and simply let some players drop - Any player being slower than the median player if the game speed is not within the acceptable range.
Simpler yes, better no. Slow game is better than dropped players. I personally prefer to play games till the end instead of letting half of the players drop during mid-game.
zerver wrote:
YokoZar wrote:Just put a dot next to the slowest player when the game is running at full slowdown, then let the players decide what to do. Having to guess from CPU usage isn't helpful.
That won't work. In the heat of the battle, do you expect anyone to have time checking for small dots? ROFL
You only need to check dots when game runs slow, and when it's slow you have time to check them. QED.
Still better than having half of the players drop during heat of the battle (beside they would not lag after the battle has ended).
zerver wrote:I think so. The necessary time spent in Draw() should be counted as "Sim time" for the single threaded version. One Draw call every 15 Sim frames, that is.
I either get you wrong, or everyone will have 100% CPU usage then (because there aren't more CPu-time consumers other than Draw and SimTime).
zerver wrote:The purpose is to get rid of the slowest players. If I understand correctly, players will drop if they cannot keep up with the server gamespeed.
No, its purpose is to reduce CPU load so players don't drop.
zerver wrote:This is a matter of taste. Personally I'd much rather have a fast game with some people that get kicked than a slow one without the kicking. The remaining players can always take...
1. you can kick them any time. No change required.
2. imho, if you aren't playing dsd 6v6 or speedmetal, dropped players means gg and no game at all
zerver
Spring Developer
Posts: 1358
Joined: 16 Dec 2006, 20:59

Re: Gamespeed

Post by zerver »

Auswaschbar wrote:
zerver wrote:I think so. The necessary time spent in Draw() should be counted as "Sim time" for the single threaded version. One Draw call every 15 Sim frames, that is.
I either get you wrong, or everyone will have 100% CPU usage then (because there aren't more CPu-time consumers other than Draw and SimTime).
Not all Draw calls, only one every 15 Sim frames.
Auswaschbar wrote:
zerver wrote:This is a matter of taste. Personally I'd much rather have a fast game with some people that get kicked than a slow one without the kicking. The remaining players can always take...
1. you can kick them any time. No change required.
2. imho, if you aren't playing dsd 6v6 or speedmetal, dropped players means gg and no game at all
Again a matter of taste. A slow game means gg for me because I get bored and basically stop playing.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Gamespeed

Post by Tobi »

Auswaschbar, to clarify, in single threaded version time is "wasted" re-rendering the same simulation frame as much as possible, while waiting for the next NEWFRAME network message. These time wasting renderings should not be counted for Sim CPU usage, while other - required - renderings should be counted. This could be one rendering frame ever 1-15 sim frames I suppose. (dunno what we'd consider acceptable minimum FPS..., maybe 10?)
YokoZar
Posts: 883
Joined: 15 Jul 2007, 22:02

Re: Gamespeed

Post by YokoZar »

AF wrote:
YokoZar wrote:Just put a dot next to the slowest player when the game is running at full slowdown, then let the players decide what to do. Having to guess from CPU usage isn't helpful.
Mystery meat GUI?
A descriptive icon, rather. Just something that calls attention to "hey this is the player slowing down the game, see look at his CPU load"
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Re: Gamespeed

Post by el_matarife »

This needs to be an API accessible by Lua since a lot of folks are running UI mods now and not the default player status list. I suggest two icons, a computer chip with a lightning bolt through it for CPU issues, and a network jack / cable with a lightning bolt through it for network issues which would include ping time over 500Ms, delayed frames, or desync.
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: Gamespeed

Post by lurker »

If you mean the advanced player list widget, the last two symbols are already network and cpu.
If you mean the player list in iceui, there are buttons to switch it to this info.
Where did you get the impression that UI mods didn't have access to this data?
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Re: Gamespeed

Post by el_matarife »

I'm saying if there's a programmatic way showing which player is running sim time the slowest, or anything like that, it shouldn't be just in the default widget.
User avatar
Pressure Line
Posts: 2283
Joined: 21 May 2007, 02:09

Re: Gamespeed

Post by Pressure Line »

el_matarife wrote:I suggest two icons, a computer chip with a lightning bolt through it for CPU issues, and a network jack / cable with a lightning bolt through it for network issues which would include ping time over 500Ms, delayed frames, or desync.
just remember that not everyone is running on superfast connections or is in the europe/us, my ping usually floats between 500-1000ms
Post Reply

Return to “Engine”