• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Game Speed question

N

Novithian

Guest
So I understand that we no longer set the room_speed individually, but using game_set_speed now. The documentation says that game_set_speed requires only 1 argument, the speed you're wanting to set. BUT the editor is asking for 2 arguments, which obviously the documentation for game_set_speed doesn't explain. I'm just wondering what is this second argument "type".


 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Yep, that doc will be updated in the next update. Changes were made and I didn't have time to squeeze that one in for the initial Beta build.

To quote the soon-to-be-updated docs:

This function can be used to set the game speed. You can set this in one of two ways - as either game frames per second (FPS) or as microseconds per game frame (MPF) - using one of the following two constants:

gamespeed_fps - Sets the games peed using frames per second.

gamespeed_microseconds - Sets the game speed using microseconds per frame.

So, for example, a game speed of 30 frames per second would be 33333 microseconds per game game frame
For example:

Code:
game_set_speed(60, gamespeed_fps);
Hope that helps!
 
Y

Yazuka

Guest
Hey there,

The functions are expecting either gamespeed_fps or gamespeed_microseconds as their secondary arguments.

We'll look into getting this fixed in the manual.
 
L

Ludorverr

Guest
Does game speed behave differently than room_speed?

Curious that the default setting is still 30 considering the traps new developers have fallen into, like hard-coding their entire game around 30 (because it's the default value) and being stuck with it. Hyper Light Drifter comes to mind.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Game speed is essentially the same as room speed, only it is global and not on a per-room basis. As for it being at 30, that's simply because GM users are accustomed to it being at 30 and for increased compatibility with 1.4 projects.
 
D

Drewster

Guest
Yep, that doc will be updated in the next update. Changes were made and I didn't have time to squeeze that one in for the initial Beta build.

To quote the soon-to-be-updated docs:



For example:

Code:
game_set_speed(60, gamespeed_fps);
Hope that helps!
Obviously not something that matters that much, but why have two ways to set it -- which are some simple math apart from each other? .. just curious.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Obviously not something that matters that much, but why have two ways to set it -- which are some simple math apart from each other? .. just curious.
Okay, so GMS2 has a better image editor and vastly improved visual scripting (DnD), and we are expecting to attract more people to the program from different fields and tools... and some of those people will be used to working in frames per second, and others will be used to working in frames per game tick. So, this simply is a convenience to help make transitioning from other tools and backgrounds into GMS easier. :)
 

hdarren

Member
Okay, so GMS2 has a better image editor and vastly improved visual scripting (DnD), and we are expecting to attract more people to the program from different fields and tools... and some of those people will be used to working in frames per second, and others will be used to working in frames per game tick. So, this simply is a convenience to help make transitioning from other tools and backgrounds into GMS easier. :)
What is the difference? Does this mean for example that if you use the micro-seconds method then you can allow players to set their own game speed without it affecting animations/alarms/etc?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
There is no difference. BOTH will set the speed that the game tries to maintain. If you use 30 FPS, then the game will try to maintain a speed of 30 frames per second. If you set 33333 MPF (microseconds per frame), then the game will try to maintain each frame at 33333 microseconds. The end result is the same... it's exactly the same as setting the room speed previously, only now it affects the whole game and not just individual rooms.
 

hdarren

Member
If they are the same then that seems like pointless clutter to me. I imagine the majority of people will use seconds because that's what GM has always used so why change it by adding a pointless extra arguement? Why can't people just get used to using how GM does it or write 30*1000 or just add game_set_speed_micro()? Why make it more cluttersome for the vast majority because the minority are lazy? Especially beause this means everybody will have to change that function now when importing an old project.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
If they are the same then that seems like pointless clutter to me. I imagine the majority of people will use seconds because that's what GM has always used so why change it by adding a pointless extra arguement? Why can't people just get used to using how GM does it or write 30*1000 or just add game_set_speed_micro()? Why make it more cluttersome for the vast majority because the minority are lazy? Especially beause this means everybody will have to change that function now when importing an old project.
Laziness has nothing to do with it. It's about previous knowledge and habit. We want to (and CAN) accomodate the two different methods so why not? Also, "everybody will have to change that function"??? What function? it's new in GMS2 so nobody has to change anything and just use it as they wish with the option that suits them best. :)
 

