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 > PALib

#91343 - DKnight - Thu Jul 06, 2006 4:28 pm

Hello.

Im currently developing a homebrew game for the nintendo DS, and I have one question to ask about it.
Ive been learning to use PALib to code, and now I am at a point in wich I could start to seriously apply my knowledge into something more notorius than the demos (simple tests) Ive been making.
But recently, I heard from some folks that PALib is "limited". That, added to the poor C++ implementation (everything is focused to C) and the lack of needed updates and bugfixes makes me wonder if I should put it aside and start from scratch with libnds.
?Should I do that? ?What are the cons of using PALib instead libnds (what are these limitations)?
Looking at the libnds examples just makes me dizzy, as at first glance it operates at a very low level (too low for my taste), but if the only way to come out with something decent is to learn it, Ill do it.
The game I have in mind (and in paper) is some sort of 2d platformer (I would love to add some 3D touches, but as far as I know 3D implementation is still very poor), preferibly done in C++ that in pure C.
It would be very helpful to hear any point of view on this matter.

Thanks and sorry for my strange english :P

#91420 - zzo38computer - Fri Jul 07, 2006 3:34 am

There are many good things made with PAlib, it works fine, but I prefer libnds and I use libnds. You could use either one to make whatever you are making.
_________________
Important: Please send messages about FWNITRO to the public forum, not privately to me.

#91444 - dexter0 - Fri Jul 07, 2006 6:20 am

You can even use both PALib and libnds in the same project.

#91449 - Lynx - Fri Jul 07, 2006 6:36 am

Wow.. that is the most honest answer I have ever seen! Good job!
_________________
NDS Homebrew Roms & Reviews

#91454 - wintermute - Fri Jul 07, 2006 7:12 am

dexter0 wrote:
You can even use both PALib and libnds in the same project.


Actually, last time I looked PALib was dependent on libnds.

The main problem with PALib is that it doesn't keep up to date with devkitARM and libnds so it has a tendency to be broken for long periods after either are updated.

C++ isn't really a suitable language for writing system libraries, have a look at what happened with Symbian homebrew for an example of how badly wrong that can go although that situation could be avoided by open source, assuming the code is standards conformant.

You also need to be very careful with C++ on an embedded system - currently there is only 64k available for the arm7 code and I'd advise against using heavy C++ there.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#91582 - dovoto - Sat Jul 08, 2006 12:58 am

To start, I am a bit biased towards libnds for obvious reasons but as I get asked similar questions quite frequently I will tell you my opinion anyway.

It is true that PALib is a higher level library and with it comes certain advantages:
1) Easier development
2) More time to focus on game play / art / music /ect...
3) Code is tested by many people and as such is usually stable and about as efficient as most people can produce in any reasonable time.
4) Code is fairly generic and will handle a wide range of applications

and of course some disadvantages:
1) Not as interesting to code to the API as apposed to talking directly to hardware (for some libnds is even too high-level)
2) Less understanding of what is going on with the DS and therefore harder to trouble shoot bugs which crop up.
3) Its code is fairly generic which means it will not (cannot) be as efficient as finely tuned code specific to your app. This can be a problem if you are doing anything performance critical.
4) It is a work in progress and although it has an impressive feature set you will likely (almost certainly) come to a point in game implementation which requires you to write low level functionality.

How to decide?

It depends on your goals. Look at the type of applications and games you are going to be creating and get a feel for the technical details that will need to be implemented. Take a look at the set of functionality that PALib will provide. If the two mesh and you like the feel of the library (and you care about you application more than you care about how the DS works) then PALib is not a bad way to go (and maybe even a good way to go ;) ....Even libnds takes you away from the hardware to a certain degree (all be it a much shorter distance) so use what suits you and what gets your idea onto the DS with the least trouble and in the best form.

When not to use PALib:

If you want to do something technically challenging PALib is probably not the best option (unless you already know a fair bit about NDS programming and are willing to extend PALib). Most games will qualify as technically challenging.

Of all the complaints I hear about PALib only one strikes me as more than just opinion of people who think low level coding is the only way (I am not excluding myself from people of this opinion):

At some point you will end up needing more than PALib has to offer. You will then need to learn NDS programming and cozy up to the hardware (something you were likely attempting to avoid with PALib). At this point you will realize two things: First, you don?t know how the DS works and second, you don?t have a clue how PALib works. This is generally very frustrating as development was probably going pretty well until this point and now you have a new learning curve to overcome?you must learn how the DS works and you must learn how PALib works with the hardware (otherwise your new low-level code will break it). For most, this is too much bother and they either abandon the feature, abandon the project, or abandon PALib.

For me learning the hardware is easier than learning a library. For others the library is the easier way to get their ideas into the form they need. For you, whatever works is probably the best choice.
_________________
www.drunkencoders.com

#91597 - wintermute - Sat Jul 08, 2006 4:00 am

That's extremely well put Dovoto, thanks for adding your thoughts here.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#91665 - Lynx - Sat Jul 08, 2006 4:54 pm

Awesome information!
_________________
NDS Homebrew Roms & Reviews

#92648 - LiraNuna - Fri Jul 14, 2006 10:07 am

dovoto, I don't think anyone else could say that any better. Impressive.
_________________
Private property.
Violators will be shot, survivors will be shot again.

#92653 - Payk - Fri Jul 14, 2006 10:36 am

Yeah ...I just can say, for my experiance, its absolutly true.
I started deving for nds at the begin of 2006 with PAlib and together with Bib. We wanted to make an OS. So for having many windows we thought about using 12 sprites a 64x64 for each window...But graphics where fucked up. We told it Mollusk so he gonna fix it. We waited and waited till we started deving with Libnds. It was a pain to start, sure. But then we understand much better how many space we have for pics, how to swap them, how to tile them correctly for a good dmacopy....It was hard to find that out without those docs palib offers. But WE LEARNED MUCH. If i would use pa since that, i still would not know how to read out a BMP file or a MD2...i would wait till somebody made those functions and hope they fit for my project... There are so many tricks and workarrounds you cant do with a precoded api like that. And you do not know when vram end will be reached if you not know how it works. If you are going to make a tiny textreader or modplayer or even an imageviewer palib is maybe better lib.
But for 3D games it sucks. Also the md2-loader is actually from webez who was not asked if they are allowed to include...
All in one i would say even for beginners (i was new to c++ too) i would not recommand it...Maybe you have a fast start and nice results with less code...but your going to run with your head against the wall when things appear, which you cant understand.(64x64 sprites was that for me)
Good conclusion dovoto.
Here watch that:
[Images not permitted - Click here to view it]

#92775 - Lynx - Fri Jul 14, 2006 10:23 pm

Hmmm.. Yeah.. I'd like to think you would have to learn the actual hardware if you are going to write an OS!
_________________
NDS Homebrew Roms & Reviews