MuCho CYOA/gamebook/multiple choise adventure engine, release 3 - little to no programming needed

Download the whole kit (win32 binaries) here:

http://iki.fi/sol/zip/mucho_03.zip

Or if you just want to peek at the documentation and prebuilt examples, go here:

http://sol.gfxile.net/mucho/

Sources available at github:

https://github.com/jarikomppa/speccy/tree/master/mucho

Changes since previous release:
- Much improved compression of text
- $P statements for adding empty lines in text
- BeepFX removed from engine itself
- $C statements for running custom code
- BeepFX added as custom code option
- go: and gosub: commands
- numeric variables with +,-,= to modify and <,<=,==,!=,>=,> to compare
- numeric variable printing inside text by using <<syntax>>
- A lot of refactoring
- Fixed an embarrassing amount of bugs
- Reduced max symbols to 1024
- Option selector no longer blinks (as much) and has a proportional "scroll bar" showing how many options are available
- new example: blackjack, demonstrating using numeric variables
- new example: waiting for the light, actual gamebook by Kieran Coghlan, used with permission
- More documentation, now over 50 pages in pdf form. (html, mobi, epub also available)

...and NOW I'll leave it alone unless bugs are found or someone actually starts using it.
http://iki.fi/sol | http://iki.fi/sol/speccy/ | https://github.com/jarikomppa/speccy
http://goo.gl/q2j0NZ - make ZX Spectrum choose your own adventure games, no programming needed (release 3)

