TIC-80 icon indicating copy to clipboard operation
TIC-80 copied to clipboard

[PRO] Running a cartridge saved in the `.wasmp` format fails

Open Dzejkop opened this issue 2 years ago • 5 comments

Running a cartridge saved in the .wasmp format fails with the following message: underrun while parsing Wasm binary

Loading the very same game saved in the regular binary format (i.e. saved with save game.tic) works fine.

Seems like the .wasmp format doesn't contain the actual WASM binary

Dzejkop avatar Oct 08 '23 12:10 Dzejkop

It does not. This is intentional behavior. https://github.com/nesbox/TIC-80/wiki/wasm

The wasmp only exists to hold the -- script: wasm magic comment... to use wasm you need to export/save to a real cartridge file (.TIC).

You don't typically use the TIC-80 editor at all for a WASM workflow.

joshgoebel avatar Oct 08 '23 15:10 joshgoebel

But that kinda sucks for working with git. Wouldn't it make sense to serialize the binary section in hex/base64 or something?

Dzejkop avatar Oct 08 '23 17:10 Dzejkop

How so?

Your source code is NOT the wasmp file, it's the project in whatever source language you are using (which can often be MANY different source files, not one). That is what needs to be checked into git.. The "stub" wasmp file I suppose could be checked in, but would never change.

Those doing WASM workflows IMHO should check in their TIC file and keep all their assets/sprites/etc in that file instead of a text file - which makes no sense now that 99% of the content is binary. The text workflow only made sense when all the source code was textual.

joshgoebel avatar Oct 08 '23 20:10 joshgoebel

which makes no sense now that 99% of the content is binary

I've worked with the LUA text version previously and me and my collaborators had to resolve a few conflicts on this binary data. That would've been impossible (or at least more difficult) with a binary .tic file.

The code would not be in the wasmp file but the compiled WASM assembly would be. Which would allow us to share the file with other team members for testing or graphics/audio/level design work without them needing to keep the compiler toolchain at hand.

Those doing WASM workflows IMHO should check in their TIC file and keep all their assets/sprites/etc in that file instead of a text file

then what's the point of the .wasmp format in the first place? I can't use it for VCS or project work. I can't use it to share the game with others who don't have the codebase & toolchain at hand.

Dzejkop avatar Oct 08 '23 23:10 Dzejkop

had to resolve a few conflicts on this binary data.

Ah. But can't you still just use a workflow based around the wasmp just as easily (for a team)?

  1. Save all music, sprites etc to wasmp.
  2. Your "build" script is then something like:
  3. load cart.wasmp
  4. import build_binary.wasm
  5. save cart.tic
  6. run

You still don't need the WASM binary content to be inside the wasmp file...

then what's the point of the .wasmp format in the first place?

Every language has a text version... I honestly don't think it was given a lot of thought.

joshgoebel avatar Oct 09 '23 03:10 joshgoebel