Euflorium: The Eufloria Community
Eufloria => Eufloria Classic => Eufloria Classic Mods => Topic started by: annikk.exe on May 23, 2010, 08:00:46 PM
-
How is the speed of a While GameRunning() loop governed?
Is it simply a function of how quickly the computer can repeat the commands within it?
Is there a fixed "tick" to it, say once per 0.1ms?
I have noticed that, without a rate limiter in place, gravity appears to happen at different speeds. For example, while balancing orbits, I am finding that an asteroid will be 50% further round its orbit after 20 minutes than it is on most other occasions.
-
Hmm, it should run at the same tick rate as the game logic... which does actually mean that while the game is time-dependent, the Lua is frame dependent. That's not so good for gravity stuff... hmm. One to think on.
-
So if the Lua is frame-dependent, what governs the speed that the frames occur? Is that just the speed of your computer?
On my pc the "frame rate" seems about 110hz, for the level I'm working on.
-
Could be, yeah :( have to have a think.
I thought that 60 was the highest it would go though. hmmm
-
You might be right actually.
Here's how I've been testing it:
-- ** RATE LIMITER **
If GetGameTime() > Timer + 0.01 then
Timer = GetGameTime()
<<run one pass (or frame) of the gravity engine>>
end
This code would mean it runs at up to 100 times per second.
If i change "0.01" to "0.02", ie 50 times per second, the gravity engine seems to run at half the speed - indeed if you look closely you can observe "juddering" as the game moves, pauses, moves, pauses.
However, using the value "0.001" doesnt seem any different to using "0.01".
By the way Alex, if I don't include a Rate Limiter then when I pause the game, the gravity engine keeps running - asteroids continue along their orbits, etc. Using a rate limiter set to "0.00" has no effect on gameplay but fixes this problem. Still, surely it should stop running Lua frames in that way when the game is paused..? Not a huge problem, as I say there is a perfectly good workaround..just thought I'd mention it.
-
Lua should still run I think, there maybe ought to be different routines to call for when the game is paused though.
I will expose the update rate in Lua, but you'll have to work that into your calculations (probably most stuff will be solved by (update_rate/0.0166666) * (original_calculation) ).
-
interesting Q annikk.
-
If you have AI variables that determine how soon the AI performs a specific action, like MINPLANTTIME and MAXPLANTTIME, what does MINTICK and MAXTICK do now? Does it start the timer of the other AI variables?
Would that have any effect? Like max/min lines of code/second?
-
We're not sure what maxtick and mintick do. Strange ones.. :>
-
I know you're not sure. That's why I was suggesting them as a possible solution.
Unless you've already tried them as code speed controls, in which case just ignore me.
-
I haven't tried them to be honest. But I think Alex was implying that it's not currently possible to change the LUA framerate.
I might give it a try at some point anyway...but right now I'm about to move house :P So it will have to wait, unless someone else wants to test it. Can just plug them into one of my gravity maps and see if the orbits seem to go faster or slower.
-
They used to be how fast the AI thinks, but it may have been deprecated such that they now do nothing at all.