Log In  

12

Here's a silly thing that came out of another thread where I was contemplating parsing game content out of strings, and just how far to take the idea. Eventually configuration/data formats always end up becoming programming languages (heck that's how Lua got its start), so why not just make it a full programming language from the start? Get a jump on Greenspun's 10th rule.

So, I implemented lisp-8, a small lisp dialect intended to be used in pico-8 carts. The core code is about 1400 tokens after some fairly aggressive (ugly) optimizations. I could cut it down by about 200 tokens if pico-8 ever exposed Lua's _G variable.

And of course, once you've got a scripting language embedded in your game, why not allow your players to type in code and make a full programming game out of it?

Of course, it might take a week to type in your program with the limited input available on pico-8. So if you don't want to type in code yourself, hit tab to cycle through some sample lisp statements.

Cart [#39744#] | Copy | Code | 2017-04-17 | Link
12

This editor cartridge is, of course, itself implemented in lisp-8. It's all in the first _init function at the top of the code, the rest of the file is the lisp-8 engine.

Ultimately I don't know if this has any practical use at all, and it sure is slow, but it's kind of fun. It gave me lots of good ideas about how I can better compile together my assets for my actual pico-8 programming puzzle game, at least.

tool experimental
P#39746 2017-04-18 00:04

::

Wow, this is awesome - congrats! :D

I wanted something like this to save on tokens for my SCUMM-8 engine. In the end, I settled on having "packed" data definitions, as I wasn't smart enough to find a way to encode/serialize functions, expressions and loops!

If all my game code could be string-based, it might be possible to compress them somewhere into (potentially external) cart data.

Hmmm... you've given me lots to think about! ;o)

P#39750 2017-04-18 01:13

::

Hey thanks! SCUMM-8 looks great, I was drooling over it yesterday.

There's a lot of overkill in this current implementation, I was having a lot of fun with it, but it'd be interesting to trim it down and turn it into essentially a small interpreter with a hard-coded set of exposed functions. Basically an adventure game execution engine, like SCUMM was! :)

Hit me up if you want to chat more about the possibilities, I think it'd be fun. I'm @codekitchen on github and the social medias as well.

P#39761 2017-04-18 15:48

::

Thanks back at'cha! ;o)

Totally agree, makes perfect sense (and would be so fitting!).

Thanks also for the offer, will be in touch soon. In the meantime, all the best with your lisp-8/logic gates game!

P#39762 2017-04-18 16:21

::

dude very cool thanks so much for making this!!!

Would be nice to use the interpreter against the in game editor though

P#39815 2017-04-22 10:07

::

Thanks @tonechild. I'm not sure what you mean, are you talking about writing lisp code directly into the cart rather than in this little in-game editor toy? That's possible by using this cart as a template, the in-game editor is itself implemented using the lisp.

P#39900 2017-04-24 10:42

::

Hey it turns out that writing a game completely using an on-screen keyboard isn't so far-fetched after all! :D

https://arstechnica.com/gaming/2017/04/the-first-kirby-game-was-programmed-without-a-keyboard/

P#39980 2017-04-27 11:59

Log in to post a comment

user:
password:

New User | Account Help
:: New User
X
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2017-10-22 17:32 | 0.106s | 1572k | Q:23