demo cart
This demo shows off the interface. To use bigmap in your game, see "setup" below.
motivation
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!
features
- 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
- autosaving
- 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
map()
,mget()
,tline()
etc without any extra work
undo/redo?
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.
setup
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. mygame/mygame.p8
)
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
px9_decomp.lua
(inside themygame/
directory) load #bigmap
(note: this is different from the bigmap_demo cart)- Uncomment the two
#include
lines in the second tab (tab 1) save bigmap.p8
-
Paste this snippet into
mygame.p8
: (inside_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
focusx
andfocusy
, bigmap will start focused on that map coordinate. - Paste this snippet into
mygame.p8
at top-level:#include map.p8l #include px9_decomp.lua if map_import then map_import() end
- Save
mygame.p8
You should now be good to go!
test+edit iteration loop
- Save
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) - Run
mygame.p8
- Pause the game (with P or Enter)
- Choose "edit map"
- Edit your map!
If you accidentally press escape and exit the map editor, typer
orresume
into the console to resume the map editor. - Return to your game with P, Enter, or the clickable "Play" button in the top-right
![](/media/27691/iterloop.gif)
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 focusx
and focusy
global variables that are set inside the map_import()
function (inside map.p8l
)
See my celeste mod or the getting started video for an example of how to do this.
technical details
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 mygame.p8
executes #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 -
mapw
andmaph
are the width and height of the map, in tiles.focusx
andfocusy
are the tile coordinate of the tile that was in the center of the screen whenmap.p8l
was 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 widthmapw
- 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
mapw*maph
bytes.
That compressed data string is created using PX9 and this snippet for encoding binary data in strings.
links
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
other:
- 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!
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/53345/140_cattejacrt.gif)
wait- how do I play it????
this is sick
EDIT: I mean- play the levels I made? how do I?
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/27691/dinnerwashingatsunset.gif)
@SandwichBlam @GeKStudios I tried to explain it under the "usage guide" section -- is there a specific part about it that's confusing?
(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)
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/27691/dinnerwashingatsunset.gif)
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 (
load #bigmap_example
)
- 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
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/53345/140_cattejacrt.gif)
Hallo pancelor!
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
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/53345/140_cattejacrt.gif)
can this be used with an Evercore celeste file? as in, setting the level width, height, x, and y, and it would work?
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/27691/dinnerwashingatsunset.gif)
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!
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/53345/140_cattejacrt.gif)
Evercore is like a sort of bigger map addition to celeste classic.
If you've played Fault, those scrolling levels are what evercore adds you have to specify the level height, width, x, and y. so, I'm not sure if that would work with an external map editor...
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/bimg/pi/pi5.png)
It doesn't work for me, when i try running my game or bigmap i get the "could not #include file: px9_decomp.lua"
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/27691/dinnerwashingatsunset.gif)
@Redstoner158 sounds like you didn't save the file from step 4 to the right place, or maybe you saved it with the wrong name. what does your filesystem look like -- what does ls
output when you're in the mygame directory?
![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/media/82211/7_realshadowcaster.png)
@pancelor, could you allow map height up to 32768\W instead of 256 ?
I'd like to work with W=16 and H=2048 personally.
[Please log in to post a comment]