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 > NDSlib vs PAlib

#113238 - Magitek - Mon Dec 25, 2006 5:08 am

I'm a new developer, and I just got devkitPro, and I'm a little confused with these two libraries. Are they both compatible? Can they both be used in the same project? Any preferences?

Any information would be greatly appreciated!

#113239 - Lick - Mon Dec 25, 2006 5:43 am

NDSLib is the old version/name of libnds.

PALib is a wrapper for libnds. It's written poorly, but it's usable and it might be easier for beginners (after all, it's a wrapper) because it hides 'ugly stuff' from the coder.
libnds is recommended, because real coders love the 'ugly stuff'.
_________________
http://licklick.wordpress.com

#113240 - tepples - Mon Dec 25, 2006 5:47 am

If you do use PALib and direct libnds calls in a project, you have to be careful not to step on PALib's toes. I've observed that people who post to this forum have used PALib for a while and become frustrated with its limitations, and then go to straight libnds.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#113241 - Magitek - Mon Dec 25, 2006 5:58 am

cool, thanks! I guess It'll be fun to get into the 'ugly stuff' after being so sheltered from languages like Java, whose black box philosophy makes me want to say that ignorance is bliss, haha.

#113243 - shadowghost21 - Mon Dec 25, 2006 6:34 am

Thats funny I dont seem to have any problems. Sorry If I dont want to write 20+ lines of code every project to set up my hardware, when I can make a call to it from PAlib. I wouldn't call PAlib a "wrapper" It is a library basied on NDSlib. So it makes it faster to set up the hardware and what not, And I have no problems using PAlib and the regular NDSlib functions side by side in the same program. The only thing I have had trouble with the fat stuff, but then again who hasn't?

-Dont piss off the Shadow

#113244 - Lick - Mon Dec 25, 2006 6:41 am

Hi shadow,

I wasn't bashing PALib, but it's a (well known) fact that it's poorly written. And it being a wrapper is also a fact, although I don't think the word wrapper has any negative meanings to it. It's just a technical term.

I wasn't trying to piss you off at all. I hope you can reread my above message and interpret my statements as objective comments.
_________________
http://licklick.wordpress.com

#113251 - OOPMan - Mon Dec 25, 2006 9:35 am

PALib is more Allegro than SDL. In other words, it's a rather high-level library. libNDS, on the other hand, is very low-level...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...

#113366 - Lynx - Wed Dec 27, 2006 2:39 am

Heck.. Might as well say the same thing I always say about the libs.. PAlib is for people that want to get coding and concentrate on their program, not how it interacts with the DS. Sure, PAlib has its limitations, but most "wrappers" if that is what you want to call it, do have limitations. Most professional programmers will tell you the same thing. They are provided with tools they are forced to use, and they also have limitations.

Bottom line for beginners.. Do you want to create a homebrew DS game that you can see in a few days, or do you want to spend those days learning the NDS hardware?
_________________
NDS Homebrew Roms & Reviews

#113374 - Firon - Wed Dec 27, 2006 3:35 am

Learning the hardware would be much more productive and would probably let you do a better job in the end.

#113375 - Rajveer - Wed Dec 27, 2006 3:47 am

I agree with Firon. I'm new to C and DS programming, learnt PALib and everything seemed "nice". Decided to go straight to libNDS and took me a long time to adapt and learn how things work, but it was much more worth it in the long run. I'm making something I consider complicated (for a beginner :) ) and I couldn't have done it effectively with PALib I dont think.

#113420 - Sunray - Wed Dec 27, 2006 6:48 pm

Low-level = fun
High-level = boring

It is that simple. ;)

#113451 - Lynx - Wed Dec 27, 2006 9:54 pm

Sunray wrote:
Low-level = fun
High-level = boring

It is that simple. ;)



Or..

Low-level = You have lots of time to kill
High-level = you have a life

That simple as well.. :)
_________________
NDS Homebrew Roms & Reviews

#113455 - OOPMan - Wed Dec 27, 2006 10:47 pm

I think both are rather simplistic interpretations...

High-level libraries can be boring to work with, but they can also produce results. Low-level libraries can be both interesting and yet also frustrating to work with...

