# GameMaker: Studio - Slow down calculations

I currently have an orbital simulator, with a brilliant answer in another Game Development question here, and would like to know how to slow down the calculations of Game Maker, to be able to do more precise ones as my orbits suffer variably intense Apsidal Precession.

Examples of this can be found in games such as Kerbal Space Program and
Universe Sandbox 1/2. In KSP, you have the Max Physics Delta Time which allows slower gameplay, but more calculations. In Universe Sandbox you are able to change the accuracy of calculations causing orbits to go crazy and extremely precise.

How am I able to implement such a thing into GameMaker: Studio?

You can implement a global variable that flips between each mode.

You can reduce the amount of frames that are being rendered per second.

So for example, for a manager object you can have this code in the create event:

//Slow mode
if(global.gameplayMode == 0)
{
room_speed = 30;
}
//Fast mode
else if(global.gameplayMode == 1)
{
room_speed = 60;
}


And for calculations

some_stuff = irandom(9001);
if(global.gameplayMode == 0)
{
moreCalculations();
}


EDIT

//Declare the variable
global.worldPace;

//If you'd like the game to run at half speed then set it to 0.5
global.worldPace = 0.5;

//But if you'd like the game to run at regular speed then just set this to 1
global.worldPace = 1;


And for all of the calculations, just multiply everything by this variable so for example

runningSpeed = 9.8 * global.worldPace;


I've never fiddled with this idea but this is where I'd start. I'd consider the amount you have to add for geometric functions. You'll have to make sure that whatever value you add, you distribute in the exact same manner when slowed down.

A good example and simple example would be as follows:

If over one frame you move a bullet 2 pixels to the left, with this slow-mo mode you'd now have to split this simple action into two, which means that the action of bullet moving would span over two frames, and in each frame the bullet would only move 1 pixel.

I'd imagine this would be harder to nail down with more complicated functions, so be careful with how you approach them.

• I don't think you understand, I'm looking to slow down the calculations ONLY, not the room_speed which is my framerate. – user59493 Oct 16 '15 at 6:21
• @FinnRayment What does "slowing down the calculations" mean? By slowing the FPS down, you're giving the machine more time to work on calculations than rendering things on screen which in theory would be slower but more accruate like you asked. Unless you're talking about the game running in a slow-mo mode...? – Omrii Oct 16 '15 at 8:26
• Yes! The latter. Slow motion mode, where your FPS is constant, but game is slowed down for calculation time. – user59493 Oct 17 '15 at 10:11
• @FinnRayment I'd just make on global variable that determines the time and multiple it by all of the calculations/variables in the game. I've edited my post above to express what I mean. – Omrii Oct 18 '15 at 12:28
{"ft_lang_label":"__label__en","ft_lang_prob":0.90271956,"math_prob":0.93669546,"size":1489,"snap":"2021-04-2021-17","text_gpt3_token_len":364,"char_repetition_ratio":0.11178451,"word_repetition_ratio":0.023346303,"special_character_ratio":0.24580255,"punctuation_ratio":0.11564626,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9639715,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-01-21T21:28:38Z\",\"WARC-Record-ID\":\"<urn:uuid:f3ec78bb-4a1b-4440-878e-f8f73567e16c>\",\"Content-Length\":\"152443\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:032c2a0d-bb74-425f-9c06-c90470d0eba3>\",\"WARC-Concurrent-To\":\"<urn:uuid:e2357b06-6a36-4112-b99b-152d5947cbd0>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://gamedev.stackexchange.com/questions/106688/gamemaker-studio-slow-down-calculations\",\"WARC-Payload-Digest\":\"sha1:G36O2YU7OO7LW3NSKVS4DKYQLWNLZVQU\",\"WARC-Block-Digest\":\"sha1:CK7BZPWN25W6GLMB32UXBZHRBMBP7HLK\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-04/CC-MAIN-2021-04_segments_1610703527850.55_warc_CC-MAIN-20210121194330-20210121224330-00099.warc.gz\"}"}