Thursday, 08 January 2009
 
  Home arrow Forum  
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome, Guest. Please login or register.
January 08, 2009, 01:37:43 PM
Username: Password:
Login with username, password and session length

Forgot your password?
maximum number of palettes?
DSLua Community
Welcome, Guest. Please login or register.
January 08, 2009, 01:37:43 PM
1724 Posts in 316 Topics by 10298 Members
Latest Member: thugsuttenSer
DSLua Community  |  General DS Programming Chats  |  Code Hashing  |  maximum number of palettes? « previous next »
Pages: [1]
Author Topic: maximum number of palettes?  (Read 1034 times)
angor
Waxing Crescent
**
Posts: 55


WWW
« on: May 11, 2006, 11:21:45 AM »

Suddenly my program stopped working and DSLUA collapsing in after some seconds Dualis Sad
After a long painful troubleshooting of this sneaky bug it seems the source of the problem is that i was using too many palettes for the game sprites. It looks like the system is only able to:

a) use 16 palettes
b) palette id should be 0-15

Is this correct? Is this a limitation of DSLUA or the DS system? what can i do if i need more palettes?

Angor
Logged
waruwaru
Administrator
Waxing Crescent
*****
Posts: 94


« Reply #1 on: May 11, 2006, 02:46:14 PM »

Wow, I believe you have actually hit the limit of hardware...  You will have to start sharing palettes and optimizing your graphics now.

Sorry, can't think of anything clever to work around that.

Waruwaru
Logged
Öhr GmbH
Waxing Crescent
**
Posts: 64


« Reply #2 on: May 13, 2006, 02:20:19 PM »

waruwaru, how do you write dslua? with palib or ndslib?
i dont think its a limit of the hardware, i think its a limit of palib(if you use it).
the videomemory is 512kb big and a sprite is SMALL and of course the palettes too.
Logged
waruwaru
Administrator
Waxing Crescent
*****
Posts: 94


« Reply #3 on: May 13, 2006, 02:51:44 PM »

waruwaru, how do you write dslua? with palib or ndslib?
i dont think its a limit of the hardware, i think its a limit of palib(if you use it).
the videomemory is 512kb big and a sprite is SMALL and of course the palettes too.

I do use PALib.  I could be wrong on the palette entries, but according to the NDSTech wiki, we only get 256 entries for sprite palette per screen.  That is only 16 x 16-color-palettes.  And looking at the sprite specs, the OAM attributes entry's bit 12-15 represents palette index, so that is only 4 bits for palette index (which is only 16 possible index).  Let me look into LibNDS to see if the same is true.

Thanks,
Waruwaru
Logged
daltonlaffs
Waxing Gibbous
****
Posts: 340


Freaking Insane


WWW
« Reply #4 on: May 14, 2006, 07:05:23 AM »

There is a simple way around the 16 sprite problem. Take any of them that are the same size and put them in one bitmap. Put one on top of the other. Then when you use the LoadBin function, tell it at the end how many are in one. Every one will be given its own little frame number, so try this:

when you've got the frame set and loaded:

Frame1 = Sprite.Create( FRAMENAME, 0, PALETTE_NAME, X, Y )
Frame2 = Sprite.Create( FRAMENAME, 1, PALETTE_NAME, X, Y )

Note the number (the 0 and the 1 in the example) are the number of the frame. The top one uses 0, next frame down uses 1, next one uses 2, etc. There are many combinations that you can make, as long as the images you are putting together are the same size. I haven't found a limit yet, but there may be one.  Undecided
Logged

Code:
-- Bored? Read code line below.
-- Bored? Read code line above.



^^ That works, I SWEAR! ^^
Pages: [1]
« previous next »
    Jump to:  



    (C) 2009 DSLua

    DSLua - Best scripting language for Nintendo DS home-brew!