While I think it's nice that a lot of people use PALib to produce some fun homebrew, I'm not so happy that some of this homebrew remains artificially limited because the developers in question are not willing to work outside the comfort zone PALib provides. A prime example is the Comic Book reading application. It's a great idea and well implemented, but PAFS limits the program in a highly artificial way and forces the user to create bulky roms that have an upper-size limit. This problem is compounded by the program's source not being released.

Creating a homebrew game in a few days may be a nice benefit to PALib, but I find myself a little worried when people post asking for help with PALib and it becomes apparent that their grasp of C/C++ is highly limited.

Results are good, but if you can't understand how or why you got those results, it's not so good.

If PALib did a little more to expose the hardware and was a whole lot better documented I would have a more positive opinion of it. As it is, however, PALib seems to do more to hide the hardware functionality than to expose it. The documentation, on the other hand does very little to expose the ideas underlying PALib. Reading the documentation for PALib always leaves me confused. I inevitably ask "What if I want to do...XYZ" and find that there's no obvious way to do it without just ignoring PALib altogether, which kind of negates to point of using it.

Overall, it's a mixed issue. PALib has its pros and its cons, as does libnds. I personally feel PALib has some pretty big cons, though, so I haven't done anything more than download it and take a squiz at it now and then...
_________________
"My boot, your face..." - Attributed to OOPMan, Emperor of Eroticon VI

You can find my NDS homebrew projects here...


Last edited by OOPMan on Thu Dec 28, 2006 9:30 am; edited 1 time in total

#113457 - tepples - Wed Dec 27, 2006 10:57 pm

PALib would be worth it if it supported more platforms than Nintendo DS homebrew. I learned Allegro instead of straight DirectX in part because Allegro supports more platforms.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#113467 - Lick - Wed Dec 27, 2006 11:55 pm

Lynx wrote:
Sunray wrote:
Low-level = fun
High-level = boring

It is that simple. ;)



Or..

Low-level = You have lots of time to kill
High-level = you have a life

That simple as well.. :)


Or..

Low-level = stable and faster software
High-level = not optimized and bloated

Seriously, I don't think libnds can be considered -that- low level.
_________________
http://licklick.wordpress.com

#113469 - chishm - Thu Dec 28, 2006 12:10 am

I think that high-level libraries are useful for abstracting over the repetitive, boring bits common to every application. Two commonly used high-level libraries are libfat and libDSWifi. I don't think anyone in their right mind would want to replicate these simply to get closer to the hardware. Any library, high- or low- level, should make the programmer's task easier. If you have to fight the library to get anything done, then I suggest you abandon it or make use of it in more creative ways (take the code you want and modify it, throw away what you don't want).
_________________
http://chishm.drunkencoders.com
http://dldi.drunkencoders.com

#113470 - sirpoonga - Thu Dec 28, 2006 12:22 am

I have been using PAlib. I like it. For the simple stuff I have been doing it is fine. However, with my latest labyrinth project I have had to rewrite some of the functions to be more efficient or more general. I wrote 16x16 tile engine for palib in which I had to rewrite some of the tile functions and rewrote the astar pathfinding function.

I am having issues working with fixed point numbers right now so I don't know if it is palib or my incomprehension of fixed point.

#113497 - Lynx - Thu Dec 28, 2006 7:35 am

OOPMan wrote:
While I think it's nice that a lot of people use PALib to produce some fun homebrew, I'm not so happy that some of this homebrew remains artificially limited because the developers in question are not willing to work outside the comfort zone PALib provides. A prime example is the Comic Book reading application. It's a great idea and well implemented, but PAFS limits the program in a highly artificial way and forces the user to create bulky roms that have an upper-size limit. This problem is compouned by the program's source not being released.


Well, I try to stay objective.. Of course, it is always up to the developer to decide if they want to release their source or not, and I can only guess that most PAlib'ers choose not to because they code poorly. But, I don't know.. at least, that would be my reason.. :)

I wonder though, if PAlib didn't exist, how many less homebrew devers would there be? And of course the hardcore coders answer would be "good" because they don't have to deal with newbie coders questions, but if it lets a newbie get a taste for programming to see if they like it, I think it's a good thing. I can tell you right now, if it wasn't for PAlib, I wouldn't be able to code anything.. shoot.. I can barely code with PAlib, I would be totally lost without it.

