CPU usage
Moderator: TTDPatch Moderators
-
- Tycoon
- Posts: 14275
- Joined: 09 Jan 2003 08:37
CPU usage
I remember there was some additions in TTDPatch that free CPU usage when game is paused ...
however it does work with wo faster speeds but it does not work on the fastest one (cpu usage is 100% when paused)
however it does work with wo faster speeds but it does not work on the fastest one (cpu usage is 100% when paused)
what are you looking at? it's a signature!
This is because of the way gamespeed works: it decreases the amount of time that TTD waits between two gameticks. The fastest setting means "as fast as your computer can do it", i.e. no delay at all.
The old TTD code used an infinite loop to wait that time to pass. The new code uses the Windows function Sleep() instead, so Windows can do other tasks while TTD is waiting. If there's no delay at all, however, the new method can't do anything to release CPU time, so you end up with 100% CPU usage.
The old TTD code used an infinite loop to wait that time to pass. The new code uses the Windows function Sleep() instead, so Windows can do other tasks while TTD is waiting. If there's no delay at all, however, the new method can't do anything to release CPU time, so you end up with 100% CPU usage.
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
-
- Tycoon
- Posts: 14275
- Joined: 09 Jan 2003 08:37
There is another problem with the speedsetting : it isn't saved with the game.
The game always starts up with normal speed.
Could this be changed?
The game always starts up with normal speed.
Could this be changed?
Wie zich gelukkig voelt met het geluk van anderen, bezit een rijkdom zonder grenzen. (F.Daels)

Still the best OS around
Still the best OS around
That would be nice, yes. 
My game is rather slow,
and trains run somewhat jerky.
I have to hit the Q-key twice, to get them moving smooth again, so I am in favor of the parameter.

My game is rather slow,

I have to hit the Q-key twice, to get them moving smooth again, so I am in favor of the parameter.
Wie zich gelukkig voelt met het geluk van anderen, bezit een rijkdom zonder grenzen. (F.Daels)

Still the best OS around
Still the best OS around
-
- Tycoon
- Posts: 14275
- Joined: 09 Jan 2003 08:37
I don't see how this would be better. If you don't use all the CPU time, it isn't the fastest possible setting, is it? Let's say we put the minimal amount of sleep (1 millisecond) between ticks. Now, depending on the speed of your CPU, the CPU load drops and the game slows down accordingly.
I've experienced with this a bit on my machine:
As you can see, this minimal delay would slow down the simulation so it wouldn't be the fastest anymore.
I've experienced with this a bit on my machine:
Code: Select all
With 1 ms sleep between ticks
CPU usage: 10-20%
Time to simulate one year: 2:21
With no sleep between ticks
CPU usage: 100%
Time to simulate one year: 1:50
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
Who is online
Users browsing this forum: No registered users and 15 guests