1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

GM:S 1.4 Gradually speeding up the game with room_speed?

Discussion in 'Programming' started by Calvert, Oct 22, 2019.

  1. Calvert

    Calvert Member

    Joined:
    Dec 24, 2017
    Posts:
    133
    I believe I have an interesting problem on my hands. I have a project with a room speed set to 30 upon starting the game. When certain objects are destroyed in-game, the room speed should speed up by a few units.

    Upon the object destroy event, I have:

    Code:
    room_speed += 4
    
    When testing the project, I witness several objects be destroyed over a duration of 10 to 20 minutes. I notice no speed changes in the game. I have the room speed drawn in-game, and when it reaches 100, it seems to play as fast as it was with the room speed of 30.

    When using the same code but changing the [+= 4] to a [+= 30], I notice the game speeds up drastically, and it seems to work fine. When it reaches 90, the game plays much faster than what the first attempt was when it was at 100.

    Of course, this is what I have noticed after about an hour of working with this. I'd really like to find a way to gradually speed up the game.

    Thoughts?
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    7,033
    When it reaches 100 or when it reaches 102? You should never have a room_speed of 100.

    Messing with room_speed isn't a good way to speed up the game, since it's machine-dependent. The user's machine could cap out at 60 for all you know. And if your game has any significant amount of slowdown, that higher room_speed will amount to nothing.

    Using delta-time would be the better way to go here.
    Code:
    speed = spd * delta_time/ideal_delta_time;
    https://csanyk.com/2018/08/gamemaker-tutorial-delta-time/
     
    Calvert likes this.
  3. Calvert

    Calvert Member

    Joined:
    Dec 24, 2017
    Posts:
    133
    Thank you, I will try this when I get home. I don't understand how I will implement the code though, even with the example you provided, so I will need to study that link.

    I forgot to mention I had other objects that were boosting the room speed by [5] and [6] upon being destroyed as well, so the room speed actually was at 100.
     
  4. samspade

    samspade Member

    Joined:
    Feb 26, 2017
    Posts:
    2,082

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice