shouzama Posted August 21, 2003 Posted August 21, 2003 Ok, maybe it's a VERY STUPID question, but still I have some trouble figuring how to achieve a fixed framerate... Let's suppose I write my own dx engine and finally managed to render a tile-based map. Now I'd like to place my "main character" on this map (rendered for simplicity's sake with the Sprite object). When my char moves, it should animate. I can very simply change the "drawing frame" of my character everytime I do a BeginScene. However, running on a fast computer this should result in a faster-than-light animation, when on a slow machine it can be painfully sloooooooooow. What I am asking in this useless rant is some hint, link or pseudo code (I use VB.NET, but my problem is more a "conceptual" one than a "code-syntax" one) on how to handle a "fixed frame rate" animation or something similar. Thanks anyone! Quote
TechnoTone Posted August 21, 2003 Posted August 21, 2003 Firstly, I'd like to point out that I have never done this, or anything remotely like it, so I could be way off base. Is it possible to choose which frame from the animation based upon the system clock (or some other timer)? That way, no matter how fast the frame rate is the animation will be fixed. Quote TT (*_*) There are 10 types of people in this world; those that understand binary and those that don't.
AndreRyan Posted August 21, 2003 Posted August 21, 2003 Direct3D is incredibly fast if you do things right, if you post the rendering code someone can see if anything is wrong Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
shouzama Posted August 21, 2003 Author Posted August 21, 2003 Is it possible to choose which frame from the animation based upon the system clock (or some other timer)? That way, no matter how fast the frame rate is the animation will be fixed. [/b] Yes, that was the first thing I thought about. However, I cannot figure not even pseudo-code based on a "timer-sync". :( For instance, if I want to move the character from one tile to another, I'll need to sync BOTH the animation AND the position of the character on the screen. I don't know, it's a lot of work, and I think the solution is REALLY simple... Originally posted by AndreRyan Direct3D is incredibly fast if you do things right, if you post the rendering code someone can see if anything is wrong I don't have any rendering code. :) It's more a "conceptual" problem than a "technical" one... Quote
*Experts* mutant Posted August 21, 2003 *Experts* Posted August 21, 2003 Are you talking about limiting your frame rate so its the same on all computers if the computer can run at that speed? If yes then check out this thread: http://www.xtremedotnettalk.com/showthread.php?s=&threadid=75420 Quote
shouzama Posted August 21, 2003 Author Posted August 21, 2003 (edited) Thanks! Thanks Mutant, that's quite exactly what I was looking for! I suggest everyone has my own problem to read the thread linked above! :) Oddly enogh, I figured also how to perform a sort of "frameskip" on lower-end machines. Simply achieved by skipping the entire "rendering" procedure if the machine is taking too much time. [EDIT: Look at these links, they may prove useful] http://www.visualbasicforum.com/showthread.php?t=88872 http://www.visualbasicforum.com/showthread.php?t=81033 http://members.xoom.virgilio.it/robydx/main.htm The last one is Roberto Zero page, an Italian guy who wrote (and still writes) a LONG serie of tutorials on DX8 and DX9(managed). Unfortunately the entire page is in Italian only (I'm Italian too, btw), but I think the source code can be VERY useful. Edited August 21, 2003 by shouzama Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.