Thoughts on version control

Though version control is here to help you, it can sometimes become a rite and a burden. That’s where I ended up. Let’s use version control in a lighter fashion to help us work faster and smoother.

I’m a detail oriented person. Because of this I tend to lean toward the “slow and perfect” side of things rather than the “fast and sloppy” side. Neither is always better, but rather, both are terrible if you follow either of them always. Instead you must adapt, and knowing which direction you tend to lean is very helpful when you need to adjust to the current situation.

Perfect correctness

All I’ve ever read on the topic of version control of program source code leans toward the perfect side. How to write “proper” commit messages. How you should always split up everything in small independent commits. That every feature should be developed in its own branch and later merged. Create branches and lots of them!

I’m not surprised that all I’ve ever seen are tutorials, notes and suggestions on how to do version control “right”. I mean, you type something up when you have a tip or have found a neat workflow or tool.

An example of such a tip is Tim Pope’s rather nice git commit message guide over at his blog. I think this is a rather good guide actually and I mostly follow it, things just look nicer in command line git this way. However, it definitely leans toward “slow and perfect” and might actually just be satisfying my detail oriented mind and not really help me.

Another example is the branching model for git suggested over at this site. This one is rather crazy though. It goes into meticulous detail on how to branch in several layers to successfully build software. My detail oriented mind is completely vetoed by my love for simplicity here. This is just too complicated. I caution you to stay away from this.

It’s a balance

The problem here is that “perfect” and “correct” slows you down and you should beware of this. Think twice before listening to someone telling you how you should do something more “correct”. It will often have a cost in reduced speed. Think of the trade off you are making.

Actually, I urge you to always think of the trade offs. Any time someone preaches about something you absolutely must try. Must do. Now! They are most likely oversimplifying things. Maybe it’s perfect for their case, maybe, but people certainly can make things sound like they would solve your problems too.

The actual problems in software are complexity and the many trade offs one has make to reduce and handle that complexity. Version control was invented to help with this. Instead it sometimes becomes another burden.

Don’t let it.

Don’t use version control, got it

Note that I’m not saying to do or not do these things. I’m saying spending more time on commit messages makes less time for programming or debugging. Spending more time on how to branch or reordering commits leaves less time for thinking about the actual problem at hand.

What I’m trying to say is that it’s easy to spend too much time on doing version control right. In the end it’s just a tool and that should not be forgotten, I did and wasted a lot of time on perfect git histories and commit messages, especially on personal projects. What version control should do for you is help optimize you software development in the grand scheme of things. That might mean spending days figuring out how to use it for your project. But in the end it must be worth the time you spend on it.

Suggestions that might help

  • To work fast, commit things in small chunks with ugly but to you descriptive messages. Clean it up before you share or finish up, possibly changing local history or combining many commits into one.
  • Don’t branch more than it helps. You don’t need a branch for every change. Just hack on master locally. Branch later if you have to to commit or branch from the get go if that’s helpful. There’s no rule.
  • Consider a very descriptive final commit messages if you work in a bigger team. This is mostly for others but possibly also yourself in a few months. It’s great to know why something is the way it is when considering changing it to fix a bug.


It’s OK to use something other than git too, by the way. 😉


New looks!

I’ve just updated the website’s looks! 😀 I’m trying to update this site and the new header and background is the first step in that direction. I also wrote the first version of a dedicated page for my real time ray tracer project “Rateracer”, see the link at the header, and improved the sidebar.

I’m hoping this site will slowly become up to date in the following weeks as I make up for lost time. xD

HttpURLConnection getInputStream FileNotFoundException

Hello Android/Java coders!

So I recently got some weird errors when doing HTTP requests in my Android game Hamster Climb. I was trying to get the input stream from a HttpURLConnection but kept getting a FileNotFoundException even though the URL worked perfectly in my desktop browser. Here’s an example, without error catching stuff, of how the code could look like:

String user = getUser();
String url = "" + user;
URL u = new URL(url);
HttpURLConnection c = (HttpURLConnection) u.openConnection();

InputStream is = c.getInputStream();

The problem was that at the last line the call to getInputStream generated a FileNotFoundException. I printed the URL that was used and tried it in the browser. Worked prefectly.

I managed to solve it though. The problem was that even though creating a URL object with the built URL string works, the URL might be broken. For example, if user is “Some guy” the url will contain a space which is not valid. Browsers solve this by automatically replacing the space with %20 which is what my browser did.

