Dynamic Time Warp Node for Buildbox 3
A downloadable asset pack
In this clip you can see many cubes (dynamic) being generated in the background and framerate dropping accordingly down to around 20 frames per second; thanks to the Dynamic Time Warp Node the simulation keeps the same speed even if framerate passed from around 60 at startup to around 20 near the end of the clip.
The two cubes in the foreground (kinematic) show the difference between normal Move and Rotate nodes you can find in Buildbox and updated ones making use of the Dynamic Time Warp node.
The red cube follows the normal behavior in a Buildbox game and it slows down noticeably when framerate drops while the green cube keeps moving and rotating at the same speed whatever the framerate is thanks to the Dynamic Time Warp node!
WHAT'S THIS NODE FOR?
In short it is a solution to slowdowns in Buildbox games, its purpose is to make games run at the same speed even when the framerate is low.
It works out of the box for physical (dynamic) objects & nodes and it can also easily work for non physical objects & nodes, for more on this keep reading 😊
It's independent from the OS used so it can fix slowdowns on iOS, Android and Windows as well.
Tested and fully compatible with latest Buildbox release: 3.4.8.
HOW TO USE IT
Just drag and drop DynamicTimeWarp.bbnode inside an object in Buildbox and enable it; since you just need one to be active you may, for example, place it inside your character and connect it to the Start node. That's all!
A SLIGHTLY LONGER EXPLANATION...
I was looking for quick ways to compensate for slowdowns in BB, for example when you have many physical objects on screen.
You might have noticed that in such situations the game slows down, this node is a solution to this problem.
This node adjusts time warp dynamically based on current fps; the final result is sort of what you'd get by skipping frames so the simulation keeps the intended speed and you won't notice slowdowns when this happens.
Your games will run at the same speed on every device!
At very low framerates (<20 FPS) you might get some stuttering/jerkiness but the game will keep running at the intended speed instead of slowing down!
WHAT ABOUT NON PHYSICAL OBJECTS?
When you use this node a Setting called Settings.currentTimeWarp gets created.
This is used to store current time warp value and is updated at each frame.
This value can be used to alter the speed of nodes like the Move node or the Rotate node; you can easily update every node which makes use of the dt value inside the update(dt) function, just like the Move and the Rotate nodes.
You just have to multiply dt by Settings.currentTimeWarp!
The attached demo BBDOC includes an example of this, inside the "Move Cube New" object you'll find two modified Move and Rotate nodes which makes use of this feature.
You can use Settings.currentTimeWarp even in nodes which doesn't use the dt value of course; implementation will vary depending on how the node works but generally speaking it is nothing too complex.
PACKAGE CONTENT
- DynamicTimeWarp.bbnode
The node itself, just drag and drop it inside an object in Buildbox, it needs to be enabled to work.
- Dynamic Time Warp Demo.bbdoc
A demo BBDOC (requires Buildbox 3.3.6+ to be opened).
- Screenshot & License
PERFORMANCE TEST
I've tested two demos made with Buildbox 3.3.6 and the the Dynamic Time Warp node inside the Buildbox Preview, on an iPhone 7 and on three Android devices, a brand new Xiaomi Mi 10 Lite 5G, a recent Xiaomi 9T and an old and almost dead Huawei P8 Lite 2017. These are the results.
CONCLUSIONS
FOR GAMES RUNNING CONSTANTLY AT ~60 FPS: no difference.
It makes no difference.
A BIG IMPROVEMENT FOR GAMES RUNNING AT 40~60 FPS
This often is the case in my experience, the Dynamic Time Warp node greatly improves the user experience because there are no more slowdowns; only minimal jerkyness is introduced at 40-45 fps and it is almost unperceivable anyway.
A GAME CHANGER FOR GAMES RUNNING AT 20~40 FPS
Buildbox games are usually almost unplayable with FPS between 20 and 40 because the game slows down too much, using the Dynamic Time Warp node makes them perfectly playable since it compensates for the slowdowns; this is true for both iOS and Android of course; using the DTW node introduces some unavoidable jerkyness in movement, especially at very low fps (15-20) but that's not very heavy above 20-25 fps.
A LITTLE IMPROVEMENT FOR GAMES RUNNING BELOW 20 FPS
It helps but can't do miracles, most games would be almost unplayable below 15-20 fps in any case.
Nonetheless using this node would mantain game speed constant and this can be very helpful in time based games or in games with little action where extreme responsiveness is not necessary like in many puzzle games for example.
DISCLAIMER
I've tried being very objective during these tests but of course the results are based on my own perception so your experience may vary; please test the node and share your experience, thank you!
CHANGELOG
1.0 (January 10, 2021)
First release.
1.1 (January 11, 2021)
Now the node creates and updates Settings.currentTimeWarp to be used gamewide. Updated demo BBDOC.
1.1 + Updated Demo (January 16, 2021)
Updated demo BBDOC, now the nodes used in the demo are updated versions using the Dynamic Time Warp node (Rotate, Move, Scale Animation, Timer).
License: (Creative Commons Zero, CC0)
http://creativecommons.org/publicdomain/zero/1.0/
This content is free to use in personal, educational and commercial projects.
Looking for a developer to help you with your Buildbox project? Hire me!
Status | Released |
Category | Assets |
Author | IndyM Software |
Code license | MIT License |
Asset license | Creative Commons Zero v1.0 Universal |
Download
Click download now to get access to the following files:
Leave a comment
Log in with itch.io to leave a comment.