# Converting Miliseconds to Frames

4 replies to this topic

### #1 XD005

XD005

Daxter (For PSP) Fan

• New Member
• 1257 posts

Posted 23 July 2010 - 04:06 AM

Hello. I need to write a program that will generate data for a old 90s app that I want to reverse engineer. The thing is, the app reads things in frames. How can I convert millisecond values to frames? I need it to give what frame it is on 1-30 and the second and also be able to read the data and convert it miliseconds. So in other words, in the program everything stays miliseconds but when writing a file, the time format is converted to which second and which frame in the second it is and is written. The opposite is done when loading a file.

I'm sorry of this is confusing it's kinda like this:
0 seconds - 30 frames
1 second - 30 frames

Every 30 frames is also the equivalent to a second.
• 0

### #2 NinjaBril

NinjaBril

Many games, little time

• GMC Member
• 2332 posts
• Version:Unknown

Posted 23 July 2010 - 04:23 AM

I am having an extremely hard time understanding your problem, but I am going to try and help you understand from what I could comprehend. It is my understanding that you want a simple number, variable, equation or something from GM that is equivalent to 1 milisecond no? Well if that is the case, .001 is a milisecond converted into a second, divide that by two and you have a milli second of a GM frame correct? 30 Frames Per Second = 1 Second .0005 = Frames per Milisecond

You could also change the room speed to 60, but not exactly sure how that will effect game speed.

Lol, I hope this helped.
• 0

### #3 XD005

XD005

Daxter (For PSP) Fan

• New Member
• 1257 posts

Posted 23 July 2010 - 04:30 AM

I am having an extremely hard time understanding your problem, but I am going to try and help you understand from what I could comprehend. It is my understanding that you want a simple number, variable, equation or something from GM that is equivalent to 1 milisecond no? Well if that is the case, .001 is a milisecond converted into a second, divide that by two and you have a milli second of a GM frame correct? 30 Frames Per Second = 1 Second .0005 = Frames per Milisecond

You could also change the room speed to 60, but not exactly sure how that will effect game speed.

Lol, I hope this helped.

I don't understand what you wrote. Basically, I need a equation to find out how many miliseconds are in a certain frame value like 3923 or whatever. I also need one to do the opposite find out how many frames there are in a milisecond value, essentially converting it to frames.

Then when I write them, I need them to be written like this... If you don't get that part dont worry about it.

EDIT:
Oh wait I think I got it. 1000/room_speed right?

Edited by XD005, 23 July 2010 - 04:38 AM.

• 0

### #4 Kaeru

Kaeru

GMC Member

• New Member
• 675 posts

Posted 23 July 2010 - 08:14 AM

it's a simple factor, besides it is an irreal value. at 30 FpS, the number of milliseconds per frame is 33.3_
since you cannot save this number precisely within any variable, use the fraction (100/3) in your calculations to provide maximum possible precision.
• 0

### #5 NinjaBril

NinjaBril

Many games, little time

• GMC Member
• 2332 posts
• Version:Unknown

Posted 23 July 2010 - 11:39 AM

I am having an extremely hard time understanding your problem, but I am going to try and help you understand from what I could comprehend. It is my understanding that you want a simple number, variable, equation or something from GM that is equivalent to 1 milisecond no? Well if that is the case, .001 is a milisecond converted into a second, divide that by two and you have a milli second of a GM frame correct? 30 Frames Per Second = 1 Second .0005 = Frames per Milisecond

You could also change the room speed to 60, but not exactly sure how that will effect game speed.

Lol, I hope this helped.

I don't understand what you wrote. Basically, I need a equation to find out how many miliseconds are in a certain frame value like 3923 or whatever. I also need one to do the opposite find out how many frames there are in a milisecond value, essentially converting it to frames.

Then when I write them, I need them to be written like this... If you don't get that part dont worry about it.

EDIT:
Oh wait I think I got it. 1000/room_speed right?

.0005 is a milisecond of 30 frames per second, if you were to do an alarm event and set it to .0005, it will activate in a milisecond.
```alarm[0]=.0005
//Equals one milisecond if room_speed=30```

.001 is two miliseconds, .0015 is three miliseconds .002 is four milisecond and so on and so fourth.

if you are looking to create a timer that adds by the milisecond
```var timer;
var start;
var second;
milisec=.0005
if start = 1 && timer < 30
{
timer+=milisec
}
if time=30
{
second+=1
timer=0
}```

but if you are planning to change the room speed often or what ever but don't want changing the code to be a burden you can do,

```var timer;
var start;
var second;
milisec=(1/1000)/(60/room_speed)
if start = 1 && timer < room_speed
{
timer+=milisec
}
if timer=room_speed
{
second+=1
timer=0
}```

I still am having trouble comprehending your question, don't know why, haha but I feel this info could help you out.

EDIT: & you must excuse me if I made any mistakes. For I am ".0005"'s from going to sleep haha, and I don't feel like checking for errors.

(Miliseconds from sleep for those who didn't catch on )

Edited by Senar, 23 July 2010 - 11:42 AM.

• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users