2. Rewind Woes
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.
- Update the rewind functionality to generate a clone that is sent back in time. Currently the original player is sent back, which is not what I want.
- Limit the maximum amount of rewind. Currently the rewind goes all the way back to the start.
- Set the rewind to occur whilst the Shift key is held. Currently you just press it and it sends you all the way back.
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:
- the timeline report that there were no events to undo; or
- actions that hadn't actually happened would be undone.
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.
- A player clone object is partially inactive in the scene.
- When the actions are recorded on the player, I substitute the relevant player components with those of the clone when recording the action.
- When a rewind is initiated, the visual components of the clone are activated. Recording of new actions is paused.
- When actions are undone, they work on the clone's components rather than the player's because of the substitution above.
- When the rewind is completed, the event history is cleared to remove any events that were not undone, and recording is permitted again.
- The visual components of the clone are deactivated again after a slight pause.
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
- Look into some form of ticketing system to better track my to-do list.
- I had this YouTube video on in the background, and I agreed with the speaker's point on having a clear view of individual sub-tasks. I think a ticketing system will help me even if I only plan to work on this on weekends.
- Historically I have used Trello for an Agile, Kanban-board-style presentation, but I want richer features , such as those offered by TFS or Redmine. I also don't want to pay for said features
- Add in the replay functionality
- Currently, I only have a rewind, so the clone goes back in time, but it doesn't actually re-do the action
- Refactor some of the existing code
- Record gameplay for the next blog post
- [BONUS] Use GIMP to bring in some simple, custom-made artwork
Get Time Travel Prototype
Time Travel Prototype
2D, top-down puzzler game based around undoing your mistakes.
Status | Prototype |
Author | therealcowboyhatman |
Genre | Puzzle |
More posts
- 10. "Finished" PrototypeJul 30, 2022
- 9. Long Time No SeeJun 06, 2022
- 8. Props and Pub CrawlsMay 03, 2022
- 7. The 100-Hour MarkApr 26, 2022
- 6. Live Dev LogApr 15, 2022
- 5. Over The HumpApr 11, 2022
- 4. Abstract as FMar 29, 2022
- 3.2 First Feature MilestoneMar 29, 2022
- 3.1 Psuedo-ProductivityMar 29, 2022
- 3. The 48-Hour MarkMar 29, 2022
Leave a comment
Log in with itch.io to leave a comment.