Comments


  • I can fix some of the procedures of your source? they are not elegant
    [Stronghold] [l'Abbaye des Morts] [Stronghold2 WiP (30%) defrosen]
  • Jerri wrote: »
    I can fix some of the procedures of your source? they are not elegant
    Well, thanks?

    Anyway, it's all unlicensed, so feel free to do whatever you want.
    http://iki.fi/sol | http://iki.fi/sol/speccy/ | https://github.com/jarikomppa/speccy
    http://goo.gl/q2j0NZ - make ZX Spectrum choose your own adventure games, no programming needed (release 3)
  • void readkeyboard()
    {
        __asm
            ld bc, #0xfefe
            in a, (c)
            ld (#_keydata+0), a
            ld bc, #0xfdfe
            in a, (c)
            ld (#_keydata+1), a
            ld bc, #0xfbfe
            in a, (c)
            ld (#_keydata+2), a
            ld bc, #0xf7fe
            in a, (c)
            ld (#_keydata+3), a
            ld bc, #0xeffe
            in a, (c)
            ld (#_keydata+4), a
            ld bc, #0xdffe
            in a, (c)
            ld (#_keydata+5), a
            ld bc, #0xbffe
            in a, (c)
            ld (#_keydata+6), a
            ld bc, #0x7ffe
            in a, (c)
            ld (#_keydata+7), a
            ld bc, #31 ; kempston
            in a, (c) 
            ld (#_keydata+8), a
        __endasm;
    }
    

    must be rewritten to
    void readkeyboard()
    {
        __asm
    	ld 	a,#0xfe
    
    	ld 	c,a
    	ld 	hl,#_keydata
    
    	ld 	b,a
    	ini
    	rlca
    	ld 	b,a
    	ini
    	rlca
    	ld 	b,a
    	ini
    	rlca
    	ld 	b,a
    	ini
    	rlca
    	ld 	b,a
    	ini
    	rlca
    	ld 	b,a
    	ini
    	rlca
    	ld 	b,a
    	ini
    	rlca
    	ld 	b,a
    	ini
            ld bc, #31 ; kempston
            ini
    
        __endasm;
    }
    
    [Stronghold] [l'Abbaye des Morts] [Stronghold2 WiP (30%) defrosen]
  • Cool, I didn't know about ini.
    http://iki.fi/sol | http://iki.fi/sol/speccy/ | https://github.com/jarikomppa/speccy
    http://goo.gl/q2j0NZ - make ZX Spectrum choose your own adventure games, no programming needed (release 3)
  • edited November 2016
    This is what I use as my keyboard driver readKeyboard routine
    ; TOP ROW IS ROW 1
    KEYBUF				; START @	#FEFE	#7FFE
    		DEFB #FF	; ROW4		LEFT	RIGHT
    		DEFB #FF	; ROW3		LEFT	RIGHT
    		DEFB #FF	; ROW2		LEFT	RIGHT
    		DEFB #FF	; ROW1		LEFT	RIGHT
    		DEFB #FF	; ROW1		RIGHT	LEFT
    		DEFB #FF	; ROW2		RIGHT	LEFT
    		DEFB #FF	; ROW3		RIGHT	LEFT
    		DEFB #FF	; ROW4		RIGHT	LEFT
    
    ReadKeyboard
    		LD DE,KEYBUF
    		LD BC,#FEFE
    KeyboardLoop
    		IN A,(C)
    		OR #E0			;Set Bits765
    		LD (DE),A
    		INC DE
    		RLC B
    		JP C,KeyboardLoop
    RET
    

    You can easily change row save/read order, by changing
    		LD BC,#FEFE
    with
    		LD BC,#7FFE
    
    and
    		RLC B
    with
    		RRC B
    

    See Notes on top.

    Makes for a nice compact block, but has the extra weight of the loop jump.

    It can also be entered at instruction 2 (readKeyboard addr +3), in order to save keyboard state elsewhere, by using DE as new target memory, which can be useful in some situations.

    NOTE: Some optimizations can be made, like:
    - INC E (if buffer is not split by a 256 boundary)
    - use HL instead of DE and use INI
    - Loop unrolling, etc...
    But I wanted it to be compact and generic to fit anywhere in memory.
    Post edited by RMartins on
  • Hello Sol_HSA,

    I find your MuCho CYOA Adventure Engine very interesting. In fact, I was planning to use it for a personal project (obviously giving you credit for this tool)

    I have one question though: Since the personal project will be written in Spanish, I will need to use accented bowels (like á, é, í, ó, ú, Á, É, Í, Ó, Ú) and the ñ and Ñ characters. Is it possible to do this with your program without modifications to the main program?

    Thanks in advance for your help.
  • ld bc, #31 ; kempston

    Most confusing notation ever. Can't tell this is in fact a decimal value without looking at the above code, where the hex values are prefixed with '#0x'
  • edited November 2016
    Kozelek wrote: »
    Hello Sol_HSA,

    I find your MuCho CYOA Adventure Engine very interesting. In fact, I was planning to use it for a personal project (obviously giving you credit for this tool)

    I have one question though: Since the personal project will be written in Spanish, I will need to use accented bowels (like á, é, í, ó, ú, Á, É, Í, Ó, Ú) and the ñ and Ñ characters. Is it possible to do this with your program without modifications to the main program?

    Thanks in advance for your help.

    If you use a custom font and map those to otherwise unused glyphs, that should work.. I.e, if you don't need the glyphs "#$%&:;<=>[\]^_{|}, you could just replace those with áéíóúÁÉÍÓÚñÑ... so "Cañada" could be (for example) "Ca[ada" in the source text. (I don't know if that's a word, just throwing it out there as an example)
    Post edited by Sol_HSA on
    http://iki.fi/sol | http://iki.fi/sol/speccy/ | https://github.com/jarikomppa/speccy
    http://goo.gl/q2j0NZ - make ZX Spectrum choose your own adventure games, no programming needed (release 3)
  • Thanks a lot! That will work like a charm :)

    I will post here when the project is finished (and I will try to make a version in my - admittedly awful - English so you guys can read it as well)
  • RMartins wrote: »
    This is what I use as my keyboard driver readKeyboard routine

    If anyone's interested, my own keyboard driver called DEFKEY is available here:

    https://www.dropbox.com/sh/bgtoq6tdwropzzr/AAAknv_0PeJGhn36dLJZfGASa

    It's faster, more compact, and returns only the redefined keys as bits in a single byte so it's easier to use it in programs.

    Also it's compatible with JOY so programs don't need to handle joysticks and redefined keys differently.
    Creator of ZXDB, BIFROST/NIRVANA, ZX7/RCS, etc. I don't frequent this forum anymore, please look for me elsewhere.
  • Hello Sol_HSA,

    You'll be interested to know that I just finished a game in MuCho CYOA Adventure Engine, for an interactive fiction competition. It still has work to be done (fixing bugs, etc.) and I have yet to translate it into english, but I guessed you'd be happy to know about it :)
    Thanked by 1Sol_HSA
  • Kozelek wrote: »
    I guessed you'd be happy to know about it :)
    I'd love to see it, even if it's in some crazy moon language =)

    http://iki.fi/sol | http://iki.fi/sol/speccy/ | https://github.com/jarikomppa/speccy
    http://goo.gl/q2j0NZ - make ZX Spectrum choose your own adventure games, no programming needed (release 3)
    Thanked by 1Kozelek
  • By the way: I did find a bug. If you write a word long enough to surpass the whole width of the screen, the game crashes. (and as a future update, it would be great if you allowed to change the system messages - it feels weird to have them in english when the rest of the game is in spanish)
  • Hi Sol_HSA:

    Here is my game in some crazy moon language :P

    http://sillyberrys.net/works/Cementerio/cementerio.html

    If you give me some more time, I will translate it into English. But I wanted you to know firsthand that I finished the game ;)
    Thanked by 1Sol_HSA
  • Kozelek wrote: »
    Hi Sol_HSA:

    Here is my game in some crazy moon language :P

    http://sillyberrys.net/works/Cementerio/cementerio.html

    Awesome!

    http://iki.fi/sol | http://iki.fi/sol/speccy/ | https://github.com/jarikomppa/speccy
    http://goo.gl/q2j0NZ - make ZX Spectrum choose your own adventure games, no programming needed (release 3)
  • @Kozelek Hey, did you already do the Crazy Moon Language to English translation?
    What now?
  • @Sol_HSA
    Just wanted to say that this is a superb piece of work, and while I will still have some questions, I can't believe how much attention to detail has gone into the instructions. Bloody well done Sol.
    F_Clowder wrote: »
    @Kozelek Hey, did you already do the Crazy Moon Language to English translation?

    Yep I'd like to know too.
Sign In or Register to comment.