How to start coding
From DSWiki
Contents |
Forward
Many people come to programming because they want to develop games for consoles. This is generally a good thing, because programming is an interesting and increasingly important cultural skill, so people who want to learn it should be encouraged.
But: If you are new to programming, don't try to learn programming on the console. Doing this would be a frustrating experience. You will be better off if you learn programming on the PC and then come back to the console and learn it's specific techniques.
What exactly should you learn? The DS development environment is based on a C programming language, so you should learn either C or C++ or both.
Setting up the Devkit
Installing DevkitPro
There is a setup guide at the DevkitPro website, which explains in detail how to install DevkitPro, but it will be explained here shortly:
Windows
You just need this self-extracting installer. Install it and you're ready.
Linux
Linuxers should download
The examples are optional, but recommended, because they are a good start for learning libnds.
Then:
- Make a folder named "DevkitPro"
- Extract DevkitARM to "DevkitPro/devkitARM"
- Extract libnds to "DevkitPro/libnds"
- Extract the examples somewhere.
- Add these lines to your ~/.bashrc:
export DEVKITPRO=/path/to/DevkitPro export DEVKITARM=$DEVKITPRO/devkitARM export PATH=$DEVKITARM/bin:$PATH
- replace "/path/to/DevkitPro" with the actual path to the "DevkitPro" folder you made earlier
- To include the new/changed variables into your environment, type:
source ~/.bashrc
You can test the environment by compiling the examples.
MacOS X
Mac users should download
The examples are optional, but recommended, because they are a good start for learning libnds.
Also, make sure that make is available. If not, install X-Code.
Then just mount the DevKitARM-Image and the Installer will guide you through the process. DevktiPro will be installed into /opt/local/devkitPro, and environment variables will be set up for you automatically, so you don't have to mess around with .bashrc or .profile or anything like that.
You can test the environment by compiling the examples.
How to learn DS coding?
Tutorials
There are some excellent tutorials on how to learn to program for the DS.
- Check out Patater's Introduction to Nintendo DS Programming, the dovoto tutorial on dev-scene or the outdated DoubleC Tutorial.
- Even if it's aimed at GBA programming, Tonc is a great introduction to tiles, sprites and backgrounds.
Example Code
The second best way to learn programming after reading tutorials is reading code itself.
- libnds includes a lot of examples you can start with.
- Several other DS projects provide their source code, so you should use Google. In fact, using Google is one of the best hints ever - for everything. And if you find useful code, link to it here.
Some Great Example and Tutorials Sites that provide everything but hardware are: Dev-Scene.com/nds[1] Patatersoft.info/manual[2]
Documentation
- Libnds' official documentation is here.
- More links to DS documentation can be found in the links section
Further questions?
If you have questions to which you can't find the answers on your own, you might ask the DS homebrew community using one of several forums or IRC.
- The most active DS development forum is the DS section of the GBADev forum.
- On IRC, you can reach the community in the channel #dsdev in blitzed. Be sure to the obey the rules.

