Wednesday, October 10, 2012

Agon and Alea - October 10th

My Cat Is More Interesting Than A Dragon

Today was about my cat.

My cat has something like 30 different pieces of paper, 7 vaccines, 1 microchip, and 20 blood tests to go through in order to get to and from my home in America for the Christmas Season (which, by the way, at the very steep cost of flying a cat, is my only Christmas present this year!)

He has extrasensory perception when it comes to telling when we're off to the vet. He will go outside for any romp or run, but the vet? Oh no. Today we got the rabies vaccine and the microchip, which at least means that he should safely be able to enter the USA. We still need to get three pieces of paper signed by a notary so he can stop over in Canada, all within a very complex time table closely surrounding my trip to Shanghai and departure date. "Time Sensitivity," is the word.

Yes, I know I'm doing an Agon and Alea update.

Agon and Alea - October 10th

In non-cat related news, Agon and Alea is still in development, and doing quite well for itself. Unfortunately, half a week's programming work was lost to food poisoning, and it's going to be difficult for me to make up the lost ground.

To conserve my resources, I'm changing off from showing up during my professor's C++ class, to focusing instead on helping the students through my tutoring hours. My tutoring hours really stacks my 'Time at SCAD' onto Tuesdays and Thursdays, leaving me a relatively clean Monday and Wednesday for development and handling personal issues.

I've spent this week working on a lot of things- getting a lot behind me- given that I was KOed the entire weekend. Most of them were personal, but I did manage to make some important strides with Agon and Alea. Last week I worked on the art bible and saw my game's concept art through to completion while grappling with the in-game math necessary to control my Augmented Reality.

This week I implemented the GUI interface which is going to drive the demo forward.

And today? Today stunk. That's why today is about my cat.

Hacking: Here There Be Dragons

No plan ever survives the first engagement with the enemy. Let that be a lesson to all future programmers out there. If you book every last one of your moments with a small task, you're going to die when a problem ends up taking 100x the duration it should take, and 100 small tasks seem to mount up on your shoulders like a horrific demon of time management.

One of the hurtles when developing with Agon and Alea is that I code on a wide variety of machines (PCs, Macs, and an iPad text editor) and the actual development machine is a seven year old hacked Dell Laptop running an old version of MacOS (Snow Leopard) with a 'clever' XCode and iOS SDK work around to let me develop for iOS 5.0 and 5.1 on my iPad2.  Oh, and it's battery just gave up the ghost a month ago.

Portable and 100% mine, the Laptop is a good solution to the difficulties and dangers of keeping my Apple Developer ID and other potentially sensitive information on an up to date school computer with power cord issues and a different version of MacOS. It also allows me to develop from home on weekends, holidays, and when I don't feel like going into school to compile my code.

On the other hand.... It's a six year old cleverly worked-around Dell laptop. Whose battery just died. The poor baby is flaky.

Now here's the issue. I needed/need a convenient way to get my code around. Dropbox couldn't do version control, and I started having strange errors where files were mysteriously disappearing or being replaced by unknown forces (my cat walking on the keyboard when I turned my back) and I was spending more time chasing down missing files than I was coding.

The Complications: Subversion

At the recommendation of a friend, I switched to using SVN (or Subversion) for all of my coding needs. It handles source code version control, allows me to use my computer as a server to pump code to any other machine I want, and is in general pretty intuitive and useful.

On a Mac. Before I really start using Unity 3D.

