Posted March 19, 2022 by therealcowboyhatman
2. Rewind Woes - Time Travel Prototype by therealcowboyhatman (itch.io)I last worked on this project on the weekend of the fifth of March. I started off with a quick win on Saturday morning before falling into a pit of despair at around 1500, but I came out on top by 1600 on Sunday. I went to London for a long weekend with my gf on the Thursday, which is why I have neither written an entry for that session yet nor worked on this project since then.
That ends today.
Recap
At the end of the previous post, I listed the below bullet points as things I next wanted to achieve.
I am delighted to announce that I achieved all of them.
The End
jk
The Pit of Despair
Implementing the rewind-on-hold feature was easy. I was using Unity's (new) input system, and standard modifiers - such as holding, tapping, and slow tapping - can be configured out of the box with no extra code. Sweet.
After this initial success, I very quickly became stuck trying stop the rewind when the hold was released. It sounds simple, however I was having difficulty simultaneously stopping the rewind and capping its duration. I recall being able to perform one rewind fine, but the second rewind would break horribly. For example:
I didn't have a good debug view of the timeline, so I couldn't understand what was happening. I think the timeline had stopped tracking actions after the initial rewind, and it also wasn't being cleared properly after a rewind was complete. Additionally, actions were being recorded while the rewind was in progress, which would obviously skew the rewind's accuracy.
All of this caused a deep existential sadness in the pit of my soul and led me to wonder:
Have I bitten off more than I can chew?
Is my idea good enough to warrant this level of complexity?
Maybe I should start something else?
Thinking about Something Else for a While
I walked to Lidl and bought myself some food. There is Lidl within walking distance from my house, so I often go there just to get outside. This is particularly useful when working from home, where I otherwise would not have a reason to go outside at all. Sometimes I go just for the sake of it and browse the produce they have to offer.
Some Lidls are small and shit, so you can't really find everything you need. You end up having to get your more middle-class items - such as saffron, coconut cream, and wholemeal linguini - from one of the major supermarkets. This Lidl, however, is quite large and new, so I can get by doing my weekly shop here alone. It does mean I have to do without my wholemeal linguini though. There is also an Aldi next door to the Lidl, so you never have to go much further for an alternative budget supermarket. This is probably why the house prices here are sky-high in this area.
An Alternative Perspective
I came back and and figuratively threw the morning's work in the bin - I literally deleted the Github branch - and decided to work on the clone. I had been trying to impose the restrictions whilst the rewind was still working on the actual player, but the end feature is to send a non-controllable copy of the player back.
This was a notably easier job that allowed me to build up momentum again and improve my mood. The clone functions as outlined below.
I chose to keep the clone game object partially active so that it is able to activate and de-activate itself. Had I completely de-activated the game object, something else would need to be responsible for the clone's activation, which I don't think is correct. This does mean I have to manually control the clone's active components, which will increase complexity as I build up the player and the clone, but I don't think it's that big of a deal.
Transferring the rewind onto the clone made the previous task of capping the rewind much easier. As this was now a fortnight ago, I can't remember the details, but I think having the rewind act on an entity separate to the one that was recording the rewind events cleared things up. The high-level take away from this post is that approaching problems from a different angle can have really positive outcomes. I also managed to improve the debug view of the timeline, though there is still work to be done.
Next Steps