all items
rss feed

/ \
Ugh, stop twitching
grand theft auto frameskip trouble
coding Posted 2001-07-05 09:59:12 by Jim Crawford
I'm absolutely convinced that Grand Theft Auto shares a bug with much of my early code. Remember that jittery feel the intro that convinced you to come to SB99 had, even on the fastest computers? GTA has the same problem.

I realized this whilst playing in software mode (what 3dfx card?) on my speedy newish p3/650... at first I thought the problem was that I was getting a low framerate, but I then I toggled the “framerate limiter,” and the game started moving twice as fast.

So it's running at 70hz.

This is what I think the problem is: the game is updating the game clock a non-integral number of times per frame. Since you can only go through the game loop an integral number of times per frame, this means that they game is being updated by a different amount on each frame -- i.e. if the clock is moving at 1.5 ticks per frame, it would alternate between one and two. 1.75, and it would do one, then one, then two.

That looks and feels awful -- trust me, I've seen the difference in my own code.

The solution? Though it seems unintuitive, round the frameskip up to the nearest integer. A steady framerate of 30 is much better than one that claims to be 45 but in actuality rapidly alternates between 60 and 30.

[link to this] [See more on “coding”]

What intro??
Posted by AdamMil on 2002-08-08 05:48:22
It was an invtro!!
GTA3 trouble
Posted by bass_player_cd on 2002-12-04 09:33:28
I understand what you're saying about the frameskip on the game, but could you explain to me EXACTLY how to code in the frameskip to the next intergral number? I am not very skilled at computer program usage or terms, so please explain in as full detail as possible.

The game on my computer meets the minimum software and hardware requirements, but is only 450 mhz, so its still too slow. If you need to know what the game play is like, it goes real slow and has points(matter of seconds) where the sound may skip and video pauses for a brief moment, and also the text does not show, like the yellow text on the bottom right corner of the screen that tells you where you are or what car you have and the text in the upper left corner that shows the cheats you put in and missions or other notes.

Ive also tried many other things to speed it up, like closing background applications, changing the refresh rate and hardware acceleration, but nothing seems to help. I'd appreciate your help alot. thanks
re: GTA3 trouble
Posted by Jim Crawford on 2002-12-04 11:35:02
My writeup above is really intended for game developers, not the average user. But since GTA2 doesn't share the trouble I was discussing, I don't think the problem I described is the problem you're having with with GTA3. Unless maybe DMA fired that guy who knew what he was doing.

Purely coincidentally, however, I've also had trouble getting GTA3 to run at a decent speed... I'm pretty certain that my p3/650 has more CPU power than a playstation 2, so I suspect that, at least in my case, the video card (a TNT2) is the bottleneck. This is also reinforced by the fact that angling the camera down instead of straight forwards speeds up the game considerably.

I was discussing this with Boring Guy a few weeks ago, though, and he said that the CPU was the bottleneck. His argument was plausible enough, but for the life of me I can't recall what was.

In any case. I don't know much about your hardware configuration, bass player, but poor hardware acceleration is my diagnosis. Grab a GeForce 3 or whatever's considered good nowadays. And if it doesn't work, let me know and I'll advise you to ask someone who knows what he's talking about.
refresh rate trouble
Posted by Jim Crawford on 2003-03-05 11:53:44
It's occurred to me recently that on display hardware where the refresh rate isn't fixed, basing your game engine on ticks of fixed length isn't such a hot idea.

Sorry about that, fellas. I guess in my head, I was still coding for mode 13h.
no subject
Posted by Anonymous (Adam) on 2003-04-09 17:30:50
So, what is the solution for GTA 1? Running at a specific refresh rate, can it make any difference?
re: no subject
Posted by Jim Crawford on 2003-04-10 06:26:01
For the end-user, the only solution I can see would be to turn off the framerate limiter (F9, I think), and just happen to have the exact CPU speed to be running at a good-looking and playable framerate.

Fortunately, due to the camera angle, performance is going to be pretty consistent across different scenes, so you can select the resolution (F11) that fits your CPU (800x600x32 works well on my p3/650) and leave it there.

Unfortunately, if your CPU is so fast that it renders 1024x768x32 at an unplayable speed, then you're gonna have to live with the jerkiness. Or maybe underclock your CPU or something.

It's really not that bad, though. The game is still quite playable, and I suspect that most wouldn't even notice the problem.
no subject
Posted by neutral on 2003-04-11 17:54:21
I think the download page suggests that. They tell you to turn off frame limiting and up the resolution till its playable. I dont know if thats gonna work for me
Posted by Anonymous (ty7t6t) on 2003-10-10 03:08:40
GTA runs choppy
Posted by Anonymous (Joshua) on 2004-01-13 01:17:58
In GTA1, isn't there any code that regulates the frame rate to 30? (in a .ini file?)
My computer is just too fast (P4 2.26 GHz 512MB Ram and a GeForce 4)
I solved the jerkiness problem by following these instructions
Posted by Anonymous (jake) on 2004-09-29 10:24:19
I solved the jerkiness problem by following these instructions :

start - run
type dxdiag
go to sound tab
turn down the hardware sound acceleration slider
play :)

I had to turn mine down to "basic" to eliminate the jerkiness while playing with the frame rate limiter turned on
re: I solved the jerkiness problem by following these instructions
Posted by Jim Crawford on 2004-09-30 00:02:53
Good one! That's thinking outside the box, Jake. Yeah, anything that slows down your computer should do the trick.
poker party
Posted by Anonymous (poker party) on 2005-07-29 22:48:41
poker party
Posted by Anonymous (Rohan) on 2007-02-15 07:06:12
Turning down the dx audio accelleration worked fine! Now I can actually play it without chunks or incredibly rediculous speed lol...

Runs smooth and at the right speed for me on basic accelleration also, on a p4 2.0Ghz with a GeForce FX5200.
add a comment
Only anonymous comments are available for now until I get the user system up and running again. Not many people were logging in anyway, so enh.
Permitted HTML tags: <b>, <i>, <u>, <tt>. Also permitted is the <q> pseudo-tag which is meant to delimit quotes from other messages.
To prove you are sentient, please type "sentient" into this box

what's this?
This is Jim Crawford's blog. Details and contact information.

On Twitter: @mogwai_poet

recent comments
no subject (Anonymous on boxing: a history)
QuickBooks Technical Support Phone Number @1844-640-1482
(Anonymous on may 2013 microblog digest)
phone number for quickbooks support (Anonymous on may 2013 microblog digest)
no subject (Anonymous on boxing: a history)
Accountancy (Anonymous on may 2013 microblog digest)
QuickBooks Technician (Anonymous on may 2013 microblog digest)
no subject (Anonymous on boxing: a history)
quickbooks support (Anonymous on may 2013 microblog digest)
Loved the game (Anonymous on boxing: a history)
no subject (Anonymous on may 2013 microblog digest)
no subject (Anonymous on may 2013 microblog digest)
Aol Tech Support Number (Anonymous on may 2013 microblog digest)
Time Mushyn (Anonymous on foolish 2)
Packers and Movers Bangalore (Anonymous on may 2013 microblog digest)
foreign education consultants in hyderabad (Anonymous on may 2014 microblog digest)
Comments RSS