To solve this in code you use the URLEncoder class’ static method encode. This method takes a string and encodes it to a string that is ok to put in a URL. So replacing

String url = "" + user;


String url = "" + URLEncoder.encode(user, "UTF-8");

solves the problem when user contains illegal URL characters.

Hope this helps someone out there getting weird errors. 🙂

Game making

This is a weird post on a blog I really haven’t updated much since I created it. The post is mostly to kind of silently announce to the world I exist and like programming. Also partly to rub it in the face of the mmo nay sayers that even noobs can learn and have fun and maybe actually succeed creating their very own mmos.

I’m really interested in coding. Really. I always thought it was cool to be able to code when I was a kid and really wanted to learn. I started with some hello worlds and random fooling around with code, not really knowing nothing. I started to learn some more but I didn’t really have anything to code. I needed something more specific, something to learn programming while doing. So I got into programming games. It started with python and pygame. GREAT tools, especially for beginners since it’s so simple and comes with zero hassle. 🙂

I coded some stuff. One actually kind of complete game, heh, in which a ball spawns at the center of the screen and you have to catch it before it reaches the edge of the window. When you do or it does score points are increased/decreased and the ball respawns in the middle of the screen. This goes on for 30 seconds. Was pretty fun actually. 🙂

Anyways, I always liked mmos… Mostly for the fun of multiplayer gaming with my friends. But also the design of the whole thing. Anything from client-server interaction to combat mechanics. So I started, trying to atleast, code something of the sort. I did it in python/pygame ofc, that’s what I knew. I learned networking, more about game making, protocols, message handling etc. The code sucked. xD I rewrote everything over and over. I even started on other things such as my own graphics engines, both in python and c++. I’m not really that experience tho, and creating my OWN engine for anything but fun is just crazy. A graphics engine by itself takes years to make for a TEAM of EXPERIENCED coders. I just wanted to create games and I ran out of fun. xD

Back to the mmo stuff I went. I had some fun with python/pygame doing stuff, mostly learning about game making. Threw away the code over and over heh. Finally, I got tired of 2D graphics and wanted 3D instead. I found Panda3D, a open source graphics engine created by Disney. It’s written in C++ but meant to be used from python. PERFECT. 🙂 I played around with it and found it really easy to use. There’s even an exporter for Blender. 🙂

Now my mmo efforts are concentrated on a python server and python/Panda3D client. It’s actually working out quite well this time around. Mostly because I’m A LOT more experienced now. Before this I had never used databases. Had to learn, it’s the thing you know. For the server I’m using sqlite which is a simple no server, one file database library that’s actually included with the standard python release, how convenient. 🙂 I read up on how to handle entities, objects in the game world, and found something called entity systems. Wonderful thing. Got me thinking on how to use the database to it’s potential.

Anyway. Now I have a server written in python, using an sqlite database and communicating with the clients over TCP. The server supports handling connections, logins, the clients entering the world, chat messages, client movement. It also handles “static” or “cacheable” entities such as trees, stones, road signs and the like. These are later meant to be cached client-side by the means of regular server updates. This means they can still be just as dynamic as any other entity in the game world. All entities are equals pretty much. Some are just expected to be more static than others and therefore cacheable. The server also support zones and there are currently two of them. 🙂 One ice and one grassy with trees, stones and road signs. There’s also a magic stone in the ice zone I want to teleport you to the grass zone, more on that later.

The client can connect to the server, be used to login, create characters, enter the world, walk around in 3D on  a height map and see the entities around like trees, stones, other characters. You can send chat messages that get’s picked up by other players if they can see you and also see others messages. I think this is a good start but I’m mostly concentrating on the server at this moment, that code is most importantly CLEANER heh. xD

I have no delusions tho. This game wont ever be the M in Mmo. At this stage I think it might some day support combat. 😉 That’s the level of expectations I have. But that’s what’s fun and make this possible. I just look at the next thing. Currently it is, as always, cleaning up the code and all but other than that, an actual new thing/feature, is adding support for scripting things. I want scripting now because I want to implement a teleporter stone between the zones and thought it might be nicely done using some kind of more generic scriping. In python of course. 🙂

Just an update from big bang to now. 🙂 Cya, when my new ocarina arrives I’ll post more on that. 😀