50 lines of code. To little or a lot?
Just finished organizing a small local gamedev community contest, that lasted a bit over a week, and where participants were required to write a game in just 50 lines of code. When I’ve announced the contest, reactions where kinda interesting. People were asking if 50 was a mistype and I’ve meant 500 instead of 50, some stated that it was hard and some even argued that it’s impossible. On the other hand, some just asked questions to clarify rules and went to work. Later in the evening someone already sent me a game written from scratch. Wow, that was quick.
The common problem at the start was that old thinking habit. People were shocked: it takes more lines than that just to initialize the window and start OpenGL or DirectX. And what about loading assets? Models, textures, levels? And arghhh… engines! This shows how such habits are really constraining creativity. Instead of thinking about game ideas, and only then about how to stuff those ideas into 50 line limits and other constraints, people go the other way and try to think about limits, their usual ways of work and only then about ideas. As my experience through whole game developers career showed it multiple times – it’s a bad thing to do. As they say: think out of the box!
Contest’s main rules were quite simple: only 50 lines of code, any programming language was accepted, and game could use unlimited amount of assets (data files). Unfortunately, I’ve had to add some sub rules to explain what exactly one line of code was, because it’s very easy to abuse this with reaaaaally long lines. So, rule of one command per line was added. As expected, it’s hard to grasp what one command could mean, so I’ve had to add a bunch of other sub rules, to explain what was allowed and what was not. This is probably the only part of the contest that has failed, because simple one line rule became a couple pages of explanations on what was considered one line or command. I’ve wanted to keep it simple, but it quickly got out of hand. Next time, I think it would be easier just to limit line length to 80 or so symbols, so in the end, you just need to keep your code in a 50×80 box.
Then the only problem would be language differences, where some languages may be able to stuff more code in a single line than others.
Despite some problems with rules, final games were AWESOME. It’s amazing what is possible to do in just 50 lines of code, and I must say, that some games made my jaw drop. This is the link to the final games with their source code, have a look at it: 50LocAllGames. In the end 10 games were submitted and participated in the best game’s vote, and 3 more submitted applications were disqualified, because they lacked common features making them as games. The best game was voted “JTG” aka “Journey Through Games” by KestasL. It’s absolutely amazing, considering it was written in just 50 lines of code. Yes, it uses a lot of assets, but the idea and concept of the game is ingenious! Congratulations to KestasL.
Conclusions? 50 lines of code is a lot! People imagination, as always, has a surprise ready. It was a great deal of fun. It’s awesome to write small games in a small amount of time and get the feedback quick. In the end, contest went really well. It was a lot of fun and people liked it. I want to organize it sometime again, and I already have some interesting ideas floating in my mind.


