The recent 0.2.4 release added support for larger maps:
> Similar to gfx memory mapping, the map can now be placed at address 0x8000 and above (in increments of 0x100). This gives 4 times as much runtime space as the default map, and an additional POKE is provided to allow customisable map sizes.
Larger maps are now possible, but it's difficult to get them into memory -- the built-in map editor only works with vanilla-sized maps.
This cart is a full map editor that makes it easy to make these larger maps!
- tight iteration loop - play a level in your game, jump into the map editor to make a small tweak, and return to the game with minimal friction
- change map size at any time
- max width: 256 tiles
- max height: none
- max total size: 32K tiles (e.g. 128*256, or 32*1024)
- easy copy-paste (right mouse + drag to copy, left mouse to paste)
- zooming in/out
- large brushes - place multiple tiles at a time
- show 16x16 "room" outlines (useful for carts like celeste that are made of many 16x16 rooms)
- "transparency" - optionally treat sprite 0 in large brushes as "transparent"
- compressed maps using PX9
- the map editor uses 0 of your tokens -- it's a completely separate cart that you only use during development
(well, it costs ~300 tokens to load the map string and run the decompressor)
- your game will still be splore-compatible
- your game can call
tline()etc without any extra work
The editor currently has no undo/redo functionality. That's not ideal! I'm hoping to get it working soon.
To undo all changes since your last save (probably the end of your last session using bigmap), use the "discard changes" button in the top-right.
If you make a large mistake, replace map.p8l with your an autosaved version (inside
mygame/autosave/) and reload bigmap.
Setting the bigmap editor up takes a bit of work. This is mainly necessary to enable a tight map iteration loop, and also to work around the restrictions of pico-8 (for example, it's impossible to read a file from disk without user interaction, and asking the user to drag-and-drop their map file every time they wanted to edit is way too much friction for my tastes)
To start, make sure you have a folder (e.g.
mygame/) with your game cart inside (e.g.
cd mygame(navigate into the folder containing your game)
mkdir autosave(create a folder to store backups/autosaves)
printh("","map.p8l")(this creates an empty map.p8l file)
- Save this file (https://gist.github.com/pancelor/f933286f244c6b85b7720dbe6f809143) as
load #bigmap(note: this is different from the bigmap_demo cart)
- Uncomment the two
#includelines in the second tab (tab 1)
Paste this snippet into
_init(), or at top-level; either works)
menuitem(1,"▒ edit map",function() -- pass spritesheet through upper memory, -- avoiding an extra second of load time local focusx,focusy=0,0 memcpy(0x8000,0x0000,0x2000) poke(0x5500,1,focusx,focusy) --signal load("bigmap.p8","discard changes","mygame.p8") end)
(make sure you change "mygame.p8" to the actual filename of your game)
This snippet adds the menu option to enter bigmap while playing your game. If you set
focusy, bigmap will start focused on that map coordinate.
- Paste this snippet into
#include map.p8l #include px9_decomp.lua if map_import then map_import() end
You should now be good to go!
test+edit iteration loop
mygame.p8. any unsaved changes will be lost every time you launch bigmap. (I wish this was avoidable but I couldn't find a way around it that preserved the quick test+edit loop I wanted)
- Pause the game (with P or Enter)
- Choose "edit map"
- Edit your map!
If you accidentally press escape and exit the map editor, type
resumeinto the console to resume the map editor.
- Return to your game with P, Enter, or the clickable "Play" button in the top-right
I advise setting up
mygame.p8 to jump you to the room you were editing when it starts - this can be done by reading the
focusy global variables that are set inside the
map_import() function (inside
See my celeste mod or the getting started video for an example of how to do this.
When you press the save or play button, bigmap uses
printh to write a text file called
map.p8l into the current directory. This text file happens to be valid lua code that defines a function called
map_import(), so when
#include map.p8l and
map_import(), it runs the code generated by bigmap.
Here's an example of what map.p8l looks like:
-- this file was auto-generated by bigmap.p8 function map_import() focusx=11 focusy=12 mapw=128 maph=64 poke(0x5f56,0x80,mapw) local function vget(x,y) return @(0x8000+x+y*mapw) end local function vset(x,y,v) return poke(0x8000+x+y*mapw,v) end px9_sdecomp(0,0,vget,vset,"◝◝◝ユ◝7な◝◝✽,ゃf\0★)&るちP;](♥KねF ... many many more chars here ... X▤ミヘラ⬇️⬇️Bれん") end
This has 3 main parts:
- Set up some helpful global vars -
maphare the width and height of the map, in tiles.
focusyare the tile coordinate of the tile that was in the center of the screen when
map.p8lwas saved -- you can use this info to jump directly to that room to let you make small tweaks and test them very quickly
poke(0x5f56,0x80,mapw)-- this tells pico-8 to use mapdata stored at 0x8000, with map width
- The rest of the function uses PX9 to decompress the binary data stored in that long string. The decompressed data gets stored starting at 0x8000 and takes up
stuff I used:
- PX9, used for compression: https://www.lexaloffle.com/bbs/?tid=34058
- zep's string-packing snippet: https://www.lexaloffle.com/bbs/?tid=38692
- sprites used in bigmap_example.p8 (shown in the setup video): FROGBLOCK by Polyducks: https://polyducks.itch.io/frogblock
alternative map editors you might consider using instead:
- https://www.lexaloffle.com/bbs/?tid=42848 -- make larger worlds out of metatiles
- https://github.com/ExOK/Celeste2/ -- you can see in their source code how they make maps in individual carts and then combine+compress them all together into a single cart before release
- https://github.com/samhocevar/tiled-pico8 -- use Tiled (an external program) to edit vanilla pico-8 maps. consider combining this with the Celeste2 method
- a celeste mod I made to make sure that it felt good to use this editor: https://www.lexaloffle.com/bbs/?tid=46224
- ;) my webpage: https://pancelor.com
happy map editing!
I'd like to see what you make -- let me know if you use this in your projects! And if you want to credit me I'd appreciate it :)
Is bigmap helpful? Is it too confusing to set up? Find any bugs? Let me know what you think!
(note that you have to download the bigmap cart with
load #bigmap; the web demo playable here is just a demo to get an idea of what it's like to use the editor)
changelog for v1.2:
- clarified some things (e.g. map size limits)
- added a video guide on how to set up your project with bigmap
- the base cart I start from in the video is available to download (
- the base cart I start from in the video is available to download (
- thanks to @Peteksi for helping me fix two bugs!
- thanks to @freds72 for pointing out some issues with the compression! (now fixed)
If you've already started using bigmap, you'll want to download the latest version (
load #bigmap) and also download the updated px9_decomp.lua script
after a little bit, I got bigmap up and running on my pico-8! this is a really cool tool, and now we can make huge celeste carts like the works of taco360 due to the nonexistent map hight size! very nice!
(one note: when I had to set up the .lua file, I had to copy the code into notepad and save it as a .lua. that was confusing, as I first tried to save it as a .lua from my pico-8 and it became a .lua.p8.)
edit: I do NOT know how to use github. XD
I don't know what evercore is @SandwichBlam, but bigmap should be able to work with it -- all bigmap does is edit the map data of a cart.
you might have to do extra work to make them work nicely together, but I would think it should be the same as any other cart. follow the "setup guide" video and let me know if you have questions!
[Please log in to post a comment]