The Daily Click ::. Forums ::. Klik Coding Help ::. Can timescale code work with PMO?
 

Post Reply  Post Oekaki 
 

Posted By Message

JetpackLover



Registered
  01/03/2007
Points
  212
7th November, 2012 at 07/11/2012 09:25:05 -

Time scale code example "xpos * timescale" the timescale being based on actual time of computers clock.

This allows your game to run nicely at almost any frame rate. Instead of being slo-mo at 20 fps it will run the same but be a bit choppier. I know MMF2 has machine independent speed already but it isn't quite what I want.

Anyone know what I am talking about?

 
http://www.invincibletime.com/

Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/

Follow me on the twitters https://twitter.com/JetpackLover


Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
8th November, 2012 at 08/11/2012 02:55:16 -

I know what you mean. You have the game run at the maximum possible framerate, but make movements etc framerate independent. You have a variable, usually called "Delta Time" (the Greek delta symbol representing "change in..."), which is the elapsed time since the last frame, and you use that in calculations.

eg. XPosition = XPosition + (5 * DeltaTime)
(where "5" is the speed, measured in pixels per millisecond)

If the game runs at 100fps, DeltaTime = 100s/100fps = 1; meaning the object moves 1 * 5 = 5 pixels.
If the game slows to 50fps, DeltaTime = 100s/50fps = 2; meaning the object moves twice as far, but will have taken twice as long to do so.

I'm not an expert in the PMO (really don't see the point in it), but my gut feeling is that it probably won't help you in this case.
If you consider an object's vertical position while falling, it's not linear - the velocity increases by <gravity> each frame. You'd have to figure out yourself how much the object should accelerate and move in the elapsed time, and then set the gravity variable in the PMO to that value, which pretty much defeats the purpose - you're basically building a custom platform engine just to calculate the variables that you plug into the PMO.

Fanotherpg was working on some kind of framerate independent platform engine here:
http://www.create-games.com/download.asp?id=8672

 
n/a

JetpackLover



Registered
  01/03/2007
Points
  212
8th November, 2012 at 08/11/2012 04:31:24 -

That is exactly what I thought. It's possible to do the x position but it all breaks down when you try and do the y position.

As for PMO I agree. I really should move on to a fast loop, float based platform engine.

Know of any good ones?

Ones with
Max X
Max Y
X vel
Y vel
Gravity
accel
decel


I've done DavidN's tutorial for fast loop custom engine. Are there anymore like that? Preferably ones that are complete. I'd like to just see how its all pieced together before I dive into making my own.

Also thanks for answering my question Sketchy. You are always so helpful!

 
http://www.invincibletime.com/

Devlog for HD MMF Game Omulus. Check it out because it's gonna be awesome. http://omulus.tumblr.com/

Follow me on the twitters https://twitter.com/JetpackLover

   

Post Reply



 



Advertisement

Worth A Click