gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > A beginners approach to NDS programming

#158415 - hgeithus - Wed Jun 11, 2008 12:29 am

Hi there :)

First of all I would like to say that I'm impressed by what the homebrew community is able to produce. You make many wonderful programs and games, and the API that you use is really low level, and not exactly well documented (at least it seems so to me). Personally I've been only programming in Java and the basics of C++, and now I've decided I'll try out some programming for the NDS console. I've just made simple programs so far, and it's really fun, and hard.

Let me get to the point. There might be a similar post here on this forum, I don't know, but I know there are many people out there who enjoys programming and would like to try programming for the NDS. And the learning curve is really steep, and that can be a good thing.

Therefore I think it could be very interesting to hear from you programmers about your experience with the NDS console. I'll just scetch out some questions.. you can of course write anything you want, or you can not write anything at all if you're not interested..

1. What experience did you have before you started?
2. What was the most difficult to overcome as a beginner?
3. How did you develop your knowledge? (i.e. reading and resources)
4. What kind of programs do you like writing?

I think it could be a huge motivational factor and also very interesting to read such things from people that has been "in the game" for a while.

(hope this is not a silly post, I'm just a noob)
Thanks in advance to anyone... :)

#158416 - kusma - Wed Jun 11, 2008 1:00 am

hgeithus wrote:

1. What experience did you have before you started?

GBA development (hobby) and professional ARM-development (mobile)
edit: oh, and ~15 years of pc-development
hgeithus wrote:

2. What was the most difficult to overcome as a beginner?

Lack of good documentation, poor emulators and long development turn-around.
hgeithus wrote:

3. How did you develop your knowledge? (i.e. reading and resources)

GBATek, mostly
hgeithus wrote:

4. What kind of programs do you like writing?

3D graphics.


Last edited by kusma on Wed Jun 11, 2008 8:49 am; edited 1 time in total

#158418 - DensitY - Wed Jun 11, 2008 2:11 am

hgeithus wrote:

1. What experience did you have before you started?


Entirely PC based development (10 years Dos/Win32). had a little dabble at GBA for a couple of weeks years ago before deciding to play around with DS more purely because I really dig touch screen interfaces.

Quote:

2. What was the most difficult to overcome as a beginner?


On DS platform it'd have to be the vram bank assignments.

Quote:

3. How did you develop your knowledge? (i.e. reading and resources)


GBATek would be top of the list. I also spent time digging around libnds's header files and just trying stuff out.

Quote:

4. What kind of programs do you like writing?


Good question haha. basically anything interesting, sometimes I feel like writing low level code, directly talking to hardware. sometimes I like to code some 3d code (using either 3d api or software rendering). yeah, depending on my mood depends on what I'll do. with projects, so long as I don't hit my core hate (sql, due to having todo alot of it at work) I'm happy doing anything really.


Most of the DS hardware is normally well documented (most of the time hehe), although if your coming from a pure high level background down to something like DS, then I can understand the initial issues you'd have. I learned programming way back in the DOS days, so the low level access isn't a new thing to me, and its kind of refreshing.

#158420 - yellowstar - Wed Jun 11, 2008 2:54 am

hgeithus wrote:

1. What experience did you have before you started?


Several years on programming on PC, with console/DOS, Windows, and openGL.

DensitY wrote:

Quote:

2. What was the most difficult to overcome as a beginner?


On DS platform it'd have to be the vram bank assignments.

Same here. But after that... That backgrounds problem stopped me from making games, stuff with GUI... Basically anything without the console. But once I get a new hb card, I'm going to quit 8-bit bgs and use 16-bit. No other option. Once that happens, those backgrounds aren't going to hinder me like before.

Quote:

3. How did you develop your knowledge? (i.e. reading and resources)


Tutorials. Libnds headers helped some. I got lots of practice down, too.

Quote:

4. What kind of programs do you like writing?

There wasn't much for me to write on DS, due to the reason I stated above, so I don't know about that for DS. But on PC... I program in console/DOS a lot. Graphical stuff too, in openGL. Tools and games on PC I guess.

#158423 - HyperHacker - Wed Jun 11, 2008 4:29 am

hgeithus wrote:
1. What experience did you have before you started?
Developing for Windows and hacking N64 and Game Boy games.
Quote:
2. What was the most difficult to overcome as a beginner?
Dealing with all the low-level stuff like nested interrupts and VRAM.
Quote:
3. How did you develop your knowledge? (i.e. reading and resources)
Read, ask, practise. Often I end up having to read the libNDS include files to see just what's going on.
Quote:
4. What kind of programs do you like writing?
Mostly tools, though I have plans for a game eventually.
_________________
I'm a PSP hacker now, but I still <3 DS.

