Thursday, April 7, 2016

Swiftly Learning: Mini-Combat Part 3: I don't Git it

I've been saving my work on Mini Combat to github, as I may have previously mentioned. It's fairly straightforward, probably because I've spent so much time playing RPGs like Oblivion, Skyrim, and even The Sims. I'd always have my main game where I did everything the right way; picked the good guy choices, let the NPCs live, didn't set my Sims on fire. Every once in a while, though, one of the NPCs would be a little too lippy or my Sim would have a chance to do something risky like fixing a computer while standing in a puddle of water... so I'd create a special save. It was my "this is what we go back to if this goes horribly wrong" save and it was usually just a 1 tacked onto the end of my normal file name.

I think of git the same way. I don't know if I'm supposed to or not, but I do, and it makes sense to me. I do some work, I check the work in when I'm at a nice point where something's finished, and then I have a whole different sequence of saves for when I decide maybe my Sim WAS better off quitting his job, or have the original one to go back to if it all goes horribly wrong. Which is exactly what happened today.

See, as I've mentioned previously, I know my code for Mini-Combat is a mess. I have pretty much everything in my ViewController.swift file, which is, well, sloppy. It works, though, it does almost everything I want it to do. I have one last thing to add - a "restart game" button. Then, it's functionally finished! YES!!

Of course, before I did that one last thing, I got the idea in my head that I should clean it up; try to get everything working using the proper MVC pattern that I learned about on the internet. I started moving things around, putting variables in the data part and moving functions from ViewController into a Game class and started rewriting everything to reference the new stuff and and and and and...

Yeah... I'm not doing that now. I tried, and while I could absolutely do it, it was taking far more time than I want to put into something that is just a learning exercise. I'll take the lesson as this: If you're going to do it properly, do it properly from the start, because rewriting everything later is a giant pain in the arse. Glad I had that saved game to go back to.

Now, if only I could figure out how to go load my save... to Google!

No comments:

Post a Comment