The only con I see with PAlib personally is that it makes it so easy to code for the NDS that you get a lot of people like me (aka, programming incompetent) writing homebrew and releasing crap. But, at the same time, we are getting releases like WordUp, which I personally (as well as my wife, who never plays games) have spent more time playing (and enjoying) than any of the commercial games I have purchased. I also wish it's source was available.
_________________
NDS Homebrew Roms & Reviews

#113721 - Payk - Fri Dec 29, 2006 11:38 pm

Of course Palib avoids many settings and hardware setups. Its realy a nice step into ds coding. But because of that its limated. Because coer doesnt need to know the video ram setup he will straight code till he reached the end. BOOM! "Ouch...out of videoram...but on subscreen i just make some printouts...cant i use the vram which i wont use on subscreen?!?!" And there the REAL development begins. You will check one of those list where you can see how/where to map each bank, for what purpose its aviable and how much space it has. When you see that you realy start planing. You use the hardware in a certain way. Way more ffective because its shaped for your situation. Yes sure you have to read stuff. Yes sure you will have trouble. Yes sure sometimes its frustrating. But you will see the diference when you managed the basic things. For example Drahonminded used a video ram bank to transfer sound data from one cpu to another. If you would use palib you would first need to find out which banks are used. In your own project based on libnds you would know that of course.

In fact palib offers alot of nice functions. Loading images, music etc.
I feared that stuff before starting with libnds. But BMP is simnple. PNG is open source and jpg/gif was often portet to many devices(nds too).
So its just a bit more work to replace that PA-stuff. But you can use that on a better way. Its open source...you can do what you want to do.

So my opinion: Pa does avoid alot of work if you can live with those limitations. Who knows, maybe the setup stuff is like made for you ;)
But i often read stuff on release notes like: tilebug...i have no idea but i guess it has to do with pa....etc
So if you have trouble you will have to wait till its fixed or make your own way with libnds.

Libnds is just the real basic env. There are good reasons why it isnt more. Not because wintermute and dovoto are lazy. They just add stuff which is realy basic and doesnt limate possibilitys which are given by hardware. We have to thank everyone who is/was related to that development.

Also we shouldn't guess how poorly Palib was made or stuff. Palib is maybe a fun project for Mollusk. Its alot of work. Some parts are maybe interesting too. But it is HIS project and realisng his code could cause others doing mods of it. He wouldnt be able to help users when there are bugs he doesnt can figure out. I guess Molusk did learn much from that project, he made a not that small community and want to keep it alive. I can understand his deciiosn partly. And i can not say that it is bad work what he did. Its just specialized on what he thinks ppl. would need. It put much effort on it.

#115511 - thing - Tue Jan 16, 2007 9:17 pm

Hi,
Sorry to bring this subject back to live, but this thread was helpful to me and now that I have a few weeks of experience I?m back to give my feedback ? so my post is for beginners like me.

I totally agree with the arguments saying that PA will limit your creativity and your code, but I started with libnds (the basics!) and after some time I was getting frustrated with its complexities, it was too low level for me. I was spending time debugging initialization and all video modes when all I wanted was to learn a bit more of C/C++, to play with fixed-point logic, basic input/output and stuff. So I shifted to PA and obviously I started to get results faster... The point is that it gave me some more motivation to keep investing free time on NDS development, it was easier for me to learn coding basics and now I'm already looking forward to libnds again, slowly, but motivated.

So despite all its limitations and cons, PA is a good option for beginners and non-programmers. Real developers can easily skip it, but if C/C++ is an issue for you, if you are not familiar with hardware details like memory mapping, registers and etc... Go for PA, it is a friendlier environment that will help you get used to basic concepts like tiling, sprites, backgrounds, etc. If you are really up to the job, you'll naturally move to libnds afterwards.

That's it. Writing useless homebrews has become a nice hobby and I?m now spending more time learning NDS programming than with playing games? :)
Happy coding to you all,
Thing.

#115584 - Mollusk - Wed Jan 17, 2007 1:30 pm

I rarely post here and didn't want to post in the libnds vs PAlib topic...

Just wanted to point at that thing totally understood what PAlib is here for. It has never been meant to replace/be better than libnds, and code done for general purpose in PAlib cannot compete with code written for a specific usage in your code, both in termes of speed and memory usage.

