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?



1

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


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?


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

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.


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


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?


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.


Good point!



[Please log in to post a comment]