CodeWalrus

Development => Calculators => Calculator News, Coding, Help & Talk => Topic started by: Omegaxis213 on July 29, 2015, 12:47:04 PM

Title: Making a huge tilemap
Post by: Omegaxis213 on July 29, 2015, 12:47:04 PM
So if I wanted to make a huge tilemap that was around 90*90 tiles (and the tiles are 8*8 pixels big), I would have to chop it up into multiple pieces because it can't all fit into one list. I know I can create 9 appvar and constantly update the list with the correct map tiles, but how would i figure out if a player is on the edge of a appvar (when the appvar touch each other) and when to use at least two different appvar with only a chunk/line of code that i can use no matter how big the tilemap is?
Title: Re: Making a huge tilemap
Post by: Snektron on July 29, 2015, 03:38:23 PM
I guess you use Axe? How many different tiles do you have? And maybe you can make it use ram slot A with some ASM magic. Anyway maybe you could try to store it in chunks of say 16*16 or something and have some kind of lookup table to get data of the chunk at coordinates?
Title: Re: Making a huge tilemap
Post by: Omegaxis213 on July 29, 2015, 05:00:26 PM
Yes I am using Axe, but the problem that I ned help with is that if there are 2 "chunks" right next to each other how would you use the coordinates of the player to access both of the chunks if he is standing in between them because each list resets its number. Let's say if the person is standing in {L1+40} and that is the edge of the map,and you want to retrieve {L2+1} which is the other side of the map. How would i make some code that would check for the player and give the correct data to be displayed between 2 different list?
Title: Re: Making a huge tilemap
Post by: Hayleia on July 29, 2015, 05:24:56 PM
Why don't you just unarchive (or create an unarchived copy of) your appvar ? This way, you can just read and write from it without limitations.
Or even better if you don't need to write to it, read from it while it's still archived using Y0-Y9.

(And please don't say "list" for L1...L6 :P)
Title: Re: Making a huge tilemap
Post by: Omegaxis213 on July 29, 2015, 05:29:05 PM
Is there a limit to how big the appvar size is?
Title: Re: Making a huge tilemap
Post by: Hayleia on July 29, 2015, 05:31:58 PM
When reading while it's archived, no (that's the short answer, because of course you can't make an infinite sized appvar, but I meant that this is not the reading method that will restrict the size). That's what I do in Pokemon for example, the whole thing is like 50KB but since the program is the only thing that needs to be unarchived while running, everything's running with no problem :)

When reading/writing while it's unarchived, of course you're limited by your RAM :P
You can't make a 15KB appvar if you're also running a 15KB program for example (or if you have other unarchived programs in RAM). But what you can do is compile your program as an application, this way it's run from archive and saves RAM ;)
Title: Re: Making a huge tilemap
Post by: Omegaxis213 on July 29, 2015, 05:35:31 PM
Ok thanks.
Title: Re: Making a huge tilemap
Post by: Snektron on July 29, 2015, 06:39:45 PM
Quote from: Hayleia on July 29, 2015, 05:31:58 PM
When reading/writing while it's unarchived, of course you're limited by your RAM :P
You can't make a 15KB appvar if you're also running a 15KB program for example (or if you have other unarchived programs in RAM). But what you can do is compile your program as an application, this way it's run from archive and saves RAM ;)

Is it also possible to let the appvar be on the app page? though that probably required some nasty hax <_<