choice4genesis - a ChoiceScript clone for the Sega Genesis

Talk about development tools here

Moderator: BigEvilCorporation

Post Reply
haroldoop
Very interested
Posts: 127
Joined: Sun Apr 29, 2007 10:04 pm
Location: Belo Horizonte, MG, Brazil

choice4genesis - a ChoiceScript clone for the Sega Genesis

Post by haroldoop » Mon Sep 19, 2022 9:27 pm

This is a ChoiceScript clone that generates Sega Genesis ROMs. If can be used for visual novels or simple multimedia presentations.

It takes a bunch of scripts and images and, from that, it generates SGDK-compatible .c and .res files. Those are then compiled into a Sega Genesis compatible ROM, which can be run on an emulator or even on real hardware.

The syntax of the scripts is somewhat based on ChoiceScript, but it is not exactly the same.

Please note that this is an early work and progress, and it is not as stable or user-friendly as it is planned to become.

Version 0.0.1 of the tool: https://github.com/haroldo-ok/choice4ge ... nspiler.7z
Video for version 0.0.1: https://www.youtube.com/watch?v=K9aZ-uPyhkY

Page on itch.io: https://haroldo-ok.itch.io/choice4genesis
Github repo: https://github.com/haroldo-ok/choice4genesis

It basically picks a script like this:

Code: Select all

* font "damieng.com - Hourglass font.png"
* background "Blue Hedgehog.png"
* choice
	# Play some music
		* music "Actraiser - Fillmore.vgm"
		OK, playing Fillmore, from Actraiser.
	# Show a smiley
		* image "Smiley.png", at(30, 3)
		OK... showing a smiley!
	# Third choice
		You chose the third one
		* choice
			# Yet another choice
				You chose this.
			# One more choice
				You chose that.
This is a test.
Second line.
Third line.
And turns it into a bunch of `.c` and `.res` files, ready for SGDK compilation:

"generated_scripts.c", generated from the script above:

Code: Select all

#include "vn_engine.h"
void *VS_startup() {
	VN_font(&damieng_com_Hourglass_font_png);
	VN_background(&Blue_Hedgehog_png);
	{
		VN_flushText();
		VN_option(1, "Play some music");
		VN_option(2, "Show a smiley");
		VN_option(3, "Third choice");
		switch (VN_choice()) {
		case 1:
			VN_music(Actraiser_Fillmore_vgm);
		VN_text("OK, playing Fillmore, from Actraiser.");
			break;
		case 2:
			VN_imageAt(30, 3);
		VN_image(&Smiley_png);
		VN_text("OK... showing a smiley!");
			break;
		case 3:
			VN_text("You chose the third one");
		{
			VN_flushText();
			VN_option(1, "Yet another choice");
			VN_option(2, "One more choice");
			switch (VN_choice()) {
			case 1:
				VN_text("You chose this.");
				break;
			case 2:
				VN_text("You chose that.");
				break;
			}
			VN_flushText();
		}
			break;
		}
		VN_flushText();
	}
	VN_text("This is a test.");
	VN_text("Second line.");
	VN_text("Third line.");
	VN_flushText();
	return VS_startup;
}
"gfx.res", generated from the script above:

Code: Select all

IMAGE damieng_com_Hourglass_font_png "../project/damieng.com - Hourglass font.png" APLIB NONE
IMAGE Blue_Hedgehog_png "../project/Blue Hedgehog.png" APLIB ALL
IMAGE Smiley_png "../project/Smiley.png" APLIB ALL
"music.res", generated from the script above:

Code: Select all

XGM Actraiser_Fillmore_vgm "../project/Actraiser - Fillmore.vgm" APLIB
Attachments
rom_001.png
Demo screenshot
rom_001.png (47.93 KiB) Viewed 185 times
rom_000.png
Demo screenshot
rom_000.png (45.92 KiB) Viewed 185 times
choice4genesis - v0.0.1 - small example.bin.zip
Demo ROM
(58.64 KiB) Downloaded 1 time

haroldoop
Very interested
Posts: 127
Joined: Sun Apr 29, 2007 10:04 pm
Location: Belo Horizonte, MG, Brazil

Version 0.1.0 is now available!

Post by haroldoop » Tue Sep 20, 2022 10:48 pm