#158428 - Sweater Fish Deluxe - Wed Jun 11, 2008 8:45 am

hgeithus wrote:
First of all I would like to say that I'm impressed by what the homebrew community is able to produce. You make many wonderful programs and games, and the API that you use is really low level, and not exactly well documented (at least it seems so to me).

Many homebrew releases--especially games--were made with PAlib on top of libnds, which provides a much more high level access. I don't know how it compares to Java, though. It's what I use for 95% of the coding I do, though many people look down on it.

Quote:
1. What experience did you have before you started?

Basically none. I took a semester of BASIC Programming in high school about 15 years ago where I learned nothing put how to play Gorillas while the teach droned on. Later I messed around a bit with the C Framework for the Neo Geo Pocket and KOS for the Dreamcast, now I'm messing around with PAlib for the DS.

Quote:
2. What was the most difficult to overcome as a beginner?

It may not be the answer you were looking for since it doesn't have much to do with being a beginner, I don't think, but I find that the level of discipline and dedication it takes to take a rough and working game engine and turn it into a tuned and polished release I can be proud of has been the hardest for me. PAlib makes it easy to get your game up and running to start, but it doesn't help at all with all the tiny little aesthetic touches that make a game feel professional. That's just perserverence.

Quote:
3. How did you develop your knowledge? (i.e. reading and resources)

Looking at PAlib and libnds source code mostly

Quote:
4. What kind of programs do you like writing?

2D games.


...word is bondage...

#158441 - Jesse - Wed Jun 11, 2008 4:52 pm

hgeithus wrote:
1. What experience did you have before you started?
Long time programmer on multiple platforms back to the C64 (well, actually ABC80, for those who know about that one). Assembly, Pascal and C++ has been the languages I've spent most time in.
Quote:
2. What was the most difficult to overcome as a beginner?
For DS development it was getting used to program without a debugger again and with longer turnaround between tweaking your code to be able to test it.
Quote:
3. How did you develop your knowledge? (i.e. reading and resources)
Mostly by looking through the excellent examples included when installing devkitPro.
Quote:
4. What kind of programs do you like writing?
Anything that hasn't been done before. :)
_________________
http://www.collectingsmiles.com/colors & http://www.collectingsmiles.com/hyena

#158484 - nce - Thu Jun 12, 2008 4:45 am

Quote:
1. What experience did you have before you started?

Programming basic when I was kids, then C/C++, tried to make several engine in openGL and directX. and finally main experience in animation and graphics ( working as techincal animator/artist )

Quote:
2. What was the most difficult to overcome as a beginner?

No debugger ( well that remembers me my old days on pixel shader 1.1 )

Quote:
3. How did you develop your knowledge? (i.e. reading and resources)

Gbatek, libnds source code, and this forum of course

Quote:
4. What kind of programs do you like writing?

starting 3d game project ( yes I always start, design a pipeline, resolve issues and stop.... ^_^ )
_________________
-jerome-

#159143 - Massif - Thu Jun 26, 2008 4:38 am

Quote:

1. What experience did you have before you started?

Lots of Java and C. Went through 4 years of university which started us off with C to teach the low level programming stuff, then proceeded to Java to teach the higher level software engineering concepts.

Quote:
2. What was the most difficult to overcome as a beginner?

Figuring out how sprites are loaded and displayed was the most challenging part for me.


Quote:
3. How did you develop your knowledge? (i.e. reading and resources)

TONC: http://www.coranac.com/tonc/text/toc.htm - Especially chapter 8 on Regular Sprites.
DSWiki: http://www.tobw.net/dswiki/index.php?title=Graphic_modes#Background_Control_Register - Good tables of modes, VRAM sizes etc.
Patater: http://patater.com/manual - Great tutorial that gives you step by step instructions on each part of the code.
LibNDS Docs: http://www.drunkencoders.com/libnds/ - Getting better

And of course the IRC is a great source of help as long as you're polite and respectful.


Quote:
4. What kind of programs do you like writing?

At the end of the day, I love developing games. I do it for a living and then I come home and do it for fun. You have to make sure that you're passionate about what you're developing. Otherwise, the project will never get off the ground.
_________________
Massif - It means mountain.

#159146 - sgeos - Thu Jun 26, 2008 5:02 am

hgeithus wrote:
1. What experience did you have before you started?

A working knowledge of C, although I suppose C++ is the way to go these days if your goal is to eventually go pro.

hgeithus wrote:
2. What was the most difficult to overcome as a beginner?

Finding good documentation, but homebrew was a different world then.

hgeithus wrote:
3. How did you develop your knowledge? (i.e. reading and resources)

Reading and practicing. To a large extent, computer science is a lot of the same. Java may not seem relevant to the DS, but the principles of OOP still apply. Design patterns are no different.

