My worst entry – Postmortem

Posted by (twitter: @YSelfTool)
August 29th, 2014 4:06 pm

This Ludum Dare was interesting, as it was my most ambitious game. And it failed. I should have known.

What went wrong? As always I tried to include an AI, random generation of something (this time a world), a dijkstra-algorithm (and removed it again, it always needed too much time calculating the paths) and fun.

And… it worked! Except for the dijkstra, which was at least bug free, but still not fast enough to calculate paths for 100+ animals every few seconds. And far from fast enough while running on a Pi. I had animals, the player could build rudimenarily, the villagers spawned, there were not exponentially many of them, things were fun (for me).

It was hard work, as I wanted to do a multiplayer game, using Python as a server language (since I love Python) and JavaScript as the client language (since Websites are the most accessible kind of game, and I like JS). That meant writing Python and JS simultaneously, now I can tell: That’s confusing, fun, challenging and confusing. Did I mention confusing? The way to design a program in those languages are close enough, but the syntax is different. Different enough to confuse.

So, what was the problem? For multiplayer in a website I used websockets, which are great for that stuff, it went better than expected. But then again, it was the first project I successfully used websockets for. I found a python library (ws4py) based on another python library (cherrypy) with which I never worked before, and used them. Bad decision. It was sunday evening, three hours before deadline, when I first tried moving from localhost (lo) to local/public IPs/Domains (wlan0, eth0). Didn’t work. The Python socket implementation has a small bug… crashing connections far too often. I changed some parts, sent smaller packets, added small time.sleeps, It made the connection more stable. Then at least one in ten survived and worked. For a game based on an active connection that’s bad. But at least you could reload and play on.

But then not only did the connections crash, but sometimes also the thread handling the sockets. From the library. The bug is in the python standard lib. Without a chance for me to fix the bug. So… It doesn’t work.

What did I learn? Don’t be ambitious. I should have known that. Multiplayer is a lot of work. Use libraries you have already worked with. Did I ever do that? I guess not, but this time that paid out badly. Don’t use two languages at the same time. Make fun games!

So far, see you in december. I’m sorry my game does not work. Neither did using different backends for the websockets work, nor using pypy for the server.

I’m sorry.

Tags:


2 Responses to “My worst entry – Postmortem”

  1. I think it’s fine to be ambitious, but you need to be able to adapt along the way. If you plan for something easy and simple, you’re gonna get that, but if you plan something very ambitious, you might come up with something amazing, even if the result is not what you originally planned.

  2. jahmaican says:

    The first rule of using Dijkstra algorithm is – “don’t”, it works very well, but only in theory :) There’s A* that does the exact same thing so much faster and is fairly simple to implement at the same time. And very often you could even use best first search.

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]