Archived

This topic is now archived and is closed to further replies.

ca_priest

frame rate question regarding an rpg

Recommended Posts

Im just implementing the idea of frame rate my game now, at the moment the players character is the only thing on the screen thats moving. Lets say for instance i want a villager that walks a pre-set or random path around a particular village that the character is currently in. Would this be taking place as follows; input is retrieved from user, for example which direction to move, whether or not to move at all, pick up an item, look at his item inventory etc., draw the next frame depending on this input, then draw the villagers next frame of motion, and any other moving creature/character frame thats on the screen, then put in a pause using a time function, then return to the beginning...im guessing this is how i should do it but im not certain. Are there better ways than this? faster ways??Infact im wondering if its even practical to utilize a frame rate system in a 2d rpg.By the way i guess i should metion that the game im making is a 2d rpg written entirely in plain old fashioned C. If anyone has any ideas and/or advice on what to do here, please let me know. I appreciate the help. [edited by - ca_priest on May 5, 2002 11:21:27 PM] [edited by - ca_priest on May 5, 2002 11:57:49 PM]

Share this post


Link to post
Share on other sites
That is one way of doing it. The other way is to base all your movement on time. There is an article here which explains how to do this.

Basically you take the difference in time between the start of each frame. Then you break all time based functions down to milliseconds as well and figure out how far anything has moved.

Example:

speed = 40 pixels/second(0.04 pixels/millisecond)

frame 1 (start of game, nothing has moved yet)

frame 2
timediff=80 milliseconds
distance moved= 80 * 0.04 = 3.2pixels

frame 3
timediff=100 milliseconds
distance moved= 100 * 0.04 = 4.0pixels

etc....

Don''t forget that acceleration is affected differently. If acceleration was 1 pixel/s/s, then you have to convert both seconds to milliseconds by dividing by 1000 twice, or divide by 1,000,000. So that becomes .000001 pixels/ms/ms


---
Make it work.
Make it fast.

"Commmmpuuuuterrrr.." --Scotty Star Trek IV:The Voyage Home

Share this post


Link to post
Share on other sites
I dont know nething about this YET.. im still learning. seemed important so i gave it a boost to see if ne other ideas our out there to help this person find a solution!



Paul Donald
Techno Orgnaics
http://technoorganics.netfirms.com

-----------------------------
Im a Noob but i am willing to learn
-----------------------------

Share this post


Link to post
Share on other sites