YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
26 stars 8 forks source link

In-Game: game_set_speed() needs to catch and prevent setting a gamespeed_fps of 0 #7816

Open attic-stuff opened 2 months ago

attic-stuff commented 2 months ago

Description

if you [accidentally get the arguments for game_set_speed() the wrong way around], it sets gamespeed to 0 but runs the game at plaid.

Expected Change

it shouldn't do that >:[

Steps To Reproduce

  1. Start GameMaker
  2. Import moveandbreak-Dan.zip
  3. Run it (e.g., Windows VM)
  4. Observe the game is very happy to set itself to gamespeed 0 and so fps_real gets unlocked

How reliably can you recreate this issue using your steps above?

Always

Which version of GameMaker are you reporting this issue for?

2024.8.1 (Monthly)

Which platform(s) are you seeing the problem on?

Windows

Sample Package Attached?

Sample Project Added?

YYDan commented 2 months ago

Not sure why this is happening yet, but simply "moving a borderless window causes it to go to 0" is not true even in your sample project. If you comment out the two lines in your Step event which change the gamespeed, then no bug occurs.

YYDan commented 2 months ago

Okay, so it's nothing to do with borderless either ;)

This is very simply that your two calls to game_set_speed() have the two arguments the wrong way around and so this gives you 0 each time - e.g, you have game_set_speed(gamespeed_fps, 60); instead of game_set_speed(60, gamespeed_fps);.

We should change the function to not allow setting a gamespeed_fps that equals 0 (or any negative number, etc.). Probably with at least a debug message that this was disallowed, if not a full code error.

YYDan commented 2 months ago

Edited the report now

YYDan commented 2 months ago

Okay, so negative numbers are already caught and a code error shown: image

So this is just to determine if 0 should be allowed still or made into a code error this same way.

attic-stuff commented 2 months ago

lol good catch!

BrittleLizard commented 1 month ago

We should change the function to not allow setting a gamespeed_fps that equals 0 (or any negative number, etc.). Probably with at least a debug message that this was disallowed, if not a full code error.

I'd like to just see a debug message rather than a full crash, if only because there is still expected behavior when setting the game speed to 0. Technically, it does have use cases, i.e. a "meta" game that freezes until the player manually restarts it.

attic-stuff commented 1 month ago

it does have use cases, i.e. a "meta" game that freezes until the player manually restarts it.

this will also tell operating systems that the process has froze and then close the program, which is a good way to have people thinkin your game is broken or unsafe. heads up!