Like PAlib or not, you have to admit that NDS dev isn't THAT easy for noobies, and you have to start at some point... Some never coded in C before, and playing with registers and all (even though it's actually very simple) isn't that intuistic when you start off.

PAlib does hide lots of stuff to the user hardware wise, to make stuff easier. If your main goal is to learn more about the DS's inner workings, then PAlib is totally not for you. I'd like to remind it is open source, and I've had some 'thank you' mails from non-PAlib coders because they could actually learn/understand stuff by looking at the code.

Last thing, a game is there to be fun. You can have really badly written stuff, but the final result can be a great and playable game. I'm pretty sure everyone has been a noob at some time, so please understand and be indulgent with that kind of stuff... I wouldn't say using PAlib makes you a bad coder, it's more inexperience. Once you're comfortable with C/C++ and want to really master all the DS can do, switch to libnds and that's where the real coding challenge begins. But if you don't have time for that, you can still code some great stuff using PAlib...
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#115595 - Lynx - Wed Jan 17, 2007 6:42 pm

Well put.

But, Phoenix Rising isn't even close to being a noob (19+ years) and he still prefers to use PAlib because he doesn't give a crap about the DS and it's internals. And even using PAlib, the code he writes is unreadable by someone like me. Of course, he doesn't have problems going around PAlib and writing his own stuff and a lot of the stuff he does use isn't the "easy" routines like I use. So, PAlib isn't just for noobs, but for people that want to write a game, not learn the internals of the DS.
_________________
NDS Homebrew Roms & Reviews

#115631 - josath - Thu Jan 18, 2007 12:52 am

I just wish it would work on linux :(

I've tried a couple versions in the past, always requires me to make a few changes to Makefiles etc to get it to compile, but then once it is compiled, half of the examples don't work.

#115673 - Mollusk - Thu Jan 18, 2007 9:00 am

That's weird :s

I have a few friends who use it on linux and haven't had these problems. The wiki has been updated with linux and mac os installation instructions.

As for the makefile changes and some stuff to change, that was because I didn't have a linux install to test, and had a few typo with not-perfectly cased stuff... From what I now, that's fixed right now
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#115678 - Lynx - Thu Jan 18, 2007 10:50 am

Yes, PR does all his deving under Linux as well.
_________________
NDS Homebrew Roms & Reviews

#115738 - josath - Thu Jan 18, 2007 9:05 pm

with latest libnds, palib, devkitarm, everything. I followed the instructions on the wiki (which tell you not to recompile palib -- perhaps that's where I went wrong before)

Now I tried to compile PAExamples/Input/Keyboard

First compile: can't find libfat, dswifi -- this is my fault, I add their dirs to LIBDIRS := in the makefile

Second compile: error compling, gbfs.h is included in PAlib, even though it's already in libnds. I remove gbfs.h from PAlib

Third compile: POWER_CR undeclared in PA_General.h
Ok, when I get this, it means someone hasn't updated their stuff to latest libnds register names. I usually just stick in an #include <nds/registers_alt.h>.

Fourth compile: No errors, but warnings that various libnds register #defines are duplicated in PA_General.h and PA_SpecialFx.h. a couple quick #ifndef...#endif wrappers fixed those


I'm away from my DS right now, so I can't test the .nds files to see if they work, but it was a lot quicker setting it up this time.

#115742 - Mollusk - Thu Jan 18, 2007 9:55 pm

That's really weird :s I got my new computer for Christmas, installed a clean new dekvitpro/libnds, latest PAlib, worked perfectly, no warnings :s
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#115744 - sirpoonga - Thu Jan 18, 2007 10:21 pm

In reply to Mollusk's large reply...

I started out on PAlib. I might be doing one of my projects in libnds partly because I want to learn more about the ds. It can only help you to understand how the hardware treats the code.

However, I will still use PAlib. Mollusk keeps working on it. It will come up with a question on how to do something or a certain function needs to exists and Mollusk usually replies it's in his local beta build :s But that's cool, it means it is being worked on :)

Also it is open source, if you see something that is not efficient you can do something about it. I've rewritten several of the function to either make them more general or improve efficiency. I need to submit them sometime :) I am currently working on improving the A* functions as the current function takes up more memory and processing than it has to. I'm also getting rid of the global maze array as I want to use maze as the name a variable in one of my programs. I'm going to have you pass in an array pointer and size instead.

"I wouldn't say using PAlib makes you a bad coder, it's more inexperience."
Exactly. I have been out of college for 6 years and I have been a software engineer for that time. I can do the coding (though I am rusty in C and C++). I prefer to use PAlib because it makes life easier. It's great for putting together quick proof of concepts. It may not be the fastest but I am not doing anything that requires speed.

However, you also have to remember PAlib is built on top of libnds. You can easily use the low level stuff with it. I have been using combinations of both. PAlib is great for getting a project off the ground. Then having that low level access you can speed up the parts that are slow.

#115747 - Mollusk - Thu Jan 18, 2007 10:41 pm

sirpoonga wrote:
It will come up with a question on how to do something or a certain function needs to exists and Mollusk usually replies it's in his local beta build :s

The latest beta just came out ^^
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#115755 - sirpoonga - Thu Jan 18, 2007 11:24 pm

Mollusk wrote:
sirpoonga wrote:
It will come up with a question on how to do something or a certain function needs to exists and Mollusk usually replies it's in his local beta build :s

The latest beta just came out ^^

I know, but that still is going to be your answer to all my questions :)

