Log In  

Here comes another newbie question:

If I've got a map of 32*48 tiles (taller than wide), how should I handle the map data in order to print it directly with map() function?

I saw that map can be extended to 64 tiles (height) if you use 0x1000 - 0x2000 memory, but I don't know how to tell the map function to use this extra space.

Searching some post I've read that implementing some kind of map data streaming with peek and poke is a good a idea. Is there some resources, carts or tutorial that can helps me?

P#86571 2021-01-19 08:24

map() by defualt doesn't use the bottom half I think?
but if you fill in the width and height (celw and celh in the wiki page; https://pico-8.fandom.com/wiki/Map )
it would draw it.
Not sure if that's what your asking though

P#86572 2021-01-19 08:34

Yeah, you're right. I was only cleaning memory region from 0x2000 - 0x3000 and for that reason it wasn't work.

Anyway if I were in the need of having to use only 128x32 map area, how could I implement th streaming of map data from somewhere in memory to 0x2000 - 0x3000 before drawing?

P#86577 2021-01-19 11:27

map data can be written via mset or poke/memcpy.
how you generate the map is ‘game specific’:

  • procedural generation
  • fixed string in code
  • multicart maybe
P#86578 2021-01-19 12:26 ( Edited 2021-01-19 12:28)

Yes, but suppose that you procedurally generate a 128x64 map but don't want to use 0x1000-0x2000 region. How would you proceed?

I think that some kind of map data streaming to 0x2000-0x3000 is needed.

P#86579 2021-01-19 12:45 ( Edited 2021-01-19 12:46)

pico has 2mb of lua memory to use!
you can procgen the map in memory and write to ‘cart’ memory as needed.

P#86580 2021-01-19 14:19

Oh, that's the trick! Generating map in LUA table and write it to memory on demand.

So... How do I need to synchronize camera with the region of the map it's supossed to show in screen? Do you know a cart that does this?

P#86581 2021-01-19 15:02 ( Edited 2021-01-19 15:03)

They work together but do different things:

'map' is used to bring a region of map memory onto the screen. The top-left corner of your map goes to coordinates 0,0. The parameters to 'map' change when the level changes, not for scrolling.

'camera' lets you scroll the visible part of the screen, so that the top-left corner of the screen moves from 0,0.

P#86583 2021-01-19 15:47

Good point!

P#86584 2021-01-19 15:54

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-20 13:26:21 | 0.015s | Q:20