Asset - Project TMC Delta-T Engine

icuurd12b42

TMC Founder
GMC Elder


TMC Delta-T Engine


Outputs: All

Type: Template/Starter Project

Included: Scripts, Example Sprites, Example Objects and Demo Room

Demo: https://onedrive.liv...45D1EA9168D!747

Marketplace: https://marketplace....-delta-t-engine

Flickering Fix For Newer Studio Versions: https://forum.yoyogames.com/index.php?threads/tmc-delta-t-engine.46/#post-65507

Description:

This Project is a Startup for Delta Time programming so your game run as efficiently as possible with little to no lag.

Includes Scripts to mirror GM:Studio motion and speed system
Sample Objects that move at speed, with friction, with gravity or both
Sample space ship and bullets that use Delta_t motion
Frame Skipper/Drawing management to bypass GM Studio's room_speed system

40000+ instances under YYC, no lag.
13000+ instance under Normal windows output. 25-30 fps

I have chosen to record the non YYC output in order to demonstrate the delta_t system which is a motion based on elapsed time since the last frame.

The system takes over the room_speed and disables the drawing up to until the point where a frame needs rendering.

You will note the room_speed is set to 9999 so pay attention to the fps real and the number of instances.

The system can maintain a high frame rate and a very high step rate which is essentially now disassociated from the draw cycle which means that under normal circumstances your instances are moving by very small distance but at a very high step rate situation. Up to the point where the draw rate starts to lag at which point the delta_t motion system starts to shine through.

You can have a smooth running game down to about 30 fps though the video here I brought the system down to 20 fps which was impossible to do under YYC.

Youtube


Screen Shots:





 
Last edited:
A

Aeson

Guest
Hi iccurd

I've moved over to using your Delta T Engine and it seems really great!

One issue I'm having however, is that it doesn't seem to be drawing smoothly for me.

When I was initially just running at 60 fps without any frame rate independence the game was so smooth and looked great.
Now that I've switched over to using the engine it seems to stutter when drawing.
It doesn't seem to be drawing at the desired fps or perhaps it's the motion of the sprites that's stuttering.

I have tried setting the EngineFPS to 65,70,80 etc. while keeping the DrawFPS at 60 but the issue remains the same.

One thing that seems to improve it a bit is if I set the EngineFPS below the DrawFPS.
So 55 EngineFPS and 60 DrawFPS seems to be much smoother, however it's still not as smooth as it should be.

I'm sure it's just something I'm doing wrong anyway so I'd greatly appreciate your help resolving this.

Thanks!
 

icuurd12b42

TMC Founder
GMC Elder
Maybe there is interference with the V synch? I never had problems. you can pm me you project I can take a look
 

icuurd12b42

TMC Founder
GMC Elder
the fluctuation is due to a change in the core yoyo engine.

There appears to be an edge case now where it skips a beat at the edge case when the time is right before a need for a draw.

And so it does not draw until the next step... and then the time goes by, it's time for another draw, but, this time, it's right on time, in synch with what is expected.

Long story short, every n frames you get a frame out of synch

in controller 2, begin step, change
Code:
if(total_t_draw>=next_draw_t)
{
    next_draw_t = total_t_draw+1000000/DrawFPS;
}
to
Code:
if(total_t_draw>=next_draw_t)
{
    next_draw_t = total_t_draw+1000000/DrawFPS-dt-dt-dt;
}
in the controller

here is the entire begin step for the controller2 object. I also re-instituted my own delta time check replacing yoyo's delta_time variable
Code:
//some real time based variables
//re-instituted my delta time
var t= get_timer();
var dt = t-global.tmc_dt_time;
//old vorsion that was changed when yoyo added delta_time varime
//var t = delta_time;
//var dt = t;
global.tmc_dt_time = t;

global.delta_t = dt * (global.Paused==false);
global.total_t += global.delta_t;
global.delta_t /= 1000000;
global.tmc_dt_delta_t  =global.delta_t;
total_t_draw+=dt;
draw_enable_drawevent(total_t_draw>=next_draw_t || room_started)

if(total_t_draw>=next_draw_t)
{
    next_draw_t = total_t_draw+1000000/DrawFPS-dt-dt-dt;
}

room_started = false;
 
Last edited:
A

Aeson

Guest
Thanks so much!

Worked perfectly, everything is running great now :)
 

icuurd12b42

TMC Founder
GMC Elder
Posts from the old forum
-
something to consider modifying the gravity code
http://www.niksula.h...es/gravity.html
-
How to use

1) Drop tmc_dt_DeltaTController2_obj or a copy of it (safer to prevent updates from changing your setting) in the room you want deltat_t enabled... If you want to change the settings, go in the create event.
These 2 control the engine frame rate (room_speed) and the engine draw rate (fps)
EngineFPS = 60; //running speed
DrawFPS = 45; //drawing speed, 45 for android
If you want the DrawFPS to be 60, I recommend you set the EngineFPS a little higher

2) In the instance you want to have Delta_T support, add tmc_dt_instance_init() in your create

3) In the instance you want to have Delta_T support, In the step event call tmc_dt_instance_step_s() or any of its variant to handle the movement

4) you cannot use the game maker speed variables. use the tmc_dt_motion_set() or tmc_dt_set_speed() functions there are a few so get familiar with them

5) ultimately you can change the variables defined in tmc_dt_instance_init() yourself

6) All speeds are in pixels per seconds... to convert your existing per step speed simply use the value you have now and multiply it by global.desired_fps

Code:
//speed = 8
tmc_dt_set_speed(8*global.desired_fps)
addn
dampening code like
Code:
val *= .9
becomes
Code:
var dtfact = 60*global.tmc_dt_delta_t;
val*=power(.9,dtfact);
dampening code like
Code:
val /= 10
becomes
Code:
var dtfact = 60*global.tmc_dt_delta_t;
val*=power(1/10,dtfact);
[/CODE]
where 60 is the room_speed you initially designed the room to be and .9 and 10 are the values that worked at that room speed.

alarms should be replaced with your own step code
create
Code:
//alarm[0] = 60;
alarm0 = 60;
step
Code:
var dtfact = 60*global.tmc_dt_delta_t;
if(alarm0>0)
{
   alarm0-= 1*dtfact;
   if(alarm0<=0)
   {
       //trigger. you could event_perform the alarm0 here and leave that code where is was of move it here
   }
}
ultimately you can simply convert to your alarms to be time based
create
Code:
alarm0_trigger = global.total_t + 60 * 1000000;
step
if(alarm0_trigger!=-1)
{
   if(global.total_t>=alarm0_trigger)
   {
       alarm0_trigger = -1; //disable
       //trigger here
   }
}
path_position and image_index can also be manually handled. setting the speed to 0 for either and manually changing the value
create
Code:
//image_speed = 5;
//path_speed = 2;
img_spd = 1;
pth_spd = 2/path_get_length(path);
step
var dtfact = 60*global.tmc_dt_delta_t;
image_index+=img_spd * dtfact;
path_position += pth_spd * dtfact;
//stop
//path_position = clamp(0,1,path_position);
//loop
//if(path_position>1) path_position-=1;
//loop reverse
//if(path_position<0) path_position+=1;
//reverse
//if(path_position>1) pth_spd *=-1;
//reverse while reversed
//if(path_position<0) pth_spd *=-1;
-
 
Top