Jump to content


Photo

Limit Room Speed, But Not Fps.


  • Please log in to reply
5 replies to this topic

#1 csscom

csscom

    GMC Member

  • New Member
  • 74 posts

Posted 22 December 2008 - 12:48 PM

I would like my character no matter what, every 1 second move 16 pixels.
regardless of the fps.

user 1's computer could do 120 fps it would be very smooth.
user 2's computer could do 20 fps it would be very choppy.

but if user 1 and user 2 were to race they would tie, regardless of fps.
meaning because player 2 has low fps hes game doesn't slow down hes just has choppy game play.

no I'm not making a racing game. I don't want to limit the fps.
I want to have as many fps as possible but I want the movements in game to be the same speed.
  • 0

#2 Nehacoo

Nehacoo

    GMC Member

  • New Member
  • 180 posts
  • Version:GM8.1

Posted 22 December 2008 - 01:37 PM

What you're after is called delta time. Unfortunately there is no good way to do it with Game Maker's inbuilt functions, but there is a DLL. Search for Yourself's High resolution timer DLL, it's perfect for this.

Edited by Nehacoo, 22 December 2008 - 01:37 PM.

  • 0

#3 paperofme

paperofme

    GMC Member

  • New Member
  • 66 posts

Posted 22 December 2008 - 06:42 PM

or you can do it this simple way
//dividing with 0 crashes the game
if fps=0 exit;
//the max speed is 240 a 1 fps or 8 at 30 fps
speed=240/fps
if keyboard_check(vk_left) direction+=120/fps

get what i mean?
  • 0

#4 Nehacoo

Nehacoo

    GMC Member

  • New Member
  • 180 posts
  • Version:GM8.1

Posted 22 December 2008 - 07:09 PM

The fps variable only updates once a second, so that doesn't works very well. Besides, Yourself's timer DLL is much more accurate.
  • 0

#5 Potnop

Potnop

    GMC Member

  • GMC Member
  • 3101 posts

Posted 22 December 2008 - 08:38 PM

Well I have a platform game engine using delta time... It uses Yourself's timing dll.

Delta Time Platform Engine

It has a bunch of stuff to control the timing of the game and animations and stuff... Basically I take control away from Game Maker when it comes to running the step events for the game objects and have the main game controller do it. It runs fractions of a game tick per step if running fast enough, and if it's running below the ideal FPS it runs additional game ticks per step. I don't want it to just skip those game ticks since it's much harder to detect collisions if the object needs to move a large enough distance.

I'm working on a newer version with fixed glitches and a small element of physics for items laying on the ground getting blown away by a rocket launcher. That's almost done...

If you're making a top down shooter or something instead of a platform game you can still use this since it has the basic delta time controls if my way is the way you want to do it. It's a little more like frame skipping but it has the exact effect that you're looking for.

Edited by Potnop, 22 December 2008 - 08:42 PM.

  • 0

#6 csscom

csscom

    GMC Member

  • New Member
  • 74 posts

Posted 23 December 2008 - 04:50 AM

Well I have a platform game engine using delta time... It uses Yourself's timing dll.

Delta Time Platform Engine

It has a bunch of stuff to control the timing of the game and animations and stuff... Basically I take control away from Game Maker when it comes to running the step events for the game objects and have the main game controller do it. It runs fractions of a game tick per step if running fast enough, and if it's running below the ideal FPS it runs additional game ticks per step. I don't want it to just skip those game ticks since it's much harder to detect collisions if the object needs to move a large enough distance.

I'm working on a newer version with fixed glitches and a small element of physics for items laying on the ground getting blown away by a rocket launcher. That's almost done...

If you're making a top down shooter or something instead of a platform game you can still use this since it has the basic delta time controls if my way is the way you want to do it. It's a little more like frame skipping but it has the exact effect that you're looking for.


download link is broken in link
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users