Thursday, 20 November 2008
 
  Home arrow Forum  
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome, Guest. Please login or register.
November 20, 2008, 10:29:58 AM
Username: Password:
Login with username, password and session length

Forgot your password?
Sprite Glitch... not sure what's going on.
DSLua Community
Welcome, Guest. Please login or register.
November 20, 2008, 10:29:58 AM
1723 Posts in 315 Topics by 5673 Members
Latest Member: RooneCozy
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Bugs & Suggestions  |  Sprite Glitch... not sure what's going on. « previous next »
Pages: [1]
Author Topic: Sprite Glitch... not sure what's going on.  (Read 1921 times)
sylus101
Waxing Crescent
**
Posts: 74



« on: March 23, 2007, 11:46:03 AM »

Okay folks, here's the scoop:

Awhile back, It seemed that if I'd loaded one too many framestrips, a sprite that had been loading fine before was now showing up messed up, like it was displaying part of the wrong framestrip.

I was needing to redo some things anyway, so I started over and was okay for awhile, but I think I crossed the one-too may sprite/framestrip mark again. I looks like it's the 10th defined strip.
If you look at this file, withoutnewsprite.zip just run Barbarian.lua and press A once it loads or you can walk around and the combat will happen randomly eventually. This one should look okay. It's a 4 sprite chimera, 64 x 64 each peice. If you use the stylus right to left or left to right in the grid, different sword slashes will happen, as well as some blood showing up. Smiley
At this point, thats 1 barbarian, 4 chimera peices, 2 swords, 2 blood... total of 9 sprites/framestrips. I know I can be more efficient and cut this down, but I'm laying groundwork right now and can clean up later.

I needed to start on getting the other sword slash directions working, so I added in this next test, one new sprite, one for a downward motion, or udsframe framestrip and udslash. The sprites are defined in combatmacro.lua.
withnewsprite.zip
The first bug, is that it crashed if I tried to use a 16 X 64 pixel sprite. I switched up to 32 X 64 just with extra black space, but this one causes the upper right sprite for the Chimera to start showing a bunch of the sprite parts for the character that walks around at the beginning. I have no idea why this is happening. I'm sure I can find a way to work around it, but for now it's getting pretty frustrating. To see the new sprite, just press B a few times and the frames will cycle in the upper right corner. It looks okay. I've tried not actually using Sprite.Create on the lrslash and rlslash and blood sprites until used later, but that didn't seem to help.
« Last Edit: March 25, 2007, 02:45:10 AM by sylus101 » Logged
sylus101
Waxing Crescent
**
Posts: 74



« Reply #1 on: April 04, 2007, 02:03:13 PM »

Okay, I'm double posted, but I'm certain enough time has passed  Smiley.
I'd like to know if anyone has experienced the same as me on this... because I can't seem to find any way around it.

I've narrowed this down. It's not at which number frame strip is added or sprite is created or anything that general. It's when you've loaded more then 128KB of raw sprite data. EXACTLY as far as I can tell.

I setup a test with 128KB of sprites and just loaded them on screen.
Adding one more, even a 1KB 32 X 32 single frame sprite makes the first loaded sprite glitch out, display wrong, etc. It appears that it starts to display part of the last loaded framestrip. I haven't quite got it clear what peice exactly it's showing.

I'm hoping someone can confirm or deny this. Has everyone been able to survive in game creation with only 128 KB in sprites??

Is there a way to specify a different memory bank?? I've tried setting the framestrip to nil and loading new ones, but that glitches out worse.

Is there a reverse to LoadBin? UnloadBin??

I found the FrameStrip:FreeAll() shortly after typing the above and will give that a shot...
« Last Edit: April 04, 2007, 02:18:39 PM by sylus101 » Logged
jester
First Quarter
***
Posts: 123


Jester Corp DS Logo


WWW
« Reply #2 on: April 04, 2007, 02:42:56 PM »

well yeah that 128k must explain why i guess ive been having sprite problems
Logged

CURRENT PROJECT:

JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
daltonlaffs
Waxing Gibbous
****
Posts: 340


Freaking Insane


