Road Rage – n900 game

The Lappeenranta University of Technology (LUT) organized 20th summer school on telecommunications during the last week. I was there arranging it and running a 24 hour codecamp. The theme of the summer school was “Supporting independent living with technology”. We had a number of seminaries related on the theme and at the end of the week we had a 24 hour codecamp. During the codecamp the students were introduced to the Nokia N900 smart phone that runs the newest Maemo operating system. The good side of the OS is that you can use Python to quickly develop applications and test them. This was the case on the one-day codecamp – Program something that supports independent living at home and do it quickly (and dirty :-P).

Even though I was helping people out most of the time and programming some harder parts (like the very evil how-to send an SMS), I still had time to do something own. As most of the readers know, I am a big game aficianado. Thus, I had to do a game 😛 All I had was a few dark hours of the night. I decided to use pygame as the library to program with and away I went!

An Idea?

Okay… Where do I start from? Well, I had a mobile device on my hands. The first thing that came to my mind was to create a certain limitation (in addition to the small amount of time I had). Thus, I decided that the only way to control would be with the accelerometer of the phone – no touching, no keyboard buttons. Just tilting the phone.

Fine, I had a limitation and the controls. Now, the game? I wanted to have something fast paced, quick to play, quick to fail and quick to start again. Thus, I came across the idea of a car game. Just your old, not-so-breakthrough, driving game.

So, now we have the game idea: A car driving forwards that moves according to the tilting of the phone. Nice 😀

Gameplay

Well, something easy and fast-paced. This was quite easy to come by. Imagine a car driving very fast on the wrong lane. There are other cars coming towards you. The player needs to tilt the phone to avoid colliding with the law-abiding citizens. As this would be too easy by itself, I added oil spills. If the car hits an oil spill, it looses maneuverability – the player cannot move the car for a few seconds, thus forcing the car to just keep going straight. This added some nice challenge to the game.

Also, the game keeps track of the player’s score. The further you get, the more points you get. In addition, if the player tilts the phone forwards the car goes faster and if tilted backwards the car brakes. Going slow is easier, but the player earns a lot less points in the exchange. So, either higher speed, higher gain and higher risk or the slow grandma way 😛 Now there is a simple gameplay logic and challenge to the game. All that is missing is…

Grrrraphics

Urmm… yeah. This is something that is needed. I guess. As I suck on drawing and making graphics I had to go with some really cheap stuff.  If you can go the whole nine yards, I decided not to even go to the start line. No fancy programs and pixel graphics. Instead, I drew the car, oil spills, the road and the oncoming cars by hand. Some really ugly and nasty pencil drawings. BUT! After editing them a little bit (just changing temperature, saturation, hue, brightness, etc.) I came up with pretty decent looking graphics.

Here are the graphics I created and edited (all in a short amount of time)

The Car:  

Enemy car:

Oil spill:  

Explosion:

The road:  

Ugly? Well, it still works surprisingly good.

Putting it all together

Okay, so now I had everything in place. Easy controls, cheap graphics and simple gameplay. The creation of this whole game from a scratch took me about 4 hours, which I am quite proud of. Here is a screenshot of the game (yeah, screen capture of a quick-paced game is not easy, but you get the idea):

If you are still interested and would like to try out the game (I think it works only on n900), get the source from the following page: http://www.codecamp.fi/doku.php/ssotc_2011/grp1/start

It’s completely free and open-source. Do whatever you want with it, but please, at least provide some credits to my work. Also, if you happen to use something I have made, please let me know. I would be more than happy to hear about it 😀

Android code camp – a week after

Okay, the Android codecamp is now in the history. It was an interesting week of coding although this time we did not take it as seriously as we have taken some in the past. One week is not much time and when programming to a whole new platform, it takes a while to learn things. Nonetheless the groups managed to do some really nice applications. I will give a short view on all of those.

1. Lunch Magnet

This was an interesting project. It’s goal was to gather friends nearby and ask if they want to have lunch together (simple, yet oh-so-problematic sometimes). So no need to make all the phone calls and ask who is where. Just login to the system and see if anyone is nearby (at the university for example). This project can be found from here: http://www.codecamp.fi/doku.php/android2010/grp16/start

2. Base Jump

Although this one is a very simple game derived from the google’s android tutorials, the space lander (or something like that), it was still something nice and appealing to me. It is simple, fast to play game where the idea is to jump down from the roof of a building, open your base jump parachute just in time and land the target – all this as fast as possible. Very simple game as I said, but this is something I like in mobile phones, a game that you can play for few minutes when waiting for a bus/train/friend/whatever. This game can be found from: http://www.codecamp.fi/doku.php/android2010/grp10/start

3. Androchi

This was an interesting idea, going back a decade (or maybe even more, I don’t remember quite well). The idea was to make a tamagotchi for android phone. It works pretty well and even the animations looked pretty nice. This application was a good success, at least codecamp wise. Few days, nothing too big, simple idea, nice polished look and even working. Good job! http://www.codecamp.fi/doku.php/android2010/grp2/start


These
programs I mentioned are just few ones that appealed to me. Others will propably disagree, but that doesn’t matter. All the applications made during the week are available from the codecamp website: http://www.codecamp.fi/doku.php/android2010/start
There should be instructions as well as source code for most of the programs, a short introductions and few pictures. Those of you who have android phones (with 2.1 SDK) can give the programs a try. Those who don’t, you can try an emulator from google if you wish.

All in all I feel that the codecamp was again a great place to learn something new. I wasn’t very much familiar with Java, but I learned a lot during the few days of coding. Also, the android is a nice platform and has some nice tutorials for developers. The Google APIs however are outdated and not very informative, but the android developer community has posted a lot of tutorials, code snippets, etc. on their websites.

ps. I am currently doing some maemo development on my N900, so check out my blog every now and then for updates about that.

Android codecamp

The University of Lappeenranta has a habit of arranging codecamps once in a while. The idea of such a codecamp is to learn to program on a certain kind of platform in an intensive (usually) week-long “camp”. Lots of students gather together to create new applications and to learn new technologies. This time the codecamp is about Android programming. The camp is held between 15th and 19th of March. This time, in addition to University students we also have participants from the Saimaa Polytechnic. This means that the competition is even tougher than before, the room is more crowded, the atmosphere is even better and the smell after the long days (and nights!) of programming will be really something! More about the codecamp can be found from here: http://www.codecamp.fi/doku.php/android2010/start
A picture from the starting day

About Android

Propably many of the readers know already something about Android, but nonetheless, I am going to give a very short description of Android.

Android is an operating system created by Google for mobile phones. Most of the phones sold here in Finland are not yet Android based, but the amount of Android phones on the markets is growing all the time. The development community of Android is really active and it seems that there are lots of tutorials available out there (just go and google out!).  Android platform is also completely open source, so anyone with enthusiasm and knowledge can make it even better. Google also provides pretty good APIs (Application Programming Interfaces) for their own services, like google maps and so on… You can read a lot more about android from http://www.android.com/

My Team

We are having three persons groups during this codecamp. My team mates are Rostislav Malevich and Johannes Tattari, with whom I have already participated on many codecamps (actually this is the 5th one for Rostislav 😛 ). We do not have any experience of Android before, so this will be a very interesting chance to learn something new. Johannes also has an Android phone, so this will give him some programming experience to start his own projects. Our idea is to make a location based virtual mobster game, where the player fights for ownership of territories against other players. The actual project can be found from the University’s codecamp wiki: http://www.codecamp.fi/doku.php/android2010/grp6/start If you are interested in finding out more, please go and visit the page!


Rostislav and Johannes programming