Version 0.1.0 has been released.

It implements the following commands:
  • sound: plays a digitized sound effect;
  • stop: stops playing the music and/or the sound effects.
Video for the new version: https://www.youtube.com/watch?v=7FcPD8N6r9I
Transpiler for version 0.1.0: https://github.com/haroldo-ok/choice4ge ... nspiler.7z
Attachments
choice4genesis.-.v0.1.0.-.small.example.bin.zip
Demo ROM for version 0.1.0
(59.54 KiB) Downloaded 1 time

Chilly Willy
Very interested
Posts: 2913
Joined: Fri Aug 17, 2007 9:33 pm

Re: choice4genesis - a ChoiceScript clone for the Sega Genesis

Post by Chilly Willy » Tue Sep 20, 2022 11:14 pm

Pretty cool. Should get really cool as you get more commands working.

haroldoop
Very interested
Posts: 127
Joined: Sun Apr 29, 2007 10:04 pm
Location: Belo Horizonte, MG, Brazil

Version 0.2.0 is now available!

Post by haroldoop » Fri Sep 23, 2022 12:04 am

Hello, again!

This is version 0.2.0; it introduces variables and conditionals:
  • Commands create, temp and set implemented, in order to allow string creation/manipulation
  • Implemented expression support;
  • Commands if, elseif and else implemented, in order to allow conditional execution
Transpiler for version 0.2.0: https://github.com/haroldo-ok/choice4ge ... nspiler.7z
Small demo ROM for version 0.2.0: https://github.com/haroldo-ok/choice4ge ... xample.bin

Example script:

Code: Select all

* font "damieng.com - Hourglass font.png"
* background "Blue Hedgehog.png"

* create intVar, 1
* create boolVar, true
* temp localInt, 2

* set intVar, 3
* set localInt, intVar + 3

* create playingMusic, false

* choice
	* if playingMusic
		# Stop the music
			* stop music, sound
			OK, music is stopped.
			* set playingMusic, false
	* elseif FALSE
		This should not appear
		This should not play
		* music "Actraiser - Fillmore.vgm"
	* else
		# Play some music
			* music "Actraiser - Fillmore.vgm"
			OK, playing Fillmore, from Actraiser.
			* set playingMusic, true
		
	# Play a voice
		* sound "ready.wav"
		OK, playing a digital voice.
	# Show a smiley
		* image "Smiley.png", at(30, 3)
		OK... showing a smiley!
	# Fourth choice
		You chose the last one
		* choice
			# Yet another choice
				You chose this.
			# One more choice
				You chose that.
This is a test.
Second line.
Third line.

haroldoop
Very interested
Posts: 127
Joined: Sun Apr 29, 2007 10:04 pm
Location: Belo Horizonte, MG, Brazil

Version 0.3.0 is now available!

Post by haroldoop » Fri Sep 23, 2022 11:05 pm

Version 0.3.0 has been released. It adds the "goto_scene" command; with that, it will be possible to use more than one source script on the project.

Transpiler for version 0.3.0: https://github.com/haroldo-ok/choice4ge ... nspiler.7z
Small demo ROM: https://github.com/haroldo-ok/choice4ge ... nspiler.7z

haroldoop
Very interested
Posts: 127
Joined: Sun Apr 29, 2007 10:04 pm
Location: Belo Horizonte, MG, Brazil

Version 0.4.0 is now available!

Post by haroldoop » Mon Sep 26, 2022 12:07 am

Version 0.4.0 has been released.

This version adds a few improvements on the command line tool:

- It is now possible to choose which project to compile;
- The command line tool can now invoke the SGDK compiler to convert the generated .c and .res files into ROMs;
- The command line tool can now call the emulator after compiling;
- It is now possible to call a command line menu to compile the projects interactively.

Transpiler for version 0.4.0: https://github.com/haroldo-ok/choice4ge ... nspiler.7z
Demo ROM: https://github.com/haroldo-ok/choice4ge ... mo.rom.bin
Standalone distribution for version 0.4.0: https://github.com/haroldo-ok/choice4ge ... ndalone.7z
(The standalone distribution includes everything needed to execute the application: it includes the 0.4.0 version of the transpiler, plus Java 8, SGDK and Node.js)

Post Reply