GMS 2 delta_time breakpoint problem...

Discussion in 'Programming' started by DarklinkFighter, Jan 11, 2019.

  1. DarklinkFighter

    DarklinkFighter Member

    Joined:
    Mar 25, 2018
    Posts:
    26
    Hi,

    I am currently creating a Cutscene System and when I test the game in debug mode the delta time calculation does not freeze while Custom Error Messages Show up or Breakpoints are triggered...
    This totally destroys my verification of the movement code while debugging :/

    Is there a way to get arround that?
    I implemented the delta time like that:
    Code:
    /// deltaTime.gml
    ///
    return delta_time / 1000000;
    Then I tried to debug if my Custcene System works while putting a breakpoint here:
    Code:
    /// obj_scene - CREATE EVENT
    ///
    rpgms_scene = [];
    rpgms_scene_playing = true;
    
    lastActionResult0 = noone;
    
    action_add(move, [obj_player.id, Direction.DOWN, 3 * 32, 3], true);
    action_add(move, [obj_player.id, Direction.RIGHT, 3 * 32, 3], true);
    
    /// obj_scene - STEP EVENT
    ///
    if (!rpgms_scene_playing) {
        return;
    }
    
    var actionCount = array_length_1d(rpgms_scene);
    for (var i = 0; i < actionCount; ++i) {
            var actionSettings = rpgms_scene[i]; // <<=== BREAKPOINT HERE
       
        var alreadyDone = actionSettings[4];
        if (alreadyDone) {
            continue;
        }
       
        var action = actionSettings[0];
        var actionParams = actionSettings[1];
        var waitForEnd = actionSettings[2];
        var actionProgress = actionSettings[3];
       
        // Execute Action
        var isDone = script_execute(action, actionParams, actionProgress);
        actionSettings[4] = isDone;
       
        // Check if the action wants that the following actions wait...
        if (!isDone && waitForEnd) {
            break;
        }
    }
    A breakpoint there + my verification time that all the values are correct + the array progress references update correctly will result in huge pixel movements or waiting time values...
    I thought that game maker will freeze the time for breakpoint mode?
     
  2. Smiechu

    Smiechu Member

    Joined:
    Jul 14, 2017
    Posts:
    609
    First of all you should add a threshold to your delta time implementetion becouse the "big jump" issue will occur by ton of other situations... potentially causing serious bugs.

    Simply add the clamp function and set the scope in which the dt should be held.
    It is reasonable to set the max value i.e. to approx 33ms (15fps). Top value depends if you have unlocked the game speed or not.
     
  3. DarklinkFighter

    DarklinkFighter Member

    Joined:
    Mar 25, 2018
    Posts:
    26
    Do you mean something like that?
    Code:
    var realDeltaTime = delta_time / 1000000;
    var fallBackDeltaTime = game_get_speed(gamespeed_microseconds) / 1000000;
    return (realDeltaTime < fallBackDeltaTime) ? realDeltaTime : fallBackDeltaTime;
     

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