General waits depending on game's framerate.

AndreWharn-Official

Indie Developer
Member
Joined
May 7, 2020
Messages
6
Reaction score
0
First Language
Italian
Primarily Uses
RMXP
So basically, I want to make an option in my game to select the game's framerate, and I found a way to make waits to automatically be the same for all the framerates (so the game will not actually speed up).
I did wait_count * framerate / (framerate / 2), and it actually works. But there's a problem: I searched on the interpreter and other scripts the definition of @wait_count, but there wasn't any, instead i've found things like "@wait_count = @parameters[0]", so I added on it my calculation but nothing actually happened, the game is still speed-up. So, am I doing something wrong? (also, how do I found and put my calculation on other waits like picture's or characters'?)

EDIT: Ok I noticed my calculation is wrong, any help with it? I'll explain better: I want to moltiplicate the waits depending of how high is the fps, so if for example the game waits 10 frames, i want it to keep the same speed for every framerates, so if for 40 fps 10 is normal, then with 80 it should be 20, and with 60 like.. 15 I think? (sorry I suck on math, lmao)
 
Last edited:

modulusia

So much to learn
Member
Joined
Feb 17, 2016
Messages
12
Reaction score
11
First Language
Indonesian
Primarily Uses
RMXP
Hello. First of all sorry if my explanation isn't clear.
If you want to multiply the duration of waits, you'll need to multiply them with the ratio of frame rate change. RMXP normal frame rate is 40. So 60 FPS would be 150% the normal rate, and 80 FPS 200%.

Say we're going with 60 FPS, the ratio of framerate change would be 60 / 40 = 1.5
So if you have 10 frames wait in 40 FPS, in 60 FPS you'll have 10 * 1.5 = 15 frames.

In case of @wait_count, I think it's fine to just do it like so: @parameters[0] * (framerate / 40).
 

Andrea87Sky

Just a random musician, eventer and spriter.
Veteran
Joined
Aug 30, 2017
Messages
119
Reaction score
1
First Language
Italian
Primarily Uses
RMXP
Hello. First of all sorry if my explanation isn't clear.
If you want to multiply the duration of waits, you'll need to multiply them with the ratio of frame rate change. RMXP normal frame rate is 40. So 60 FPS would be 150% the normal rate, and 80 FPS 200%.

Say we're going with 60 FPS, the ratio of framerate change would be 60 / 40 = 1.5
So if you have 10 frames wait in 40 FPS, in 60 FPS you'll have 10 * 1.5 = 15 frames.

In case of @wait_count, I think it's fine to just do it like so: @parameters[0] * (framerate / 40).
Thank you! It worked, though now when i set the game to an higher value than 40, the game just seem really laggy, if it's on 40 then it's fine. if instead i put a value lower than 40, it seems that everything related to duration and speed just breaks, like the move picture command.
Now, I don't really know why the first problem happens, maybe because my computer is sheetty or RPG Maker XP isn't just powerful or optimized enough to work at that framerate, if it's the second, that's a real shame then.

Can maybe someone try it on a new rpg maker xp project if someone has a powerful computer? Maybe it's just the thing that my computer sucks, but who knows.

EDIT: Oh by the way, I'm still AndreWharn. That account was meant to be my new one because i've lost the password of this, but then i found it and that account is now basically unused. So yeah, it's still me. Sorry for the confusion and for not telling it quickly, I just forgot that i've post this thread on that other account.
 
Last edited:

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
Perhaps you'll need to update all scripts that use 40 frames in its calculations..
 

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
281
Reaction score
106
First Language
English
Primarily Uses
RMXP
In case of @wait_count, I think it's fine to just do it like so: @parameters[0] * (framerate / 40).
You're doing integer division here. A framerate lower than 40 would result in 0. Have to make it 40.0 to get 1.5 as you expect. Or multiply framerate to the parameter first, then divide.
 

Andrea87Sky

Just a random musician, eventer and spriter.
Veteran
Joined
Aug 30, 2017
Messages
119
Reaction score
1
First Language
Italian
Primarily Uses
RMXP
You're doing integer division here. A framerate lower than 40 would result in 0. Have to make it 40.0 to get 1.5 as you expect. Or multiply framerate to the parameter first, then divide.
Makes sense, I actually thought about this and it seems I was right. But though... what is exactly the formula then? (Sorry I suck so much on math, it will be appreciate if you directly write it)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,090
Members
137,586
Latest member
Usagiis
Top