Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » My game runs faster in Windows

Credits go to Kris Asick for helping out!
This thread is locked; no one can reply to it. rss feed Print
 1   2 
My game runs faster in Windows
gnolam
Member #2,030
March 2002
avatar

Quote:

Could anyone explain to me why you need more frames than 30 per second? Seeing as motion pictures are typically shot at 25 frames per second and it's good enough for them.

Oh Eris, not another one. Will this idiotic myth ever die? :P

Quote:

I read somewhere that 50fps is about the amount the eyes/brain can cope with. More is (in terms of visible aspects) unnecessary...

Given that the flicker fusion threshold is well beyond 50 Hz, I doubt it. Also, some quick googling gives this: http://amo.net/NT/02-21-01FPS.html

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

piccolo
Member #3,163
January 2003
avatar

you need more then 30 because in the logic loop your doing more then just changing animation frames. for animation if you leave it at 30 you will have a rage from 1 - 30.
what i mean by this is if you want to show the difference in speed of different game objects, like one type of npc moving faster then another type. if you have a bigger range like 1- 60 you will have more to work with.

edit: example

count to 60 then do what in side the loop()
{
//loop
gamelogic()
reset conter to 0

}

is side gamelogic()
{

count to 20 then do what in side the loop()
{
//loop
animat npc1()
}

count to 10 then do what in side the loop()
{
//loop
animat npc2()
}

count to 30 then do what in side the loop()
{
//loop
animat npc3()
}

}

in this example npc2 will animate twice as fast as npc1 and 3time as fast as npc3.

an in game example will be that nps2 has picked up a haste item.

wow
-------------------------------
i am who you are not am i

Fladimir da Gorf
Member #1,565
October 2001
avatar

IIRC most commercial games these days run the logic a lot more frequently than they render the graphics.

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

X-G
Member #856
December 2000
avatar

Well, at a certain point (60+, 75+ etc) it just won't help to draw more anyway, since the monitor probably won't be able to cope with it anyway. So yes.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

kentl
Member #2,905
November 2002

Quote:

Will this idiotic myth ever die? :P

Probably not. And it was an interesting article.

piccolo: You don't need to render at the same pace as your logic is working. And you can also solve the problems you describe using other methods than your way. Thank you for the example though! But I was just asking about the animation speed.

Kris Asick
Member #1,424
July 2001

