Devblog 3
I’ve started on a habit of constantly changing the rules for my pawn game. It feels kind of like I’ve hit a stretch of thinking that my “newest idea” must be my “best idea”. I don’t necessarily think mid-project innovation is a problem, as I still have a month before my deadline, but I consistently underestimate how long it takes me to change around the old code to make the new rules functional. The problem, at least partially, is that my code is not organized very efficiently.
Generally I test my game after every adjustment I make, meaning I run the .app file to make sure that what I wrote actually does what I expected. When it doesn’t, I think of the fastest way that I can change it to make it do what I want it to do. Often, this means adding another conditional statement. So say I wanted my object to move vertically until it reached a certain point and then to stop, I might write (translated into English)“if the object is past this y-axis position, then it stops”, which then becomes a problem if I want to use that object again later on. I solve that with another line of code, “if the object is at this y position, AND this other, uninvolved object is at this other position, then its speed equals zero”, and so on. The solution is only specific to the one instance, so when I have to go back and change it again later, the fragile construction becomes less sturdy and needs even more code to stay upright. Extraneous code begets more extraneous code.
When I’m writing in English, I know that this is the wrong approach. Fixing a non-compelling essay by adding more words is never the answer. Part of this, I’m sure, is familiarity with the language, but I think it would be more efficient to build the good habits now. So, starting today, my new approach for dealing with dysfunctional code is to ask myself if I can solve it in a general way, rather than in a specific way. This should reduce the confusion, and help to build my coding vocabulary, in turn opening up new lines of thought. I have the habit of falling back on the conditionals I already know, but that won’t translate well to more complex games that I plan to make down the road.
If my first game is going to be a successful learning experience, I need to spend more time learning, not just doing.
That’s all for now, screenshots will be back next week.