Taming the box


One big issue when playing with time in a game is physics, especially with a non-deterministic engine like the current default in Unity. 


A 'simple' solution to playback would be to record the rigid body position and rotation data for all objects and just play them back. We can't do that in this game as the actions of each characters loop is allowed to change the environment from that experience by characters in earlier loops. 


Take the video above as an example - in the first loop the player controls the Barbarian and moves the box to the right.

Loop One - Barbarian moves the box

In the second loop the player controls the Rogue and stands them in the way - now the Barbarians actions, when played back, don't cause the box to move all the way, this is because we playback the Barbarians 'input' not their positions.

Loop 2 Rogue Blocks the box

For the third loop the player waits with the wizard and moves the box again with both of the other characters out of the way 4 seconds later.

Loop 3 Wizard finally moves the box 

Just playing back input however was resulting in cases where the same actions playing out - with not change in the environment - would not always result in the same outcome, which breaks the expectations of the player. 

For now our solution is to simplify the interactions with the box - moveables now live in their own Unity layer and a much simpler collider 'guide' geometry lives in another. The box then only interacts with the player, other boxes and the guides - ignoring all other level geometry.

The puzzle specific geometry for the box to move within

I've also made the angular drag so high the box basically won't rotate anymore. The current setup is far more stable than the old setup.

There are still glitches to be worked out - observe the wizard at the end of his loop fly off the map!

To fix that I think I need to switch from a simple character controller to something like the wonderful KCC instead - that's a job for another day though.

For now - please try breaking level 2 and letting me know in the comments.

 #gamedev, #indiedev, #madewithunity

Files

dungeon-loop-windows-x86.zip 155 MB
Version 0.0.1.16 Aug 09, 2021
dungeon-loop-webgl-universal.zip Play in browser
Version 0.0.1.16 Aug 09, 2021
dungeon-loop-windows-x64.zip 162 MB
Version 0.0.1.16 Aug 09, 2021

Get Loop Dungeon

Leave a comment

Log in with itch.io to leave a comment.