Page 1 of 3

choice4genesis - a ChoiceScript clone for the Sega Genesis

Posted: Mon Sep 19, 2022 9:27 pm
by haroldoop
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

Version 0.1.0 is now available!

Posted: Tue Sep 20, 2022 10:48 pm
by haroldoop
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

Re: choice4genesis - a ChoiceScript clone for the Sega Genesis

Posted: Tue Sep 20, 2022 11:14 pm
by Chilly Willy
Pretty cool. Should get really cool as you get more commands working.

Version 0.2.0 is now available!

Posted: Fri Sep 23, 2022 12:04 am
by haroldoop
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.

Version 0.3.0 is now available!

Posted: Fri Sep 23, 2022 11:05 pm
by haroldoop
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

Version 0.4.0 is now available!

Posted: Mon Sep 26, 2022 12:07 am
by haroldoop
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)

Version 0.5.0 is now available!

Posted: Wed Sep 28, 2022 12:01 am
by haroldoop
This version (0.5.0) adds support for string interpolation.

Now it is possible to use print a numeric variable in the middle of a text line by using ${expression}.

Transpiler for version 0.5.0: https://github.com/haroldo-ok/choice4ge ... ndalone.7z
Example ROM: https://github.com/haroldo-ok/choice4ge ... mo.rom.bin
Standalone distribution for version 0.5.0: https://github.com/haroldo-ok/choice4ge ... ndalone.7z

Version 0.6.0 is now available!

Posted: Sun Oct 02, 2022 7:17 pm
by haroldoop
Hello, again!

This version adds the `window`, `flush` and `clear` commands:
  • window: allows to change the location of the text window;
  • flush: immediately displays the contents of the text buffer on the text window; it may or may not wait for a button press;
  • clear: clears a layer/region of the screen.

Re: choice4genesis - a ChoiceScript clone for the Sega Genesis

Posted: Mon Oct 03, 2022 1:29 am
by AmateurSegaDev
Oh wow, this is great! Can't wait to see this get some traction in the community.

Version 0.7.0 is now available!

Posted: Wed Oct 05, 2022 9:56 pm
by haroldoop
Hello, again!

Version 0.7.0 adds the `title`, `author` and `while` commands:
  • `title` and `author` are used for populating the ROM header;
  • `while` allows to keep repeating a block of code while a given condition is true.

Version 0.8.0 is now available!

Posted: Sun Oct 09, 2022 8:05 pm
by haroldoop
Version 0.8.0 allows customizing the cursor and allows to selecting the target layer for the " image" command:
  • Flags were added to the image command, in order to allow choosing if the image will be drawn in the foreground or in the background layer;
  • Implemented the cursor command, in order to allow customizing the cursor.
Transpiler for version 0.8.0: https://github.com/haroldo-ok/choice4ge ... nspiler.7z
Simple example ROM: https://github.com/haroldo-ok/choice4ge ... mo.rom.bin
Standalone distribution for version 0.8.0: https://github.com/haroldo-ok/choice4ge ... ndalone.7z

Video for version 0.8.0:
https://www.youtube.com/watch?v=6FWoKh520f0

Improved documentation

Posted: Wed Oct 12, 2022 11:53 pm
by haroldoop
No new version this time, just improvements to the documentation.
The improved documentation can be seen at: https://github.com/haroldo-ok/choice4ge ... /README.md

Version 0.9.0 is now available!

Posted: Tue Oct 25, 2022 10:33 pm
by haroldoop
This version implements automatic word wrapping for the text boxes.

Standalone distribution for 0.9.0: https://github.com/haroldo-ok/choice4ge ... ndalone.7z
Transpiler only for 0.9.0: https://github.com/haroldo-ok/choice4ge ... nspiler.7z
Demo ROM for 0.9.0: https://github.com/haroldo-ok/choice4ge ... nspiler.7z

Version 0.10.0 is now available!

Posted: Wed Nov 02, 2022 7:44 pm
by haroldoop
Hello, again!

Version 0.10.0 has been released.

This version adds the required implementations do allow the use of native `C` functions:
  • Implemented support for using .c, .h and .res on the project:
    • Before the transpilation, the required target dirs are automatically created, if they don't exist;
    • Before the transpilation, the contents of the base/ folder are copied to the src/ and res/ folders are copied to the project's corresponding folders; this means that the base libraries and base resources don't need to be added to the project during its creation;
    • Before the transpilation, if the project/ folder inside the project contains child src/ and/or res/ subfolders, those will be copied unmodified to the target src/ and res/ folders.
  • Implemented new commands enable the use of native C functions on the project:
    • import: imports the given .h file into the generated code;
    • native: directly calls a C language function.
Standalone distribution for 0.10.0: https://github.com/haroldo-ok/choice4ge ... ndalone.7z
Transpiler only: https://github.com/haroldo-ok/choice4ge ... nspiler.7z
Demo ROM for 0.10.0: https://github.com/haroldo-ok/choice4ge ... mo.rom.bin

Version 0.11.0 is now available!

Posted: Mon Nov 07, 2022 9:46 pm
by haroldoop
Version 0.11.0 automatically converts the images to 16 colors, if needed.

Standalone distribution: https://github.com/haroldo-ok/choice4ge ... ndalone.7z
Transpiler only: https://github.com/haroldo-ok/choice4ge ... nspiler.7z