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 > Starting DS homebrew!

#116925 - ndsdev - Wed Jan 31, 2007 1:39 am

I want to start developing DS homebrew. I have no clue where to start. What programming language should I learn? What do I need to download? Any ebooks or books I should get? What should I do first?

Thanks.

#116928 - tepples - Wed Jan 31, 2007 2:09 am

Have you developed anything in C or C++ on the PC before?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#117014 - Lynx - Wed Jan 31, 2007 8:08 pm

I normally answer questions like this with 1) Install DevkitPro, and then 2) Install PAlib.

http://www.devkitpro.org
http://www.palib.com

DevkitPro will give you the development environment needed to get you started. PAlib is an additional library to help interfacing with the DS. Then, look in the PAlib examples folders and compile the examples, and then look at the source (source/main.c) and see what it takes to do what the example shows.

Of course, books on C and C++ won't hurt, but if you just want to jump in and see what you can do, this is a good start.

Once you are comfortable creating games and apps with the help of PAlib (or, it is limiting your ability) then check out the examples in the DevkitPro folder (not PAlib examples). In there, you will find the non PAlib examples and continue writing your homebrew from there.
_________________
NDS Homebrew Roms & Reviews

#117045 - ndsdev - Wed Jan 31, 2007 10:42 pm

Which one should I learn? C or C++?

#117047 - jester - Wed Jan 31, 2007 11:05 pm

or you could try DSLua www.dslua.com very simple to learn!
_________________
If anyone needs a dragonball online email me @ aaronthejester@hotmail.com

#117051 - tetsujin - Wed Jan 31, 2007 11:26 pm

ndsdev wrote:
Which one should I learn? C or C++?


I would say C.

The thing is, when you're dealing with a small machine you may need to optimize code for space or execution time (which is not impossible in C++ by any means, but sometimes complicated by extra layers of abstraction) and you need to be comfortable, above all, in dealing with pointers and the ways in which data is stored.

You can do all this in C or C++ - but C++ doesn't offer anything beyond what C provides for this kind of job.

What C++ does have to offer are some reasonably nice facilities to help organize code, which is great for large projects. It's also good at hiding a complex process behind an easy interface. For small projects, it's not so important, and hiding complexity can work against you, as for optimization reasons it helps to have a very clear idea of exactly what's going on. C++ can be quite useful to you - but the allure of C++ features can lead to code bloat if you're not careful with them - which is why I suggest learning C first, getting quite comfortable with it, and then moving to C++ if you find it useful in DS projects.
_________________
---GEC
I think that all the work that's been done by the homebrew community so far to support people who want to program for the GBA or DS is amazing.
Thank you, everyone, I look forward to taking advantage of your work.

#117072 - Lynx - Thu Feb 01, 2007 1:19 am

jester wrote:
or you could try DSLua www.dslua.com very simple to learn!


Why do people say that? I looked at it, and it looks just as much like jibberish to me as C and C++ (for the most part). Maybe even more, as I was able to struggle though C to make Leo Toddler.
_________________
NDS Homebrew Roms & Reviews

#117081 - tetsujin - Thu Feb 01, 2007 2:03 am

Lynx wrote:
jester wrote:
or you could try DSLua www.dslua.com very simple to learn!


Why do people say that? I looked at it, and it looks just as much like jibberish to me as C and C++ (for the most part). Maybe even more, as I was able to struggle though C to make Leo Toddler.


If you're just starting out, then it's quite natural that any serious programming language will have an alien nature. Natural languages can't be parsed, and computer languages need to specify actions with a great degree of precision in limited screen space.

Scripting languages can save you from having to deal with a lot of the headaches you have to deal with when writing code. Even with something as basic as Lua you get strings, arrays, and functions as datatypes (all three can be done in C and C++ but you're always stuck with decisions about how to handle the implementation of these - you can't create a callable "function object" in C as you can in C++, unless it's a singleton, and if you create a function object in C++, it'll be incompatible with all other types of function objects, even those with the same calling arguments, unless you give the types a common ancestor class and a vtable. And if you want to deal with strings or arrays in C you need to manage the memory for these. And neither C nor C++ will help you out at all if you screw up.) Because of this flexibility, scripting languages have become a fairly common component of games. The console in the Quake series games is an example.

