- Map Files can now actually be saved and loaded
- Maps can now be resized at any time
- Maps can now be shifted
- Optimized and documented code a bit further.
- Been hella lazy
- Regretting 5.
What I don’t hate myself for
Okay, so before I get deeper into why I made so little progress during the last two weeks, let’s look at the bright side of things. It’s not that nothing happened. It’s not that nothing was accomplished. But, unfortunately for me, it’s pretty safe to say, that what I actually got done was a matter of 3 hours tops. Wow, I’m really bad at seeing things from an optimistic point of view…
Anyway, let’s talk the new content!
Saving and loading
Yes, it’s true. An important step has been made, that got YTMC closer to actually serving a purpose. Lots of “doge” memes are popping up in my mind as I’m writing this. Maps created in YTMC can now be saved and loaded (wow, very progress, such improve, so effort).
The technical stuff around this was pretty straight forward and not time consuming in any way, since I had already gotten familiar with Unity’s serialization features beforehand. Also, the underlying data structure was basically already there thanks to me always thinking ahead as much as possible. Well, in programming that is. If only I could say this about life in general. 😀
So, basically all I had to do here was code a quick method that serializes all the important information of a map and saves it to a file. For this purpose Unity’s ScriptableObject class comes in quite handy as it makes this process pretty convenient for both the potential user of my tool and, of course, me as the developer. I already had a class called “MapFile”, which derives from ScriptableObject, ready and waiting to fulfill its purpose. So, I identified all the data within a “Map” object that needs to be stored in order to reconstruct it later and set up the “MapFile” class accordingly. So the above mentioned method basically creates an instance of said ScriptableObject and deep-copies all the important stuff from the “Map” class into it.
With that being said, it’s obvious that the loading method basically does the exact same thing in reverse. However, since I handle the rendering of the map that is currently being worked on inside the Map Creator’s UI through actual meshes attached to GameObjects, I also had to make sure those get recreated automatically. This makes loading a map take a while, depending on how big it is and how many layers it has. But, no matter how complex the map, we’re still talking about seconds here, so no big deal.
All of this was not rocket sience in any way and did not take very long to implement, especially because everything was laid out accordingly beforehand.
How do I start? The ability to change the dimensions of a map after it has been created was one of the things I’d been procrastinating to work on for a while. The reason was simply because it was such a tiny amount of work to do so that I was always like “I’m gonna implement it the moment I need it”. The underlying logic was already written and stuff. All that was left to do was create a simple UI to enable the user to actually use this feature.
But get ready for some A1 irony. When I finally got my lazy butt to creating that UI, I was really sick. In fact, I was feeling so under the weather that I could not even handle simple math! There is a preview feature included in the map resizing UI that required some 6th grade mathematics to implement… That was something my temporarily medically impaired brain could not process at that moment. So this tiny little piece of work took me way longer than it should have. When I looked at it after I felt better I couldn’t believe how such a simple thing could have kept me busy for such a long time… Just embarrassing! 😀
Where has the time gone?
Yeah, I’ve already made it pretty clear that I have been very lazy. A lot of time passed without leaving any kind of productive result. That just sucks and there’s no excuse for it. I procrastinated the heck out of YTMC and the reason is simple: I lack discipline.
The other day, I stumpled upon a very interesing quote on twitter. It quoted a post by tumblr user theangryviolinist. They were asked by someone if they could provide a few tips on how to muster the motivation to keep on practicing regularly. And the answer was just brilliant. See for yourself:
“[…] Better to cultivate discipline than to rely on motivation. Force yourself to do things. Force yourself to get up out of bed and practice. Force yourself to work.
Motivation is fleeting and it’s easy to rely on because it requires no concentrated effort to get. Motivation comes to you. You don’t even have to chase after it.
Discipline is reliable, motivation is fleeting. The question isn’t how to keep yourself motivated. It’s how to train yourself to work without it."
And even though I got so inspired by this, I still somehow managed to procrastinate my plan to get more disciplined. The only thing I never procrastinate is procrastination itself. Yea, pretty meta, huh?
But there were also other reasons I wasn’t that productive. Most importantly, my friend @theinfernogames was about to release his game “Battle Forever” and needed me as a tester. That consumed a lot of time, buf I enjoyed it and I was happy to help out. For more info on “Battle Forever” check it out on itch.io.
I’ll be back
I will terminate procrastination Arnold Schwarzenegger style and do my best to provide a new update as soon as possible. There is not much left to do, so it really shouldn’t be too long before “Yeti’s Tile Map Creator” is all finished and ready to be released.
Thanks for your attention!