Re: [AD] Shawn's thoughts about new Allegro |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Gillius wrote:
[snip]
My game has a 100fps logic rate that runs independent of the graphics,
drawing the graphics only when it has time too. In slow situations it is
still easy to control. I played it in a very low fps situation on my
friend's 300mhz iMac running MacOS 9 and VirtualPC getting 5-10fps in a
networking multiplayer test. No keys were ever dropped because even though
the graphics were slow the 100fps logic was still there. It was a bit
harder to control because of the low framerate though, but ping was fine
and the other systems saw him just fine ;).
Ah but you see, this is exactly the problem. I'm going to assume you don't
use multi-threading (so no cheating!) :)
Let's say the game runs at 5 fps because Windows decided it needed to swap a
few megs on disk. What happens then?
- Logic loop runs, no keys detected.
- Start of frame draw.
- User presses key
- User releases key
- End of frame draw
- Logic loop runs, no keys detected.
There you go, in that ~200ms needed to draw the frame, the key the user
pressed was lost. This is really frustrating on game where timing is
evertyhing. You see the problem? At 5 fps, there's a 200ms window where no
input can be detected, regardless of the actual rate of the logic loop.
200ms is also a fairly large window, considering that a good typest can hit
keys in the 50ms range. You'd need to maintain 20fps in your game all the
time, which is not something you can garentee.
Now, let's see about those klunky controls.
- Logic loop 1 runs
- Users presses key
- Key is detected, and action is performed (player updates position)
- Logic loop end
- Start of frame draw
- End of frame draw
- Logic loop starts
- Key is detected, and action is performed (player updates position)
- User releases key
- End of logic loop
- Start of next logic loop
- No keys detected
- End logic loop.
Now, although the user pressed the key for over 200ms, it was really
detected in only 2 logic loops, which means that the game thinks that the
user only pushed the key for 2/100 = 20ms instead of 200ms.So the player
only moves by 1/10th of what he should be moving to.
This means that the speed of your player is dependent on the speed of the
computer the game is running at! I don't know about you, but I try to avoid
the MegaRace factor...
--
- Robert J Ohannessian
"Microsoft code is probably O(n^20)" (my CS prof)
http://pages.infinit.net/voidstar/