| |||
Views: 88,484,519 |
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search | 04-26-24 01:56 AM |
|
Guest: Register | Login |
0 users currently in The Landfill | 2 guests |
Main - The Landfill - Optimizing Tilemaps Around SNES Space Limitations | New thread | Thread closed |
cory21391 |
| ||
Flurry Level: 37 Posts: 255/260 EXP: 331857 Next: 6396 Since: 03-01-07 From: NC, US Last post: 5128 days Last view: 5128 days |
I'm done setting up all of my graphics related subroutines (as far as Background/Sprite Graphics goes, anyways) and when I set up my template for tilesets (using Lunar Magic's 128 tile 4bpp sets) I realized something....
In my engine, I use a separate bank each for background tiledata, tilemaps, palettes, and sprite tiledata. And that's when I noticed it. Space limitations. I'm using a slowrom lorom with 256 KB of space. each bank being 32,768 bytes leaves my tiledata bank big enough to hold 8 full 128 tile 4 bpp tilemaps (or 7 full 4bpp and 2 full 2bpp, which is what i was thinking of using.) Now this isn't too bad, I'm only using 5 banks (bank 0-code, 1-palettes, 2-tiledata, 3-tilemaps, and 4-sprites) leaving 3 free. Even if I say, save 2 more banks for code, that leaves an extra for tiledata, meaning I can now have 15 full 4bpp and 2 full 2bpp, which in turn is a decent amount of unigue tilesets, plus I can always reuse stuff here and there and whatnot. 1 bank for palettes is plenty, I don't kno spc programming (no sound) and I haven't gotten around to implementing HDMA yet, so no need for HDMA table storage (yet.) All of this leads to my question about tilemaps regarding the space they take up. A full 32x32 tile screen's tilemap is 4 KILOBYTES in size. 1 64x64 screen would then be 16 KILOBYTES I can only store 8 32x32 tilemaps in a bank. How in the hell do games like SMW with 20 or so screens (horizontally, mind you, 40 or so + including the upper screens) per level manage to store all of this data?!?! Also to note that I know nothing about ROM configuration (I know you can expand it, but I don't know how or what that effects in terms of addressing or anything.) Suggestions for how to drastically cut down tilemap space? ____________________ |
paulguy |
| ||||||||||
Flurry Level: 37 Posts: 230/258 EXP: 326969 Next: 11284 Since: 04-10-07 From: Buffalo, NY Last post: 5027 days Last view: 4568 days |
|
Kawa |
| ||
CHIKKN NI A BAAZZKIT!!! 80's Cheerilee is best pony Level: 138 Posts: 3430/5344 EXP: 30943947 Next: 719034 Since: 02-20-07 From: The Netherlands Last post: 4498 days Last view: 2633 days |
Your understanding is spot on. ____________________ Wife make lunch - Shampoo Opera - give it a spin Spare some of your free time? <GreyMaria> I walked around the Lake so many goddamn times that my sex drive was brutally murdered Kawa rocks — byuu |
MathOnNapkins |
| ||
Super Koopa Level: 62 Posts: 757/842 EXP: 1935451 Next: 49235 Since: 02-19-07 From: durff Last post: 4488 days Last view: 4011 days |
If you really need to store full tilemaps or larger collections of tilemap you could also consider a compression format if objects aren't appropriate for your design. ____________________ Zelda Hacking Forum hobbies: delectatio morosa |
cory21391 |
| |||
Flurry Level: 37 Posts: 256/260 EXP: 331857 Next: 6396 Since: 03-01-07 From: NC, US Last post: 5128 days Last view: 5128 days |
I've taken a look at Lunar Magic to see what the average difference would be and WOW. my first level in Super Mario Journey is 16 screens, with each "screen" being 2 vertically stacked 32x32 screens, that would be a staggering 32,768 tiles, or 65,536 bytes of tilemap data! However when I selected all the FG object tiles, there were only 3116 tiles in the level, or 6,232 bytes of tilemap data. HUGE difference. So I decided to make a simple macro to read values from an object table to a tilemap copy in WRAM and then DMA that to VRAM. After creating the macro, however, and setting up a simple test table with only 1 tilemap entry, it won't compile for some reason. WLA seems to spit out errors that aren't all that helpful, so I thought maybe someone here could help me out with finding what the problem is.
The error message simply says: INPUT_NUMBER: Out of 16bit range ERROR: Couldn't parse "sta" the table is in format: table 1: .dw [tilemap address] .db [tilemap entry low byte] .db [tilemap entry high byte] tilemap WRAM copy is $800 bytes from $7e:2221-$7e:2A21 tilemap in VRAM is $1000 words from $0000-$0FFF (64x64 screen) the code: (8 bit A, 16 bit X/Y)
( table is in the main code section, bank 0)
EDIT: To make sure it wasn't a macro problem (like parameters), or length of address problem (like $7e2221) I tried the following code:
The compiler error this time was: FIX_REFERENCES: Value ($8458) of "Table_1" is too much to be a 8bit value. This is even more baffling than the previous error..... NOWHERE in my table is there anything remotely close to being $8458, and all my data types are in bytes (.db) in my table...... Any guesses as to what might be the problem? ____________________ |
cory21391 |
| ||
Flurry Level: 37 Posts: 259/260 EXP: 331857 Next: 6396 Since: 03-01-07 From: NC, US Last post: 5128 days Last view: 5128 days |
I think I've narrowed the problem down. When I tried the code:
The compiler gave the same error as before, FIX_REFERENCES value ($8454) of "Table_1" is too much to be an 8 bit value. BUT, when I tried a hex address rather than a label, it worked.
This can only lead me to believe that I'm doing something wrong in relation to addressing my table using labels and .db/.dw/.dl Such a simple concept causing all these problems.... ____________________ |
Aaendi |
| ||
Red Koopa Level: 27 Posts: 78/131 EXP: 109187 Next: 6972 Since: 10-18-09 Last post: 4670 days Last view: 4330 days |
I don't know what your using, but I use Xkas and I write "org $008000" before my code, or else it doesn't find labels properly. |
cory21391 |
| ||
Flurry Level: 37 Posts: 260/260 EXP: 331857 Next: 6396 Since: 03-01-07 From: NC, US Last post: 5128 days Last view: 5128 days |
I'm using WLA, I'm assuming org $008000 is similar to the WLA code, .ORG XX, which sets SNES cart slot or something like that...
My full code (after taking out everything unrelated to this table problem):
Get the error: FIX_REFERENCES: Value ($830F) of "TABLE1" is too much to be a 8 bit value. This is very confusing, I'm using .db, there is no $830F in my table anywhere, even if there is word values in my table, the Accumulator is 8 bit and should just read 1 byte of it.... Thinking it was a problem with loading into A, supposedly being larger than 8 bits, I changed it to ldx TABLE1, AND GET THE SAME ERROR. If anyone knows what could be wrong I'd really appreciate some help on this because logically to me, it should work perfectly, and I need tables not just to save rom space with tilemaps, but I'm quite sure I'll need them later on when I'm actually putting together game code.... Here's the full source if anyone wants to take a look. EDIT: To clarify about labels not working correctly: Labels work fine with direct addressing (like in my dma macros, loading the register with the argument)) ex. lda #LABEL sta $4302 The problem is absolute addressing (loading by using the argument as an offset address and loading from said offset) ex. lda LABEL sta $7e0000 ____________________ |
dieudunet |
| ||
Newcomer Level: 3 Posts: 1/1 EXP: 69 Next: 59 Since: 01-19-11 Last post: 4845 days Last view: 4845 days |
Hello,
the WLA Compiler is a little weird it seems. try loading your Table_1 using lda.w Table_1,x It works for me |
Kawa |
| ||
CHIKKN NI A BAAZZKIT!!! 80's Cheerilee is best pony Level: 138 Posts: 4404/5344 EXP: 30943947 Next: 719034 Since: 02-20-07 From: The Netherlands Last post: 4498 days Last view: 2633 days |
Hello dieudunet.
Thank you for making such an informative post. However, I must ask you to watch the time stamps (noted at the top of each post) to try not to post in threads that are several months old. You may notice that Cory's post was from April 2010. It is now January 2011. Please be more careful in the future. And yeah WLA is kinda strange. ____________________ Wife make lunch - Shampoo Opera - give it a spin Spare some of your free time? <GreyMaria> I walked around the Lake so many goddamn times that my sex drive was brutally murdered Kawa rocks — byuu |
Main - The Landfill - Optimizing Tilemaps Around SNES Space Limitations | New thread | Thread closed |
© 2005-2023 Acmlm, blackhole89, Xkeeper et al. |
MySQL - queries: 73, rows: 91/93, time: 0.014 seconds. |