Baku

Member
As for it being at 30, that's simply because GM users are accustomed to it being at 30
Accustomed? Sure. Also fairly annoyed.

It'd be awesome if there at least was a setting in the Preferences, where we could set the default game speed for future projects. Even if it started at 30, it'd only require a one-time change by me to have all my future things default to 60, compared to having to go in and set every project to 60 manually like I do now. And those who are content with making unresponsive games would be able to go on with their lives like nothing ever happened.

Going through the entire Preferences the other day, and seeing the insane amounts of things we can fiddle with now, I had honestly expected to find something like that, but nope


Well damn, scratch that. The default options of new projects seem to be copied over from a "base" project in C:\ProgramData\GameMakerStudio2\Cache\runtimes\runtime-2.0.1.16\BaseProject, and it seems we can simply change this project to our liking (such as setting it to 60fps) and all new ones will inherit the changes :D:D:D
 
Last edited:
D

Drewster

Guest
Okay, so GMS2 has a better image editor and vastly improved visual scripting (DnD), and we are expecting to attract more people to the program from different fields and tools... and some of those people will be used to working in frames per second, and others will be used to working in frames per game tick. So, this simply is a convenience to help make transitioning from other tools and backgrounds into GMS easier. :)
Lol okay. :) I guess that's a good answer.
 
D

Drewster

Guest
Does game speed behave differently than room_speed?

Curious that the default setting is still 30 considering the traps new developers have fallen into, like hard-coding their entire game around 30 (because it's the default value) and being stuck with it. Hyper Light Drifter comes to mind.
Yikes! hard-coding your whole game around a fixed value sounds like..... not best practice? Bummer that.
 
O

Oranjoose

Guest
Laziness has nothing to do with it. It's about previous knowledge and habit. We want to (and CAN) accomodate the two different methods so why not? Also, "everybody will have to change that function"??? What function? it's new in GMS2 so nobody has to change anything and just use it as they wish with the option that suits them best. :)
Actually, @hdarren is correct here. It is a basic principle of UI/UX design that it is more usable when the thing behaves as the user expects it to.

In this case, if you show a developer the game_set_speed function, whether they are the seconds or microseconds type, they will figure it out very quickly if it takes one argument (say, in seconds). With that required second argument using global names as flags, it is virtually impossible for anyone to figure out how to use the function without seeing some kind of documentation.

This is just one reason that it is actually more usable and "accommodat[ing]" for either type of user.

To prevent breaking changes, I recommend making the second argument of game_set_speed optional, where the default is in seconds. This is the best of both worlds.
 
U

User1331

Guest
Yep, that doc will be updated in the next update. Changes were made and I didn't have time to squeeze that one in for the initial Beta build.

To quote the soon-to-be-updated docs:



For example:

Code:
game_set_speed(60, gamespeed_fps);
Hope that helps!

This function doesn't seem to work by me, maybe I'm doing something wrong

I have this in the step event:

var g_speed = 0
if keyboard_key_press(vk_up) then g_speed = 0
if keyboard_key_press(vk_down) then g_speed = 1





if g_speed = 0 then game_set_speed(30,gamespeed_fps)
if g_speed = 1 then game_set_speed(10,gamespeed_fps)


And It changes absolutely nothing.
 

Dog Slobber

Member
This function doesn't seem to work by me, maybe I'm doing something wrong

I have this in the step event:

var g_speed = 0
if keyboard_key_press(vk_up) then g_speed = 0
if keyboard_key_press(vk_down) then g_speed = 1





if g_speed = 0 then game_set_speed(30,gamespeed_fps)
if g_speed = 1 then game_set_speed(10,gamespeed_fps)


And It changes absolutely nothing.
It's a bug in your code.

Every step you're resetting it back to 30 because the default for var g_speed (no key being pressed) is the same as when vk_up is presed.
 
Top