The tradeoff is simply that there are limits to how much you can optimize script code, because of the extra interpretation level. For this reason, if your game needs high performance, you need to implement the optimized routines in a compiled language - but in the areas of your code where you need flexibility, an interpreted language can still be advantageous.

And then, of course, if your game project doesn't need heavy optimization (and many simple games don't), then implementing it in a scripting language could be a better use of your time than dealing with all the runtime error headaches of a compiled language.
_________________
---GEC
I think that all the work that's been done by the homebrew community so far to support people who want to program for the GBA or DS is amazing.
Thank you, everyone, I look forward to taking advantage of your work.

#117094 - Dood77 - Thu Feb 01, 2007 6:55 am

Does anyone know where I could find a good, thorough C tutorial for beginners? The only programming knowledge I have is BASIC (double meaning there...) and im running windows not UNIX yadda, yadda... I hate it when tutorials tell you how to do something but dont tell you any more specifics to when you are doing.

#117104 - felix123 - Thu Feb 01, 2007 10:26 am

Windows is perfectly fine. In some cases, it can be better than Linux for DS programming.
_________________
Nintendo DS homebrew on Wikipedia

#117144 - outphase - Thu Feb 01, 2007 10:23 pm

devkitpro's windows installer comes with MSYS which is a linux "emulator" for lack of a better term. It allows you to run a bash terminal in a linux command line environment. this can be helpful for building projects and such, but i'm sure it's not required.

#117146 - jester - Thu Feb 01, 2007 10:40 pm

i found DSLua incredibly simple!
_________________
If anyone needs a dragonball online email me @ aaronthejester@hotmail.com

#117190 - Dood77 - Fri Feb 02, 2007 4:20 am

I'd rather jump straight into the real stuff rather than learn DSlua or PAlib or something.

#117194 - knight0fdragon - Fri Feb 02, 2007 6:24 am

Personally I would learn C++ over anything else, it has a lot of useful abilities that you just cant get with C.

Grab yourself Visual C++ Express 2005 as your first compiler.

Go to your local library and try to grab a book that will walk you through how C++ works.

When you feel you can at least read the C++ code and understand how it gets compiled, then come up with a simple example of something you want to start learning.


E.G. How do I get my name on the screen.

When you accomplish this task, build more examples till you feel you are good on the C++ side.

Then, take the examples you made and ask yourself "how do I port this to DS"


When you are at this stage, you would want to look at the examples that come with libnds. In it there will be things you are familiar with, and somethings you wont be. For the things you are not familiar with, google around or search the forums, then when all hope is lost in trying to find out what the peice you are stuck on does, go ahead and make a new post and ask. A lot of people here will be more then glad to help you get your programs working the way you desire them to.
_________________
http://www.myspace.com/knight0fdragonds

MK DS FC: Dragon 330772 075464
AC WW FC: Anthony SamsClub 1933-3433-9458
MPFH: Dragon 0215 4231 1206

#117200 - HyperHacker - Fri Feb 02, 2007 9:46 am

C++, as its name implies, is basically C and then some. This could really be viewed from either angle:

-Learn C first, it's simpler and learning C++ from there will be a snap.
-Learn C++ first, since it includes most if not all of C anyway.

However I'd say start with C, so that if the need arises to use pure C (C++ can create too much overhead on old or embedded systems like the DS), you'll have an easier time. If you started with C to begin with you'll already know how to not use the C++ features, whereas if you started with C++ you may have come to depend on them and have to figure out how to do them in pure C. For example, C has no classes, so if you started with C++ and have been using classes the whole time, pure C is going to be difficult, whereas if you started with C then classes are just a nice bonus you can use in some projects, but not this one.

Of course I tend to like doing things at a particularly low level, so maybe that's just me. ;-)
_________________
I'm a PSP hacker now, but I still <3 DS.