Well, regardless of anything, I can personally tell the difference between 85 FPS and 120 FPS, but only when switching from viewing one to viewing the other. Without a switch, I can figure out any framerate up to 75 before I lose the ability to discern the difference. (Provided there's no motion blurring, which screws up my ability to tell.)

For instance, I can easily and instantly pick out 24/25 vs. 30 on TV programs. Those two framerates appear very different to me when I see them.

If you really want to trick yourself out, play a non-motion blurred video game (IE: something 3D on the PS, Saturn, or N64), that runs at only 24 FPS or less, for a couple hours straight, then immediately switch to playing a Gamecube game or anything that will go at least 60 FPS. For the first few minutes it will feel like the game is going at an infinite framerate! :D

James: Are you using 32-bit colour? I highly recommend you try switching to 16-bit if you are. The only reason you should need 32-bit with non-accelerated graphics is if you are doing extremely gradual blends or require the presence of an alpha channel in your bitmaps themselves. (Since the blender routines handle the alpha automagically regardless of colour depth.) Switching from 32bpp to 16bpp can almost double your maximum framerate! (Depending on the complexity of your game code.)

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

James Stanley
Member #7,275
May 2006
avatar

Wow! Really? At the moment it is 24 and there is a lot of gradual blurring, but it's mainly just the menu screen background. There's hardly any in game. I'll see what framerates I can get in 16 bit.

EDIT:
Cool! I can now get 45 fps and if I didn't know I wouldn't notice anything wrong with the blurring. I've switched. Thank you.

Jonatan Hedborg
Member #4,886
July 2004
avatar

Quote:

that runs at only 24 FPS or less, for a couple hours straight, then immediately switch to playing a Gamecube game or anything that will go at least 60 FPS.

I don't really see how that's possible, as any game played on a regular ol' TV will play at (at best) 24/30 interlaced (depending on PAL/NTSC).

Audric
Member #907
January 2001

Just as an illustration:
Doom ran its logic at 35 Hz
Abuse ran its logic at 20 Hz

Abuse was especially choppy, the controls made tricky as the keyboard is polled once every 50 ms.

I recommend a minimum of 50 Hz as a logic update speed: it gets physically impossible for a player to press and release a key between two cycles, so your game won't "miss" such events.

Kris Asick
Member #1,424
July 2001

Quote:

Quote:

that runs at only 24 FPS or less, for a couple hours straight, then immediately switch to playing a Gamecube game or anything that will go at least 60 FPS.

I don't really see how that's possible, as any game played on a regular ol' TV will play at (at best) 24/30 interlaced (depending on PAL/NTSC).

I can also tell when a game going 60 jumps down to 30.

Games which play at 60 on an interlaced TV signal will end up being one frame on all odd lines, the next on all even, etc. So naturally, if something moves REALLY quickly, it looks like it has lines running through it for that split second.

Pretty much every game (but not all) on systems on or beyond the PS2 do a special effect on interlaced signals which blurs the pixels in a special way so that it's much harder to see the interlacing. If you look really closely at your TV screen can see exactly what is being done to the signal. (It's taking advantage of the fact that CRT pixels are arranged in triads instead of side-by-side like on LCDs.)

To prove that there is a difference, try playing both the Dreamcast and Gamecube versions of the first Sonic Adventure game. The Dreamcast version runs at 30 everywhere (except the Kart race, which goes 60), and the Gamecube version runs at 60 everywhere (except the cutscenes, which still go 30).

If there was no difference then how could I figure that out? ;)

...and no I'm not crazy. ;D

--- Kris Asick (Gemini)
--- http://www.pixelships.com

--- Kris Asick (Gemini)
--- http://www.pixelships.com

Kitty Cat
Member #2,815
October 2002
avatar

Quote:

I don't really see how that's possible, as any game played on a regular ol' TV will play at (at best) 24/30 interlaced (depending on PAL/NTSC).

You still get 50/60 frame updates per second. One update does the even scanlines, the next does the odd ones, etc. There's 25/30 FULL frames per second, but 50/60 updates a second.

As for logic speed, you do have frame-dropping, yes? You skip rendering frames if you're falling behind so your logic can keep up?

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Tobias Dammers
Member #2,604
August 2002
avatar

Here's another problem with fixed-delta logic at low frame rates: If the physical screen refresh rate and the logic rate aren't exact multiples of each other (e.g. 60 Hz screen refresh and 120 Hz logic), then you will experience timing artifacts: on some screen refreshes, you might have passed 1 logic tick, on others 2. This will disrupt smoothness. At higher logic rates, the difference may be 5 vs. 6 ticks, which is far less noticable.
Unfortunately, there is no reliable way of detecting or setting the refresh rate...

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Audric
Member #907
January 2001

Tobias said:

Unfortunately, there is no reliable way of detecting or setting the refresh rate...

So true :-[
Even if you know the screen refresh frequency (For ex: 85Hz), none of the multitasking OSes can guarantee your 85Hz timer will run exactly ONCE between each refresh.

Once again, the last solution for a smooth flicker-free 2D scrolling is the primitive loop:

while (!game_over)
{
   update_logic(); // More than once if we're "late"
   
   vsync();
   redraw_screen(); // Hope this function is quicker than a refresh  
}

Just have to take the screen refresh speed into account in update_logic().
edit
dumb me, what I talked about is the "ancestor" of delta-time

 1   2 


Go to: