Raydium 3D Game Engine

Official forum for everything about Raydium, ManiaDrive, MeMak, ...
It is currently Thu Mar 28, 2024 11:24 pm

All times are UTC




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: fps limiter
PostPosted: Wed Sep 06, 2006 12:35 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
One maniadrive player told me about the possibility of include a fps limiter. In that way the game won't have to use 100% of the cpu and the rest of the sytem will be more operatable.
Xfennec, how do you see it?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 3:22 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
I've alway found this feature quiet strange :) It's OS job to deal with this, not our (for me, a game should use 100% CPU, whatever the monitor is able to handle it or not ... the player will "feel" it).

To make it short, it's not a priority for me :) (it doesn't means that I refuse such feature in the engine if someone else codes it).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 12:03 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
Well, the monitor has nothing to do with a fps limiter, al least in the idea of this guy.
He just think that a fps limiter could be great to be playing, for example, in an small window, and still be working on the rest of the screen with usual applications.
Myself did something similar in the past: During a time i played Planeshift. In that game the combat was quite repetitive, so i putted the game in an small screen, in "always in top" and then i choose the command to combat and then i continued working in the rest of the screen. Each 10 seconds or more i returned to the little screen and repeted the command again. In that kind of situations a fps limiter is fully reasonable and desirable, since there is no mind in use 100% cpu in a task(the game) when it don't nee d it.


Top
 Profile  
 
PostPosted: Sat Oct 14, 2006 8:23 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
first try to get the FPS Limiter has been commit.
Rigth now i can not imagine a way to make a limiter with functions, so i have changed directly the code in mania drive. Anyway still i'm thinking about to finally convert if in a pair of raydium functions.
Ideas?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 18, 2006 9:24 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
FPS limiter was broken, because of an hardcoded value for clock ticks per second value. I've fixed this with rev 459.

My apologizes, since the required variable was not documented ;) (now added with rev 458)

FPS limiter works well with my "high-end hardware" (ahum ... ;) ) and is quiet accurate, even with win32 ... But I'd like to see this as an option with ManiaDrive, since my eyes cries with "only" 90 FPS instead of my regular 300+ ones ... (I really see the difference).

For the Raydiumization of this function, I see a small and effective void raydium_render_fps_limit(float max) that than the Raydium user can call anytime/anywhere.
This function can change an internal variable, used within a Raydium glutMainLoop() wrapper (using your current code). I dunno if I'm clear ;)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 18, 2006 9:44 pm 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
hmmm, so in your idea the fps limiter is always running, the trick is changing the limit of fps. So if the limit of fps is 10000, the result will be practically equal than if no limiter exists.

Ok, i think it can work. In the next freetime i'll implement it. :D


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 10:16 am 
Offline
User avatar

Joined: Thu Sep 29, 2005 2:59 pm
Posts: 828
in which file could i put the new function? Or should i create a new fpslimiter.c file?
autorespond: in render.c i supopse

update:
All commit.
I have fail writting the description of the commit. I wrote :"Now Mania Drive has now limit by default" when i wanted to say that "Now Mania Drive has NO limit by default".
Xfennec, can you change the comment?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 5:45 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
No ! :) I really don't know how SVN stores all this (I made myself a lot of typo in commits ...). You can always make a "fake" commit right after with a small explaination of the typo.

I'm going to make a few changes to your commit, but your code is near what I was thinking yesterday.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 26, 2006 4:58 pm 
Offline

Joined: Sat Oct 29, 2005 12:43 pm
Posts: 65
I add "raydium_render_fps_limit(60);" in my main function. Because I would like no 100% cpu use.
But cpu always take 100% and physic is not the same... <french>J'ai fait une balle qui se promène... sans fps_limite elle monte une pente sans problème. mais des que j'ajoute le fps_limite, elle devient tres lente, et n'arrive plus à monter la pente... je n'ai peut-être pas bien compris le but de cette fonction. </french>


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 26, 2006 5:55 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
Yes, after reading again the code, I see a major trouble I haven't seen before: we always need 100% of the CPU for the current "waiting loop" ! :)

So we've two things to fix here :
- release CPU time
- find why there's an invariance with physics


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 26, 2006 7:44 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
OK, I've updated a bit the thing (remember to recompile the DLL after the update under win32). CPU time is released.

Totoro, can you make the test again to confirm your invariance bug still exists with this update ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 02, 2006 11:34 am 
Offline

Joined: Sat Oct 29, 2005 12:43 pm
Posts: 65
Oups, je n'ai pas eu le temps de regarder cette semaine, je testerais demain soir :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 03, 2006 6:35 pm 
Offline

Joined: Sat Oct 29, 2005 12:43 pm
Posts: 65
CPU time is ok :D

But, bug with Ode is always here :?

I can send to you an archive with my code if you want see it... I'm learning C, so I can not certify that my code is good ^^


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 03, 2006 6:44 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
OK, do, I'll look at that.
You can find my email in my profile here : profile.php?mode=viewprofile&u=5


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 08, 2006 10:03 pm 
Offline
User avatar

Joined: Sun Mar 16, 2003 2:53 am
Posts: 2591
Location: gnniiiii (Scrat)
OK, I see the problem : You're applying force to the ball in the display() loop.

So a small force is applied each frame while, buttons are pressed. So with a 60 Hz loop (with the FPS limit), you apply the force to the ball only 60 times per second ... and way more with the FPS limiter ! You're framerate dependant.

A good solution here is to use instead the "step callback" of RayODE, which is called each time step of the physics (400 Hz currently). See raydium_ode_StepCallback (there an example of this in test6 for example).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 44 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group