A History Lesson


Hey there!

After showing this to a couple coworkers, the one thing they all intuitively tried to do was crank backwards to check again the face that had just shown up. Every single time, it was a disapointment when I had to tell them "sorry but I don't even know how to do that".

So I decided to figure out how to implement a history feature. In hindsight it wasn't that complicated, but boy did it take me a while to figure it out.

Saving Tables on Tables

For this implementation, I have gone at it by dividing it into smaller tasks. 

The first one was to save the randomized elements on a table, which I did for the debug UI I talked about earlier.
This part was not really that challenging, since all I needed was to make one table and then just add each randomized element in order.

Secondly, I made it so I could insert that table on another table (the history table). This part was fairly straightforward at first, but then I needed to start pushing old history values out of the table to make room for the newer values. Code-wise it is very simple, but it required some knowledge that I didn't even have from my visual-scripting experience.

Thirdly, after having a table holding the different values that make up the history backup, I had to figure out how to tell at which point through history I was in order to assign the correct values to each random element if anywhere within the history table, or new random values if at the latest in the history table). This part took me nearly two hours to wrap my head around.

The current system holds 20 positions (number choosen arbitrarily, no specific reason for it), so once it reaches position 20 it pushes the older values out and shifts the history back. It's a bit hard to keep track of the system on this .gif, though.

Leave a comment

Log in with itch.io to leave a comment.