clearifing something up with sprites [SOLVED!]

Tomdev
Posts: 82
Joined: Thu Jan 08, 2009 9:15 pm

clearifing something up with sprites [SOLVED!]

Post by Tomdev » Thu Jan 08, 2009 9:21 pm

ok, because i was a palibber and i want to code something with sprites i'm asking here something:

first:
does 256 colors mean that you have a static specific colorset of 256 colors or that you only can use 256 different colors? i'm always saving images in 256 colors with paint without the knwoledge of what i'm doing :oops:

second:
i want to use grit, but if i look in the nds examples i can't find something that use grit. i know that the makefile has to be different but could someone provide me here a little easy example to show just one sprite using the grit converter? :roll:
Last edited by Tomdev on Fri Jan 16, 2009 4:16 pm, edited 1 time in total.

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: clearifing something up with sprites

Post by Sylus101 » Thu Jan 08, 2009 10:25 pm

A 256 color sprite, also referred to as 8 bit, means that that sprite can contain up to 256 different colors. Paint is probably the worst program you can use to save to 256 color because it only uses it's own palette and does not optimize based on the colors you've used. I like mtPaint for a free simple alternative, although many use a program called Gimp, or even Photoshop, and there are several others. The key is that you can convert from 24 bit down to 8 bit and retain a great deal of your original quality, or all of it if you've used less than 256 colors.

Not real clear on grit's usage myself yet, still just getting into libnds, too. If you want to just get something on screen, you can still use the output from PAGfx if you want.
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

afireohno
Posts: 6
Joined: Thu Jan 01, 2009 9:37 pm

Re: clearifing something up with sprites

Post by afireohno » Fri Jan 09, 2009 2:12 am

Tomdev wrote: second:
i want to use grit, but if i look in the nds examples i can't find something that use grit. i know that the makefile has to be different but could someone provide me here a little easy example to show just one sprite using the grit converter? :roll:
Download the patater tutorial
http://patater.com/manual
It uses grit for all the image conversion. Look at the .grit files in the gfx folders. They're commented so it should give you a good idea of were to start.

I've never used mtPaint, so I don't know about that, but you could also check out usenti for image creation.

User avatar
vuurrobin
Posts: 219
Joined: Fri Jul 11, 2008 8:49 pm
Location: The Netherlands
Contact:

Re: clearifing something up with sprites

Post by vuurrobin » Fri Jan 09, 2009 1:12 pm

for using grit, you can look at the beginners tutorial made bij wintermute in the grit subforum:

http://forums.devkitpro.org/viewtopic.php?f=22&t=17

in short, grit takes the images from the gfx map and a grit rulefile for each image, and converts it into the right binary file and a header file that you can include in your code

Tomdev
Posts: 82
Joined: Thu Jan 08, 2009 9:15 pm

Re: clearifing something up with sprites

Post by Tomdev » Fri Jan 09, 2009 4:12 pm

ok, thanks vuurrobin, but where is this line for:

Code: Select all

 BGCTRL[0] = BG_TILE_BASE(0) | BG_MAP_BASE(4) | BG_COLOR_256 | TEXTBG_SIZE_256x256;
and if i want to use sprites do i have to change this line or throw it away

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: clearifing something up with sprites

Post by Sylus101 » Fri Jan 09, 2009 4:59 pm

Well, that line has nothing to do with grit nor sprites. That's a line of code that sets some registers in the background control and tells the DS some information about a particular background layer, in this case layer 0 on the main engine.

Particularly, in order of appearance, Where the graphics are located by offset amount, where the map is located by offset amount, colors and size.
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

Tomdev
Posts: 82
Joined: Thu Jan 08, 2009 9:15 pm

Re: clearifing something up with sprites

Post by Tomdev » Fri Jan 09, 2009 5:39 pm

so this inits a background with the highest priority on the main graphics engine? it use the tile base 0 (where does this stands for?) is 256 colors and has a size of 256x256 if i'm right. when i looked in the patater tutorial i didn't saw this inits, they were a bit easier. so this can be done different and so yes which is the easiest way?

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: clearifing something up with sprites

Post by Sylus101 » Fri Jan 09, 2009 7:00 pm

http://patater.com/files/projects/manua ... #id2613436

Code: Select all

REG_BG2CNT = BG_BMP16_128x128 |
                 BG_BMP_BASE(8) | // The starting place in memory
                 BG_PRIORITY(2);  // A higher priority
This is basically what corresponds to that other code, but there are some notable differences. Patater's tutorial doesn't cover a tiled background, but a 16 bit Bitmap background instead. One of the main differences between tiled and bitmap backgrounds is that a bitmap doesn't have tiles and a map, but simply a starting location for the graphics to begin. This is still referenced as the tile base or character base in some cases where a function (like the new bgInit()) can cover both types of backgrounds yet the function parameter name doesn't change. Dovoto's tutorial covers tiles backgrounds. The information on what those values mean and do are covered there (they are basically offsets to tell the DS where in memory (VRAM) to look for that data). I'm actually writing up some information on just this subject myself, as it is an area I struggled with immediately when getting into libnds. You're welcome to check my website periodically if you like (link is in my sig).

Here's Dovoto's tutorial. You want Day 4.

http://www.dev-scene.com/NDS/Tutorials
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

Tomdev
Posts: 82
Joined: Thu Jan 08, 2009 9:15 pm

Re: clearifing something up with sprites

Post by Tomdev » Fri Jan 09, 2009 8:15 pm

thanks sylus for al your help here, i'm gonna read that and make soms notes so i don't forget anything. i wanted to know this because graphics are really important i think and i follow your site sometimes. i think it's very handy and maybe you could write some tutorials for palibbers who are switching over to libnds

Sylus101
Posts: 179
Joined: Wed Dec 24, 2008 5:08 am

Re: clearifing something up with sprites

Post by Sylus101 » Fri Jan 09, 2009 8:52 pm

That is entirely the idea of the site, and secondarily to make libnds easier to understand for noobs in general, with focus on learning and using the new sprite and background API functions.

I'll try to get the ball rolling a little faster on the site, but as with most people this is a hobby and I can't put near as much time into it as I'd like.
-Sylus "Not Stylus..." McFrederickson

Come visit my web site.

Post Reply

Who is online

Users browsing this forum: No registered users and 76 guests