Is there any MapSprite2 limitation?

Use this forum to share and discuss Uzebox games and demos.
User avatar
Gosma
Posts: 67
Joined: Thu Oct 24, 2013 7:31 pm
Location: Santos, Brazil

Is there any MapSprite2 limitation?

Post by Gosma » Thu Mar 20, 2014 1:09 pm

Hi,

I'm trying to make a very simple penalty kick game for Uzebox, i could do the map drawing but
i'm very troubled with the sprites, and if someone could help me

Since a penalty kick don't need many sprites (Player, Ball and for GK) , i'm trying to make the sprite biggest as possible

i've tried 7x5 sprite, and 4x4 sprite with no success? so what's the limitation for creating sprites in Uzebox?
uzem_000.jpg
uzem_000.jpg (137.66 KiB) Viewed 3366 times
Last edited by Gosma on Thu Mar 20, 2014 1:14 pm, edited 1 time in total.

User avatar
Gosma
Posts: 67
Joined: Thu Oct 24, 2013 7:31 pm
Location: Santos, Brazil

Re: Is there any MapSprite2 limitation?

Post by Gosma » Thu Mar 20, 2014 1:12 pm

sorry forgot to mention... I'm using Video Mode 3 that looks (just looks :D ) easier!

User avatar
Janka
Posts: 213
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Is there any MapSprite2 limitation?

Post by Janka » Thu Mar 20, 2014 1:47 pm

Gosma wrote:sorry forgot to mention... I'm using Video Mode 3 that looks (just looks :D ) easier!
The mapping in mode 3 is limited on the number of RAM tiles used. As each RAM tile takes up 64 bytes, you can have ~38 of them at max. This depends on how much global variables you have and which stack size you need for function local variables.

How many RAM tiles are needed for a mapping depends on the coordinates. If a both X and Y coordinates are divideable by 8, you need one tile per 8x8 pixel block. If not, you may end up needing up to 4 tiles per 8x8 pixel block. The mapping function honors adjacent RAM tiles so it's not so problematic, but still, you may reach the limit very quick. My solution would be to limit the player position to x%8==0 before the ball is shot.

User avatar
Gosma
Posts: 67
Joined: Thu Oct 24, 2013 7:31 pm
Location: Santos, Brazil

Re: Is there any MapSprite2 limitation?

Post by Gosma » Thu Mar 20, 2014 2:16 pm

Janka wrote:
Gosma wrote:sorry forgot to mention... I'm using Video Mode 3 that looks (just looks :D ) easier!
The mapping in mode 3 is limited on the number of RAM tiles used. As each RAM tile takes up 64 bytes, you can have ~38 of them at max. This depends on how much global variables you have and which stack size you need for function local variables.

How many RAM tiles are needed for a mapping depends on the coordinates. If a both X and Y coordinates are divideable by 8, you need one tile per 8x8 pixel block. If not, you may end up needing up to 4 tiles per 8x8 pixel block. The mapping function honors adjacent RAM tiles so it's not so problematic, but still, you may reach the limit very quick. My solution would be to limit the player position to x%8==0 before the ball is shot.
Well My idea was using 32x32 pixel sprite for the player (from using 4 8x8 tiles, the term is 4x4 Mega sprite i think) but the Max i did was 24x24 (using 3 8x8 tiles = 3x3 Mega Sprite).

User avatar
Janka
Posts: 213
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: Is there any MapSprite2 limitation?

Post by Janka » Thu Mar 20, 2014 5:32 pm

That 3x3 player sprite would need 16 RAM tiles when not aligned at all. Have you properly configured the tiles count in the Makefile?

User avatar
Gosma
Posts: 67
Joined: Thu Oct 24, 2013 7:31 pm
Location: Santos, Brazil

Re: Is there any MapSprite2 limitation?

Post by Gosma » Thu Mar 20, 2014 7:50 pm

Janka wrote:That 3x3 player sprite would need 16 RAM tiles when not aligned at all. Have you properly configured the tiles count in the Makefile?
You're right! I have forgotten this detail, I've changed -DMAX_SPRITES from 14 to 17 and now i can see the legs of my player!

If you compare both screenshots 1st my player 16x16 and 2nd 32x32

Thanks a lot
Attachments
penalty_kick2.jpg
penalty_kick2.jpg (137.06 KiB) Viewed 3319 times

User avatar
Gosma
Posts: 67
Joined: Thu Oct 24, 2013 7:31 pm
Location: Santos, Brazil

Re: Is there any MapSprite2 limitation?

Post by Gosma » Thu May 29, 2014 8:04 pm

Anyone could pls help me?

I've made one tileset in gconvert with 223 unique tiles, and one spriteset also in gconvert with 86
unique tiles, so when i put both tileset/spriteset to run in Uzebox looks like some tiles/sprites do not appear.

Is it a limitation? or i am missing something :(

Thanks for anyone who could help me. :(

CunningFellow
Posts: 1190
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: Is there any MapSprite2 limitation?

Post by CunningFellow » Thu May 29, 2014 10:31 pm

Video mode 3 has 8 bit index.

That would mean 255 or 256 total tiles. Including the ram tiles you have specced.

User avatar
D3thAdd3r
Posts: 2422
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: Is there any MapSprite2 limitation?

Post by D3thAdd3r » Fri May 30, 2014 1:39 am

(256 8bit index)-(223 unique map tiles)=33 max left for ram tiles. 223 tiles seems a bit steep for the scene you have there, my guess is you could optimize it and have more wiggle room and probably look just as good. Could you post your tileset in .png format?

User avatar
uze6666
Site Admin
Posts: 4487
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: Is there any MapSprite2 limitation?

Post by uze6666 » Fri May 30, 2014 3:05 am

Can you identify what tiles are missing? Are they at the end of the tileset? What's is the symptom with sprites, they are not displayed at all or displays garbage or wrong tiles?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests