First post, findings, end result!

Hello, my name is Herman van der Meulen.

Started with no C and NDS knowledge a few weeks ago, I have now built a simple game!

I will try to write the events in this one post in chronological order:

Learning C

Installing (on Mac OS X)

Game concept



Learning C

k&r I learned C programming in the workshops at HS Leiden and by using an original 1972 K&R C programming book. Of course, I learned the most by just trying.

For C programming specific to the NDS, the workshops were pretty short but the given code examples were very useful.

Installing (on Mac OS X)

A huge pane! Covered on
I used the Eclipse IDE, which is ‘OK’ for NDS development. A lot of configuration is needed though.

Game concept

I really wanted to experience programming for a touch input device. That’s why I designed a game that is almost 100% playable with the touch screen.

It’s as simple as this: Build a pipe from the tap (‘2’ in drawing) valve to a drain (‘3’ in drawing) covering all the available space, in one single build. If needed, you can place one ‘key rock’ on the field, to solve the puzzle.


Instead of the insisted ‘top-down’ approach, I started coding ‘bottom-up’. I started by designing and programming the drawLine() function successfully (twice!) before noticing that it cannot be done perfect on a digital screen! So I used the function of Contrechoc after that experience, which isn’t perfect either.

I then tried to draw a line on the screen with the touch screen and display on which ‘block’ the pen is at any time. This was version 1: download (source and binary, in zip file)

In the next version (2, not online), I remembered where the pen was before the current position, so a route could be drawn.

Version 3 already has the basic game functionality without the ‘key rock’ and only a single level, build mistakes (warnings) printed on the console (top screen): download (source and binary, in zip file)

Version 4 is version 3 but with bitmap images. A lot of work. I designed everything myself. Very pixel based bitmaps, 26×26 pixels. I really like the result, I’m not a designer… download (source and binary, in zip file)

Version 5 has added sound, some levels and displayed current level and warnings, in text built from one bitmap image (font image). There is still no ‘key rock’ functionality. download (source and binary, in zip file)

Version 6 is the current and ‘final’ version for my IEPRO course. Key rock functionality built in. This makes for more interesting levels. There is a tutorial-like first level and a total of 17 playable levels and a ‘You won!’ screen at the end: download final version(source and binary, in zip file)


First of all, (my experience with) pointers still ‘suck’ The most extremely weird problems, (almost) not traceable, are because of pointer errors. That’s why I barely use them. Only if really needed for NDS functionality.

I changed the makefile to a makefile from one of Contrechoc’s examples to get all the sound and images functionality.

Includes can be difficult to understand and get right. Take a good look at examples and you will find logic in it. I won’t go into this problem. If you understand it, it’s not that hard.

Custom fonts are difficult, but educational! You will need different self made bitmap functions to write a simple string of text on the screen. (all can be found in my draw.c )

Of course, I had a lot of tiny errors, bugs and mistakes. This is in part due to the very low level C language (compared to my experience with Java, PHP etc.) and the strange NDS dialect, options and configurations.

All in all, a very, VERY useful and educational experience! But if I ever want to program a game, I will not likely take C as the programming language. Still, it’s almost always needed for embedded devices. Maybe I’ll give C++  a try someday.

Good luck and have fun!

Herman van der Meulen


2 Responses to First post, findings, end result!

  1. contrechoc says:

    Wow! First game on the nds, first try in c-programming? Very interesting also to see the versions progress. Nice – nds fitting – graphics. And yes: getting used to pointers in c takes a while 🙂

  2. contrechoc says:

    just played it on a real nds, i am happy my IQ above 10 is confirmed! Because to solve level 17 you need to know about the symmetry laws of the universe, the Riemann tensor and have some insight in differential geometries….:-)…great!

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: