🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

Pico-8 to PixelVision8 Tips

A topic by mhughson created 64 days ago Views: 504 Replies: 2
Viewing posts 1 to 3

I recently ported some games from Pico-8 to PV8, and here are the notes I kept to help ease the conversion:

  • PV8 doesn't have +=, -=, *=, /= operators, so do a find an replace of those:
    • eg. x+=1 => x=x+1
  • PV8 doesn't have the if() function (a special version which doesn't require "then...end"), so find and replace.
    • eg. if(x==1)x=2 => if x==1 then x=2 end
  • PV8 uses "print" for logging, so find and replace "printh".
    • eg. printh("hello") => print("hello")
  • Replace core functions names:
    • _init() => Init()
    • _update[60]() => Update(deltaTime)
      • Note: PV8 update runs at 60fps so you may need to adjust logic if not using _update60
    • _draw() => Draw()
  • PV8 uses standard Lua math functions, which you access with math.*
  • Tilemap collision is checked with ReadFlag.
    • eg. fget(mget(x,y,0) => apiBridge:ReadFlagAt(x,y) == 0
  • Clearing the screen is done in 2 steps:
    • eg. cls(0) => (in init) apiBridge:ChangeBackgroundColor(0) (then in Draw) apiBridge:Clear()
  • Drawing the map is also done in 2 steps:
    • eg. map(...) => (in Init) apiBridge:RebuildScreenBuffer() (then in Draw) apiBridge:DrawScreenBuffer()
  • "Colors per sprite" should be 16, so make sure to update your systems SpriteChip:
    • Open the game then navigate to (on windows):
    • C:\Users\<user name>\AppData\LocalLow\Pixel Vision 8\Game Creator Pro\Workspace\Game\data.json
    • Inside "SpriteChip" section change "cps":16
  • Button IDs are different in PV8 from Pico-8. Here is how you need to replace the id:
ID PICO8 PV8
0 Left Up
1 Right Down
2 Up Left
3 Down Right
4 C X
5 X C
6 A ("select")
7 S ("start")

Wanted to add some clarification to the above.


Clearing the screen is done in 2 steps:

Technically you just need to set the background color one time. You can do this in the Tilemap Tool or in your Init() method. If you don't use the Screenbuffer, then you can simply clear the screen with the apiBridge:Clear() call which uses the bg color.

Drawing the map is also done in 2 steps:

In order to use the Tilemap, you need to load it into the Screenbuffer. The buffer represents a "canvas" you can use to draw pixel data into and is optimized to allow scrolling. It's similar to how the Nes's background layer works. To load the Tilemap and prep the Screenbuffer, you'll need to call apiBridge:RebuildScreenBuffer(). You only want to call this once in the Init() method or whenever you make changes to the Tilemap and need to update the display. It's a very expensive operation so use it sparingly. Once the buffer has been built, you can draw it to the screen via apiBridge:DrawScreenBuffer(). This can be used instead of apiBridge:Clear(). DrawScreenBuffer() not only clears the display but draws the contents of the buffer to the display and any missing color data is replaced with the background color.

"Colors per sprite" should be 16, so make sure to update your systems SpriteChip:

To help with people porting over Pico games, I've increased the colors per sprite value in the Sprite Tool. You can now go as high as 16 colors, you don't need to manually modify the data.json.


Eventually, I'd like to add a Pico8 console template to the Game Creator. At a high level, this template will match the colors, resolution and system specs. Down the road, I would like to add an API mapper to better handle Pico8 -> PV8 calls. This way porting won't take as long as it does now. I'll look into the math additions and other logic suggestions above when I can.

Thank you all for this tips, very important for fellow Pico8 user.