#115758 - Lynx - Thu Jan 18, 2007 11:38 pm

josath wrote:
I'm away from my DS right now, so I can't test the .nds files to see if they work, but it was a lot quicker setting it up this time.


Dualis runs in wine if your not doing anything over complicated that Dualis cant handle.

[quote]I know, but that still is going to be your answer to all my questions :)
Quote:

Almost everything homebrew is always "under development" so that can always be the answer to everything.

_________________
NDS Homebrew Roms & Reviews

#115767 - josath - Fri Jan 19, 2007 12:31 am

EDIT:

A lot of the demos work, but not all.

Broken: Video player, Mod player, PAFS, 3D, CheckLid/CloseLid.
Microphone seems a bit buggy, it's always reporting either in the range 0-10, or 255. it doesnt seem to report any values in between.

But all the sprite / bg demos I tested seem to work fine.

A question for lynx/PR - what do you use instead of PAGfx (since it's all .NET which doesn't seem to want to run under wine or mono)? Does it spit out the same format data as gfx2gba or git?

#115825 - Mollusk - Fri Jan 19, 2007 11:48 am

josath wrote:
EDIT:

A lot of the demos work, but not all.

Broken: Video player, Mod player, PAFS, 3D, CheckLid/CloseLid.

Guess I'll take a look at that.
Though I've been using the mod player in all my homebrew, and PAFS only works for slot2 cards (you can use the fatlib for slot1 devices). As for Checklid, I'll check but have used it lately too...
I'm not actually 'in charge' of the 3D part, I'll try to see what's wrong and what I can do, though.

Quote:
Microphone seems a bit buggy, it's always reporting either in the range 0-10, or 255. it doesnt seem to report any values in between.

I'll check again, but the values seemed ok on my DS

Quote:
A question for lynx/PR - what do you use instead of PAGfx (since it's all .NET which doesn't seem to want to run under wine or mono)? Does it spit out the same format data as gfx2gba or git?

A friend of mine just compiled a linux version running on Mono, should be out very soon :)
The output is similar to gfx2gba. PAGfx adds some custom naming and a few more infos, but just if you want to use the 'over-simplified' background functions.
_________________
PAlib official forum : http://www.palib.info
PAlib official tutorials: http://www.palib.info/wiki
Updates, help, code examples, tutorials, etc...

#115862 - Lynx - Fri Jan 19, 2007 8:58 pm

Quote:

Quote:
A question for lynx/PR - what do you use instead of PAGfx (since it's all .NET which doesn't seem to want to run under wine or mono)? Does it spit out the same format data as gfx2gba or git?

A friend of mine just compiled a linux version running on Mono, should be out very soon :)
The output is similar to gfx2gba. PAGfx adds some custom naming and a few more infos, but just if you want to use the 'over-simplified' background functions.


Man.. I can't wait for that tool! Right now, we use a Windows machine to convert the gfx using PAGfx.. and since PR doesn't have one, he sends me his gfx, I convert them, and send them back.
_________________
NDS Homebrew Roms & Reviews