Bitsy-Converter: convert Bitsy Scripts into Arduino source files

Hello,

I am currently developing a tool named Bitsy-Converter; it is capable of converting Bitsy scripts into various output formats; currently it can convert those scripts into either a JSON file or an Arduboy source file.

Currently, the Arduboy conversion is still a work in progress, and the exported file will simply display the full tileset on the background, but if everything goes well, it will soon be able to generate a fully playable game.

4 Likes

That would be awesome! Curious how text would work since the Arduboy’s memory is so limited. If you work outside of the Arduboy 2 library, it should be very possible to make something that could work well with the space available.

Do you mean text to be displayed?

Or are you thinking the Bitsy script would somehow be kept in progmem and interpreted?

My plans at the moment would be to transform the images and levels into constants, and turn the scripts into functions.

Would this cause any problems?

Would there be a more efficient way to organize the generated code for the Arduboy hardware?

The answer to both of these questions depends on what operations Bitsy expects to be possible.

I’ve never been able to find any documentation for Bitsy (and I’ve never been interested enough to dig through the source code), so I don’t really know how much it’s capable of beyond being a basic tile engine.

Assuming it behaves like any other scripting language and it doesn’t expect dynamic typing then generating C++ code seems logical.

The most obvious difficulty is the difference between Bitsy’s ‘spec’ and the Arduboy’s spec.
I.e.

  • The Arduboy’s screen is monochrome, Bitsy supports colour
    • At least 4 colours as far as I’m aware, but it could be more*
  • Bitsy maps appear to be larger than the Arduboy’s screen

* The documentation claims 3, but it doesn’t appear to be counting the colours used in the text box:
Screen-SpriteEdit1

Bitsy uses a 16x16 room map, and each of the map tiles is 8x8 pixels; as a result, the overall resolution is 128x128 pixels; this means that, in order to fit in the Arduino screen, the screen will have to scroll vertically.

As for the colors, each tile is individually monochromatic, but, for each room, it is possible to choose one palette color for the background, plus one for the tile foreground and one for the sprite foreground; in order to work on the arduboy, simply ignoring the palette colors should be enough for most cases.

So, basically, the graphics won’t probably cause much trouble; converting the scripting part will probably pose the greatest challenge.

1 Like

Merry Christmas, everyone; :christmas_tree:

Version 0.3.0 has been released.

Now, the code generated by the converter can display the first room on an Arduboy.

Ah, that makes sense.

(I only skimmed the tutorial. Most of the time I don’t really have the patience for tutorials, I prefer documentation.)

I have some experience with developing scripting languages,
but I don’t really know enough about Bitsy’s scripting format to be able to make any useful suggestions.

(Again, I really wish it had some decent technical documentations instead of just tutorials about the frontend.)

1 Like

I had used a piece of Bitsy’s own source code to make the converter capable of turning the script into an AST-like structure, and its scripting language seems pretty simple; at this point, it seems to have mostly become a code generation problem.

Version 0.4.0 is now available.

It now displays the sprites.

Also, it has been migrated to use the Arduboy2 library.

2 Likes

Hello, again!

Version 0.5.0 is now available.

  • Player can now move around in the first room, but collision checking and interactions have not been implemented, yet;
  • Verticall scrolling is now working; now it is possible to walk around the entire room.
1 Like

Version 0.6.0 has been released:

  • Player now collides with the background;
  • Player can interact with sprites;
  • Only very simple dialogs are supported; no variables, nor conditionals.

Version 0.7.0 is now released:

  • Take into consideration whether a backgroud tile is solid or not when checking for collision;
  • Tile animation is now working;
  • Dialog strings are now stored on flash memory.
1 Like

Version 0.8.0 has been released:

  • Exits are now functional;
  • Corrected a few bugs related to PROGMEM.

At this point, the generated game is pretty much functional; what’s left to do is to implement the title screen and ending routines, and implement more complex dialog functionality.

2 Likes

Hello, again!

Version 0.9.0 is now available:

  • Title screen is now functional;
  • Support for endings has also been implemented.

Version 0.9.1 has been released; no new implementations, just refactoring in preparation for new features.

Version 0.10.0 has been now released!

It is now capable of generating SDCC + LibCV source files; this can be used to generate ROMs for either:

  • ColecoVision;
  • SG-1000;
  • Sega Master System (for now, only SG-1000 mode is supported);
  • MSX.

The code generated for SDCC + LibCV can either be compiled with SDCC, or with 8bitworkshop.com (which has an online compiler).