#175332 - brave_orakio - Thu Oct 28, 2010 2:18 am
Has anybody done something like this? Something similar to the GBA tiled BG?
If we were to emulate the GBA tile BG using 8x8 squares, we would quickly run out of polygons to use. Using 16x16 tiles is more manageable for the hardware. Don't know yet if I would run into problems later on if I started on this.
What about you guys? Have you done something like this or is it not worth the effort to do this?
_________________
help me
#175333 - Dwedit - Thu Oct 28, 2010 2:33 am
The GBA-like 2D hardware isn't good enough?
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#175334 - brave_orakio - Thu Oct 28, 2010 4:37 am
Not necessarily. But the 3d engine can do stuff the GBA like engine can't.
And also out of curiosity if anybody has tried this before and what the results were for them.
I'm going to try to make my level builder be able to output some 3d engine NDS compatible data but I haven't yet decided in what format the design will be, like in 256x256(or slightly bigger) texture data or maybe in 16x16(or even 32x32) tiles and map data or maybe other formats as well.
_________________
help me
#175335 - headspin - Thu Oct 28, 2010 7:25 am
I have done this. Design the levels in Tiled and just draw the level using quads. I use TinyXml to read the tmx file format. Here is a basic function for drawing a quad.
Code: |
void drawQuad(float width, float height, int textureSize, int quadFlags)
{
width = (width / 2.0F) + 0.001F;
height = (height / 2.0F) + 0.001F;
GFX_TEX_COORD = (TEXTURE_PACK(quadFlags & QUADFLAGS_HFLIP ? inttot16(textureSize) : 0, quadFlags & QUADFLAGS_VFLIP ? 0 : inttot16(textureSize)));
glVertex3v16(floattov16(-width), floattov16(-height), 0);
GFX_TEX_COORD = (TEXTURE_PACK(quadFlags & QUADFLAGS_HFLIP ? 0 : inttot16(textureSize), quadFlags & QUADFLAGS_VFLIP ? 0 : inttot16(textureSize)));
glVertex3v16(floattov16(width), floattov16(-height), 0);
GFX_TEX_COORD = (TEXTURE_PACK(quadFlags & QUADFLAGS_HFLIP ? 0 : inttot16(textureSize), quadFlags & QUADFLAGS_VFLIP ? inttot16(textureSize) : 0));
glVertex3v16(floattov16(width), floattov16(height), 0);
GFX_TEX_COORD = (TEXTURE_PACK(quadFlags & QUADFLAGS_HFLIP ? inttot16(textureSize) : 0, quadFlags & QUADFLAGS_VFLIP ? inttot16(textureSize) : 0));
glVertex3v16(floattov16(-width), floattov16(height), 0);
} |
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game
#175346 - wintermute - Fri Oct 29, 2010 12:40 am
#175347 - brave_orakio - Fri Oct 29, 2010 2:52 am
headspin, how big are the quads that you use to render the level? The amount of polygons the ds can render if I use smaller quads is always at the back of my mind!
Thanks for the info wintermute! It looks like reliminator is doing something similar, I should check out the code. Looking forward to the tutorial too!
edit: Is there any way to actually use multiple textures on a single huge quad? I checked about quads and texturing and it seems that 1 texture data for 1 quad unless we can use an interrupt to keep changing texture data but that seems to be a costly process
_________________
help me
#175352 - elhobbs - Fri Oct 29, 2010 1:46 pm
you can only use a single texture per quad.
modifying a texture while it is in use is not practical - it would be nearly impossible to do anything useful. even then it would need to occur under very contrained conditions. theoretically, you could modify it during the horizontal blank period. Aside from the very small amount of time in which it could be modified it would be extremely difficult to determine which part to modify.
there is a z equal polygon attribute (forget what it is called) that can be used to draw the same quad over again with a different texture - for decal type effects. this can be combined with blending or the alpha channel texture formats for some interesting effects - it does cut into the poly limit though.
#175366 - brave_orakio - Tue Nov 02, 2010 2:36 am
Yeah, the poly limit is what prevents me from using anything smaller than 16x16. Even then, using 16x16 is still somewhat difficult to implement especially since my level builder was built around 8x8.
_________________
help me
#175367 - relminator - Tue Nov 02, 2010 7:21 am
8x8 tiles for a level builder seems really strange(even with the fact that the DS engine uses 8x8). It's too small for tiles.
Even with 8x8 tiles, you're only going to draw 768 tiles for a fullscreen level. With the 3d engine, you could draw at least 1000 sprites (~1500) and that should be enough.
Though I would go for 16x16 tiles since it's kinda like the norm for scrolling engines. Look at the scrolling example I posted.
_________________
http://rel.betterwebber.com
#175369 - brave_orakio - Wed Nov 03, 2010 2:03 am
Well my level builder was originally built for the GBA thats why it uses tiles that are 8x8.
Right now I'm in the planning stage of what size of tiles to use for the DS 3d engine and I think 16x16 seems to be enough for say 2 BGs. It'll take roughly 512 polys if my computation is correct. Even if I have 3 BGs it will stiil be only a little less than 800 quads, which leaves roughly 600 - 700 polys for other things.
Of course, I'm hoping since its an output for the DS 3d engine, A lttile twaeking with that output and it should hopefully be compatible with other 3d engines like openGL.
_________________
help me
#175370 - relminator - Wed Nov 03, 2010 4:09 am
Yes, the code you'll make should be compatible with any platform supporting OpenGL 1.1.
Your logic code does not even need to be changed. It's only the GL based calls that needs abstracting (which isn't very hard to do).
Here's a Lin/Win renderer I made in another language (easily ported to C/C++).
http://imortisoft.no-ip.org/b2b/downloads/gl2d_tute_examples.zip
_________________
http://rel.betterwebber.com
#175371 - sgeos - Wed Nov 03, 2010 4:57 pm
Many 3D game levels are made on a grid and textured with old school pixel art.
#175375 - Exophase - Thu Nov 04, 2010 10:15 pm
Lots of games do this. For instance the Castlevania games by Konami; also Contra 4, which is awkward since it only applies to the top screen.
#175377 - brave_orakio - Fri Nov 05, 2010 2:36 am
Ah I see then it looks like I have the right idea then.
I thought maybe most would use a big 256x256 (or slightly bigger so the edge wont be seen) quad and just use a similar sized 32-bit or 8- bit image which is costlier in terms of memory(and decompression!).
A 16x16 tile will allow me to use 4-bit images which are easier to copy directly or decompress.
_________________
help me
#175403 - relminator - Mon Nov 15, 2010 8:34 am
brave_orakio:
After conversing with zeromus on IRC, I've made my gl2d lib pretty much complete. All it needs is a good documentation and some example files.
What it can do:
Quote: |
1. Textures are easy to load (one function call and your set)
2. Able to use a spritesheet, tilesheet and/or single images.
3. Any bitdepth that is supported by the DS can be used hand in hand ( ie. one sprite can be 16bpp, another can be 8bpp, another can be 4bpp ). Which means you don't have to mess with each sprites' palette in order to use them hand in hand on a single frame.
4. Used palettes are only limited by VRAM E (which is a lot)
5. Can use more than 1 256 palette at any one time (Limited by Vram E's size) The OAM is limited to just 1 256 palette.
6. Very fast and a lot easier to use than the OAM. |
I'll probably release it within this week if I get to do the examples and docs (probably a tutorial to boot).
* I've just refactored my Space Impakto game to use the lib and it still ran a t full speed with a lot of bullets on screen.
_________________
http://rel.betterwebber.com
#175411 - coreyh2 - Tue Nov 16, 2010 2:05 pm
Is it going to have dual screen support like ?Library?
_________________
Deadening 2
#175412 - sverx - Tue Nov 16, 2010 5:34 pm
relminator wrote: |
5. Can use more than 1 256 palette at any one time (Limited by Vram E's size) The OAM is limited to just 1 256 palette. |
You mean OAM is limited to 16 palettes, using extended palettes of course.
#175414 - brave_orakio - Wed Nov 17, 2010 5:46 am
relminator:
Nice! Looking forward to it!
Offtopic: I'm curious as to what Impakto means in your native language?
_________________
help me
#175428 - relminator - Fri Nov 19, 2010 6:09 am
Here ya go...
http://devkitpro.org/viewtopic.php?f=25&t=2333&p=6177#p6177
coreyh2 wrote: |
Is it going to have dual screen support like ?Library? |
Not internally but you can use all of libnds's existing calls so anyone can implement the video capture system himself. I'm not too happy with the FPS reduction and the amount of VRAM usage in dual screen mode.
sverx wrote: |
You mean OAM is limited to 16 palettes, using extended palettes of course.
|
16 palettes of 16 color pals as I understand it.
brave_orakio wrote: |
Nice! Looking forward to it!
Offtopic: I'm curious as to what Impakto means in your native language?
|
Devil. I just named it Space Impakto as a spoof of an old nokia game.
_________________
http://rel.betterwebber.com
#175435 - sverx - Fri Nov 19, 2010 11:24 am
relminator wrote: |
sverx wrote: | You mean OAM is limited to 16 palettes, using extended palettes of course. |
16 palettes of 16 color pals as I understand it. |
That's standard palette: 1pal x 256col or 16pal x 16col. DS can also display 256 color sprites using one of the 16 extended palettes, allocated to a VRAM bank (bank F or G for the MAIN display, bank I for the SUB display). You can activate it using bit 31 of the DISPCNT register. See GBATek :)
#175436 - relminator - Fri Nov 19, 2010 11:47 am
Thanks, that's good to know. Still not as much as you can use with the 3d engine which would be the whole of VRAM F.
_________________
http://rel.betterwebber.com
#175437 - sverx - Fri Nov 19, 2010 3:36 pm
And your library looks really promising :) I think I'll have a test on it, sooner or later.
#175438 - relminator - Fri Nov 19, 2010 3:45 pm
sverx wrote: |
And your library looks really promising :) I think I'll have a test on it, sooner or later. |
Thanks! I really need more people to test it. So far I am the only one stress testing it.
_________________
http://rel.betterwebber.com