VOGONS

Common searches


First post, by speeder

User metadata
Rank Newbie
Rank
Newbie

I am trying to make SimCity 4 run decently on modern machines... the game DOES run, and several tools help, but there are some issues that each generator of computers make it worse.

1) nVidia Optimus and other Switchable graphics: Seemly they pass wrong data to DirectDraw (when DirectDraw query the card info, even using the appropriate flag that already existed to get the 3D GPU when the computer had another chip driving the video, DDraw returns the wrong card).

2) Well... the game use DX7, that is a pain 🙁

3) The game use RDTSC to calculate the CPU speed, this has two issues: 1, stuff that depends on the CPU speed breaks, because it is wrong, and 2, it loads the wrong configuration file, because it loads the configuration based on CPU speed, and RDTSC now can return any arbitrary value (on my computer it returns the base CPU clock, that is 1GHz less than the average).

4) The game was made to be heavily multithreaded, and seemly as long it is not being shiftted around cores id doesn't crash, unfortunately to do that you need to set affinity, and if you count the cores and set affinity to their amount, you end with using half of the processor (ie: because it will assign to itself for example cores 0, 1, 2, 3 instead of 0, 2, 4, 6).

Reply 2 of 4, by speeder

User metadata
Rank Newbie
Rank
Newbie

This helps in the sense that if the app measures speed only at startup, the processor behaves in a manner it expects.

But it doesn't help with speed measurements being wrong when made with RDTSC (something that unfortunately, is quite common).

Reply 4 of 4, by speeder

User metadata
Rank Newbie
Rank
Newbie

When RDTSC was first made, the behaviour was to count processor cycles, if the processor speed-up, RDTSC also speed-up, if it slowed down, RDTSC also slowed down.

The problem that many devs got tempted with RDTSC high performance, and used it (wrongly) to calculate time... as the CPU throttled, RDTSC throttled with it, and you got wrong time... but still correct cycle count.

Since the amount of apps using RDTSC wrong was quite high, Intel decided to make their processors have a separate chip that is never throttled to take care of RDTSC, and all other manufacturers copied this behaviour, also there is no "flag" or "control" that you can use to get old behaviour.

Thus, currently all processors have a separate RDTSC counter completely separate of its clock, and that counter can report whatever number it wants, maybe it will report the CPU max clock, maybe the average, or maybe it will report a completely arbitrary number (say, 666 cycles per second just for giggles)

Thus, you CAN use RDTSC now to get accurate time, just use another source of time (like the system clock, or the motherboard counter that was also recently invented) and count how much RDTSC increased over some time (say, 10 seconds), then you know how much RDTSC increase over time (for example 1234 per second). Thus if you measure one frame and RDTSC was 1234, and in the next it is 1851, you know that half a second passed, but this does NOT mean that the processor did only 617 cycles, maybe it did, but maybe it is a 3.7ghz i7 and instead it did 1850mhz instead...

On my computer, RDTSC advances at 2197 mhz, while my CPU is right now running at 3211 mhz SimCity 4 thus thinks my CPU is 1Ghz slower than it is.

Maybe in the future I will buy a PC where the CPU runs at 2ghz and RDTSC runs at 4ghz, or a computer where the CPU runs at 4ghz and RDTSC at 100mhz (a common bus speed for example) or 60mhz (1000 times the AC grid frequency) or the frequency of some common oscillator chips.