Nice notice (fixed it into my version)
Code:
d := G_FORCE/(d*d*d);
It does mean same thing as:
Code:
f:=G_FORCE/(d*d);
d:=f/d;
Also there is no Application.ProcessMessages in that version (you can remove "forms" from gameunit uses list). It was replaced by
Code:
while Threads>1 do sleep(1);
in the physics main thread. It still doesn't hang the application because it's a separate thread. Spiking in framerate is simply because of heavy utilization of CPU i think. Trying with this seems to work too, but i feel like it is actually consuming CPU resources more with loop like that
Code:
while Threads>1 do ; // <- Don't do this
So with this i see an increase in physics loop time.
It should be ok to have 4 threads even on dualcore, remember that each thread gets different workload. Meaning that other CPU could be without work for longer time, if i only had 2 threads. At the same time people with quadcores can test it too. It might even be faster with 8 threads.
Also works better if i comment out SetFrameSkipping(false); Showing more realistic framerate (~40) numbers too, when it's not pushed to draw as much as possible.
Bookmarks