Any development IDE, from Xcode to Unity, allows for the editing of the file hierarchy, that is the moving and deleting of files from within the project explorer. The Mac best-solution SVN-integration-with-finder is a far cry from the Windows Alternative (very flaky  gets itself into errors it can't resolve super easy and needs everything to be deleted and rebuilt). Furthermore, any time you delete or move a file or directory in Unity 3D on either system? Everything breaks.

I really didn't know anything about social coding before going to work for Trader Analytics, but I'm very grateful for everything they taught me, and for the ways I was able to help them put together their project. While the GIT framework stumped and confused me at first, I now have an alternative, SVN, to compare it to. I also learned about things like the View/Model/View-Model development scheme (and derivatives).  But let's focus on GIT and SVN for now.

Since approximately 2:30pm I have been trying to take my fully functional code from my Windows PC machine, pull it onto my Dell Machine, and run it on my iPad.

The only significant changes from my last build that I have made at this point have been to swap out a white cube for an animated figure, and to implement the GUI, which is working perfectly on my Windows machine.

Three hours later, and my game still hasn't gotten safely from one computer to another.

Dragons: Have Nothing To Do With Coding

The Dragon in Computer Programming is The Unforeseen, Difficult-to-Pinpoint Hangup That Prevents You From Coding at all.

If you aren't coding, you aren't coding.  Coding is a relatively straightforward, speedy process. Sure, if you're like me, you run off researching unnecessary things every few minutes. But if you can restrain yourself to Googling only once per question coding itself is just a time consuming process in which work gets done.

It's everything else that creates horror, stress, and pain.

It's when there isn't a power outlet, or a broadband jack, or a broadband cable, or a mouse, or a reference, or a resource, or a plan. It's when the tools you're using start showing gaps and holes. It's when the tools you're using end up lacking functionality you expected them to have. It's when you try to do something that seems intuitive and obvious, but the framework you were experimenting in was made for another purpose, and shatters. It's when someone doesn't point out the obvious to you, and you walk headlong into a pillar.

These Dragons not only keep coding from happening because they take up a lot of time (and let's face it, they tend to take up more time than even just coding, because they're vague and amorphous and we really don't even want to solve them we just want to get to work, and then they start getting bigger and bigger, and we end up having to wait long periods of time for file transfers or gaps in our schedule or what have you to fix them) but they send us spiraling off into a mood from which it is impossible to code with any efficiency.

Your fingertips can only code as fast and as efficiently as your mind is working. When you have to sit down and find out why half your files are missing in between shutdown last night and power up this morning, it stresses you out. Your brain, which spent the evening piecing together your thoughts from the previous day and forming new algorithms, has been smacked upside the head and forced to solve a problem it doesn't care about, that isn't going to yield any immediate result on the final project, and which really shouldn't even exist in the first place. By the time you even manage to solve your Dragon (IF you solve your dragon) you are so frazzled and low on time that everything you do seems to result in failure. The next day you might as well scrap everything you did and start over from scratch.

The Computer Programmer Dragon Stinks. Precisely because it has nothing whatsoever to do with computer programming.

My Current Dragon is Subversion

Mine is currently the SVN framework, which doesn't let you edit files from within a project explorer. My solution is to transfer over to a GIT framework, which is going to take time and make it impossible to code until I'm done. On the other hand, once I do it- hopefully- it will make my life a little smoother.

But how do you know when to give up and do things the 'brute force' way of throwing everything on a HDD and saving iterative copies and just praying nothing gets lost? Experience, I'd wager. Only experience- and your gut- can tell you when one solution is bad and needs to be scrapped for another. Certainly you shouldn't rely on frustration. Frustration will just lead you to make a choice you think is 'easier' which will in the long run frustrate you more because your anger and stress will cause you to make all the mistakes you absolutely could not make when using the alternative solution.

Two choices have to be made. One, that the current software is not going to meet your needs. Two, you must decide what of your remaining choices IS going to meet your needs.

So first of all, can Subversion meet my needs? To me, the answer is no. No, it cannot. Why? Because Subversion cannot track when files are deleted or destroyed, it results in a lot of dangerous clutter I have to chase down and delete long after I've actually modified all my files. This is a problem because I want to do as little management of the repository as possible. I can't be hunting down and deleting needed files and trying my game one file at a time to see which ones went missing and which ones reappeared.

Unity really creates a lot of junk when running. A lot of junk. Junk that then becomes surprisingly necessary in order to get the file to run the same way on one computer as it has ran on another. If the junk fails to cache or update or not-update, or whatever the heck it is that the junk needs to do, the whole solution fails for reasons that make sense only to Zeus and the Olympian Gods. I either need to include or not include this junk very precisely, very easily, from update to update, with almost zero management.

Subversion can't do that, because Subversion files migrate out to each and every last remaining tiny directory, and the whole system explodes on me in a MAC every time something goes missing for even a moment. I've deleted my whole repository multiple times for this reason.

So is there a solution? Obviously I could copy the entire thing on to Dropbox, wipe my hands, and call it a day. Except that's where I came from and I know it wasn't working for me. Which means I know the HDD solution wont work for me either. I was losing files. I couldn't keep good-enough track of what was happening from iteration to iteration. as much as Subversion makes me want to kick puppies, I haven't lost anything to it.

GIT is Both a Solution, and a Another Dragon

So what's a solution? I can try GIT. It could be dangerous, it might come with its own hurtles (read: it WILL come with it's own hurtles) and take up even more of my time trying to run than Subversion. But since Subversion- by design- cannot serve my needs, it means I need to get off Subversion and on to something else. And since I can't work with Dropbox, it's time to move to GIT.

From my experience with Trader Analytics, I've been able to use GIT before, and I will be able to use it now. No problem. Should be easy. Still, it's a dragon. It's keeping me from coding, and upsetting me in the process.

How is GIT different from Subversion? Since it tracks from a top down framework instead of a bottom up framework (that's the easiest way I can think of to explain it, please do not judge my computer literacy on that one ;)) it simply doesn't have the issues Subversion has. With Subversion I found myself deleting whole repositories on both sides (server and client)  and using the Terminal to navigate through all my broken folders to find 'hidden' .svn directories and delete them by command line, only to recreate the repository and drag the files in all over again, rebuilding it from scratch.

And I'm not a coder, if you remember. I'm a game designer. If I'm working with the command line, I'm already grumpy ;)

With GIT that just won't happen. Furthermore, I'm more familiar with how to address repository conflicts in GIT than I am in Subversion, which, while it might be a lean mean super process, simply never got explained to me in a way that made any sense at all.

Of course GIT is gonna bite me in the foot and make me swear just like Subversion, but it will at least be able to handle the fact that I frequently move, rename, and delete files from within project explorers, and Unity likes to create mountains of crap to help it make games. GIT shouldn't have any problem tracking that at all. The only problems I should have are the normal repository ones, where I've deleted a file on one computer, changed it heavily on another, and can't figure out how to reconcile the two repositories.

So How Do You Deal With Dragons?

If one of the primary attributes of a 'Dragon' is that it makes it hard for all future coding because you're stressed and behind, how do you handle hitting one?

Easy. You just remember your Cat is a lot more interesting than Dragons.

When you begin having experience in something, when you've repeated a task multiple times, it starts being worth your time to look back and find patterns, to figure out where your best productive moments were, and what sort of pitfalls to avoid to keep the Dragons at bay. But when you're new- as I am- and everything is a shot in the dark before you start, you are never going to be able to stop Dragons from happening.

Let me put it this way: You HAVE no 'most productive' state, because you have no data about yourself to make that estimation by. There's nothing you could be doing better. You are already working hard. You are already trying everything you can think of to do the best project you can.

So Dragons are going to happen. Period. You try an engine, it blows up in your face. You try social coding, it ends up having a pitfall you COULD have known about, but didn't because there just isn't enough time to know everything, and life didn't get you to the tiny subsection of the FAQ you actually would end up needing. And hey, even if it had, you might not have recognized you needed it just yet!

You can't stop the Dragon from happening. You're too inexperienced to figured out when to put your nose to the grindstone (or HOW to put your nose to the grindstone), and when to back off and find another technology. You really have no means of gauging the most effective way to work, because again you have no data, no patterns, no material to make those predictions by. So your Dragons are going to be long, fat Dragons that are hard to get around and impossible to see the dimensions of, and everywhere you turn there are going to be more of them.

That Does Not Sound Like Dealing With It!!!!

Like I said, it's all about Cats. You can't control the pitfalls, only how you behave once you encounter them. You can't control hitting a wall, only how you feel about hitting the wall. You can't control the fact that the Dragon will stop you from coding. You can only deal with your efficiency once the Dragon is past and you're left with your own stress and looming deadlines.

You take some deep breaths. As you work through the Dragon, you focus on other things. The more 'other things' you get done while working on the Dragon, the easier things are going to be because you will regain a little control over your life.  While your code is compiling, you do your taxes. You take a nap. You go for a walk. Need to research? Do it in line for a bank on a mobile device. Or at the park. Or in a library.  Get out of the house.

Find some way to clear your head.

Debug with clear objectives in mind. Think "I am looking to diagnose the cause of symptom X by examining the states of Y, Z, F, and Q, and to do that I am going to write a script for 15 minutes that allows me to print that data to screen and log it for future reference."

Cook a meal that'll last you a week and refrigerate half of it. Make that phone call you've been putting off in between trying stressful tasks. Drink some tea. Drink a beer. Read three pages in a book that's sitting untouched on your shelf. Practice a single sentence in another language. Practice boxing on a punching bag. Go for a single lap swim.

I'm not telling you to avoid your Dragon. I'm telling you that if you focus on it to the exclusion of all else, you'll spin your wheels and accomplish things slower than if you find a way to control your mood through the endevour. This is all about yourself, and controlling whats going on inside your head. The Dragon is just a task- not some personified spawn of satan- and it can be completed through careful application of your task-solving skills. Like everything else.

Its your MOOD that makes Dragons huge. It's your mood that makes problems unsolvable. And if you can find the delicate balance that lets you do your work without avoiding it, while at the same time finding a way to control your mood. This is about ROI. Invest in your own well being the exact amount of capital that you need to in order to start getting a return from your creative/technical side again.

Or, in my case, pay your rent, sort out your plane tickets, get your cat his shot and microchip, take him for a walk to alleviate his stress, figure out your bills, and, setup GIT, and while you're at it realize that the reason that your program wont compile is because iOS is just turning its nose up at something it dislikes in the interface.

A day is almost gone, and no code has been written. And, probably, no code will be written. Not till Friday. Does that bother me? Sure. But nothing could have changed that. And I've a Cat to worry about. And if I can manage to focus on him instead of the Dragon, I'll wake up Friday to find my development environment set up and primed for my use, with my working code debugged, my social coding server largely functional, and all my other obligations taken care of.

And then, if I keep focusing on my Cat, I'll bet you I'll get a surprisingly amount of work done on Friday.

--Gaming Imperatrix.

No comments:

Post a Comment