WWW
« Reply #3 on: April 04, 2007, 03:56:04 PM »

PALib limits you to 128k of sprites per screen. There is currently nothing we can do about that, sorry.  Cry
Logged

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



^^ That works, I SWEAR! ^^
jester
First Quarter
***
Posts: 123


Jester Corp DS Logo


WWW
« Reply #4 on: April 04, 2007, 04:06:40 PM »

when daltonlaffs and others when i play the game i create their is just a messed up sprite that moves on the screen and not my image. I have tried this with 64x64 32x96 and still no luck and on all versions of DSLua but no luck any suggestions?

Also is their a way of editing the gfx2gba so i can patch my backgrounds?
Logged

CURRENT PROJECT:

JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
daltonlaffs
Waxing Gibbous
****
Posts: 340


Freaking Insane


WWW
« Reply #5 on: April 04, 2007, 05:48:00 PM »

well jester it would help if you would stop talking like this no periods or other punctuation until the end of the paragraph if you can call it that loool!

From what I can tell: Either you have way too many sprites on the same screen, or you tried to make a background out of tiles.

You can make GFX2GBA convert a .bmp to a map by adding -m to the end of your command.
Logged

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



^^ That works, I SWEAR! ^^
jester
First Quarter
***
Posts: 123


Jester Corp DS Logo


WWW
« Reply #6 on: April 04, 2007, 06:46:10 PM »

I see, thanks very much for the timely assistance on this matter.
 Grin
Logged

CURRENT PROJECT:

JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
sylus101
Waxing Crescent
**
Posts: 74



« Reply #7 on: April 04, 2007, 08:18:25 PM »

I've done so much research on this now, I'm going to need to write a tutorial. I've learned quite a bit about dominance and the correct order to create, free and recreate sprites to make them keep the correct things on top.
(I'll write something up, but you basically have to free in reverse order from creation before recreating...)

What I've found, is that it's not really what's put on screen necessarily, but what's loaded into memory.

Load slightly more than 128KB in framestrips and only create a sprite from the first one loaded, it'll screw up and display the wrong thing. Most likely it'll be a piece from the last framestrip loaded.

What this causes, though, supports daltonlaff's statement which really does end up being the end result, the ability to only display 128KB worth of sprites at any given time.

I'm still working on it's usage, but I'm finding that the right combination of freeing sprites and using FreeAll() on the framestrips to actually free up memory, is going to work out quite well. Just don't have more than 128KB in framestrips at ANY point. Even if you try to free the memory back up, it seems to permenantly skew each other framestrip that you try to load.

Thanks everyone!
« Last Edit: April 04, 2007, 08:21:11 PM by sylus101 » Logged
jester
First Quarter
***
Posts: 123


Jester Corp DS Logo


WWW
« Reply #8 on: April 05, 2007, 04:29:54 AM »

Hmm i see thanks alot sylus101!

I will definately try these methods
Logged

CURRENT PROJECT:

JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
manu62300
Waxing Crescent
**
Posts: 97



« Reply #9 on: May 16, 2007, 08:54:09 PM »

my life bar sprite 8x64 and 8x128 not accepted then i used 64x64 but 3/4 of my sprite is black ,i place  my 64x64 just a line life of 8x  and i place my life bar 3/4 out of screen lol
Logged

XtreamLua.com
La Référence en programmation sur PSP & DS
xtreamlua.miniville.fr
Bon dev...;
sylus101
Waxing Crescent
**
Posts: 74



« Reply #10 on: May 17, 2007, 11:30:46 AM »

I have no idea why, but I can't even get a 16 X 64 to work. If something is smaller and narrow, I also have to just use a lot of transparent space.

It works, but uses up unnecessary memory.  Embarrassed
Logged
Jeremysr
Waxing Gibbous
****
Posts: 254



WWW
« Reply #11 on: May 18, 2007, 01:54:10 AM »

Check this page for PAlib's (so DSLua's) sprite sizes:

http://www.palib.info/wiki/doku.php?id=day4#sprite_sizes
Logged
Pages: [1]
« previous next »
    Jump to:  



    (C) 2008 DSLua

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