hgeithus wrote:
4. What kind of programs do you like writing?

I actually prefer writing documentation, but I write tools and modules, etc when they need to be done. When you work on a team, there is so much that needs to done. If you do what other people do not like to do, you will get along very well.

Good luck!
-Brendan

#159184 - gauauu - Thu Jun 26, 2008 4:48 pm

Am I allowed to respond, even though my experience is mostly GBA, and I'm just now starting on DS development?
hgeithus wrote:
1. What experience did you have before you started?

Before DS, I did GBA development for a few years. Before GBA, programming for years in all sorts of different languages and platforms. (Starting on TI-994/a!)

hgeithus wrote:
2. What was the most difficult to overcome as a beginner?

Getting used to doing register-based programming instead of having a nice API. The other frustrating thing is when I started on GBA, there weren't as high quality resource/graphic conversion tools, which was painful. I spent hours downloading and playing with all sorts of graphic converters trying to find something that worked the way I wanted. Eventually I gave up and wrote my own command-line interface to Cearn's wingit (this was before Git/Grit) to get it to do what I wanted.

hgeithus wrote:
3. How did you develop your knowledge? (i.e. reading and resources)

By doing. Reading all the tutorials out there, asking questions here, and writing lots of code. Writing throwaway games/programs before trying to start on something big.

hgeithus wrote:
4. What kind of programs do you like writing?

Games! (are there anything else?) I did discover that I really like writing the architecture/framework for the game and creating the pipelines to get resources and things into the game, but really hate the part where you make content: designing levels, scripting enemies, etc.

#159206 - Cydrak - Thu Jun 26, 2008 11:32 pm

Quote:
1. What experience did you have before you started?

PC stuff, and purely as a hobby (over 10 years now). I'm one of those people who starts and never finishes things, due to life issues, but also because all the interesting projects are just above my current skillset. >_> My latest project is the closest to finished, and I've been correspondingly quiet, because I don't want to jinx it. -_^

I started back in DOS, so I already was comfy with registers, IRQs, DMA and all that fun stuff. When people comment on the lack of API, it actually perplexes me, because one of the things I love about the DS is how much the registers feel like one! I mean, what's really the difference between masking a few well-named bits in DISPLAY_CR, and calling dispA->set...()? A heap of punctuation, right?

Quote:
2. What was the most difficult to overcome as a beginner?

I think both the Nintendo and DevkitPro teams put a lot of effort into their designs. It feels a lot less low-level than it could be. Anyone who thinks otherwise has IMHO never seen, for example, the old VGA hardware. ;)

Nasty things at first: The FIFO is hard to set up. The dual-CPU thing... synchronization bugs are highly sensitive, and can lay dormant. Ahhh.. you haven't lived til your messaging mysteriously deadlocks, the cache blithely flushes over your data, or R14 gets killed in a nested IRQ (just when I thought it was safe--that one ate an entire week). "Fun" times, hehee.

But now, my main difficulty has been how much work the "polish" becomes. By way of example, I had a windows game roughly ported in under a month. But it was barely playable in that state, and a lot more work has gone into other aspects: sound, menus, graphics and cache optimizations, and specialized conversion tools. More UI remains, as well as screen size and localization/font issues. Almost none of that touches the core game code!

So (and I guess I'm echoing Sweater Fish here) perhaps the real trouble I find is not writing code.. but "writing" the whole process. Toolset, architecture... it's taking design skills I don't think I previously had. Ideas have to be tried, scrapped and rewritten... and hopefully you still have energy left for the content, and to make it fun! ;)

Quote:
3. How did you develop your knowledge? (i.e. reading and resources)

Largely TONC and GBAtek. Tons and tons of experimentation. A lot of stuff is (or was) not well explained. So it's really important to get a short compile path going, to be able to test things. I don't think I can stress this enough. The time and money I spent making wifi work (and being able to reload code in seconds, on the same boot) was totally worth it.

A lot of good info and code is scattered on the boards, if you can find it. On the other hand, a lot of *wrong* ideas can be gotten from the emulators. An emu's first priority will necessarily be to work at all, and only second or third to work properly, so beware!

Quote:
4. What kind of programs do you like writing?

I still want to work on games... I'm exceedingly fond of Zelda and Metroid-type things, as well as RPGs. I'd love a "heavy duty" paint app (and playing with graphics in general--very "instant gratification" :). I also have an interest in OS dev and I think the DS would be a fun platform to pursue it on, as you don't have the concerns of hardware diversity, etc.

However, these are a lot of work (a severe understatement, esp. without a team), so for now my energy has gone into the basic prerequisites. One of the things I'd like in the future is to get more information out there, pragmatic docs that go beyond reference--how to actually *use* all those registers (especially in robust ways which won't break later on).