1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 08:39:30 +00:00
game scripting engine and language
Find a file
2022-01-16 02:34:25 +01:00
interpreter Change config.ans variables for games (add global directory, start expression, remove start script) 2022-01-16 00:18:20 +01:00
parser Improve variable redefinition error 2022-01-16 02:34:25 +01:00
stdlib Stdlib: add string!len, table!concat, _%_ 2022-01-16 00:16:06 +01:00
test Improve variable redefinition error 2022-01-16 02:34:25 +01:00
.gitignore Changed a few things 2021-06-03 15:29:25 +02:00
anselme.lua Fix functions defined in code injection conflict due to reference reuse 2022-01-16 02:33:53 +01:00
API.md Update doc 2021-12-12 15:52:23 +01:00
common.lua Fix scoping with mutable variables 2021-12-12 15:38:27 +01:00
init.lua Rewrite 2020-05-24 20:31:09 +02:00
LANGUAGE.md Change priority of _~?_, _~_, and _#_ 2022-01-16 00:35:52 +01:00
LICENSE Changed a few things 2021-06-03 15:29:25 +02:00
notes.txt Update documentation 2022-01-16 00:23:32 +01:00
README.md Update README 2021-12-23 20:01:22 +01:00

Anselme

The overengineered dialog scripting system in pure Lua.

Documentation and language are still WIP and will change. I am using this in a project and modify it as my needs change.

Purpose

Once upon a time, I wanted to do a game with a branching story. I could store the current state in a bunch of variables and just write everything like the rest of my game's code. But no, that would be too simple. I briefly looked at ink, which looked nice but lacked some features I felt like I needed. Mainly, I wanted something more language independant and less linear. Also, I wasn't a fan of the syntax. And I'm a weirdo who make their game in Lua and likes making their own scripting languages (by the way, if you like Lua but not my weird idiosyncratic language, there's actually some other options (Erogodic looks nice)).

So, here we go. Let's make a new scripting language.

Anselme ended up with some features that are actually quite useful compared to the alternatives:

  • allows for concurently running scripts (a conversation bores you? why not start another at the same time!)
  • allows for script interuption with gracious fallback (so you can finally make that NPC shut up mid-sentence)
  • a mostly consistent and easy to read syntax based around lines and whitespace
  • easily extensible (at least from Lua ;))

And most stuff you'd expect from such a language:

  • easy text writing, can integrate expressions into text, can assign tags to (part of) lines
  • choices that lead to differents paths
  • variables, functions, arbitrary expressions (not Lua, it's its own thing)
  • can pause the interpreter when needed
  • can save and restore state

And things that are halfway there but should be there eventually (i.e., TODO):

  • language independant; scripts should (hopefully) be easily localizable into any language (it's possible, but doesn't provide any batteries for this right now) Defaults variables use emoji and then it's expected to alias them; works but not the most satisfying solution.
  • a good documentation Need to work on consistent naming of Anselme concepts A step by step tutorial

Things that Anselme is not:

  • a game engine. It's very specific to dialogs and text, so unless you make a text game you will need to do a lot of other stuff.
  • a language based on Lua. It's imperative and arrays start at 1 but there's not much else in common.

Example

Sometimes we need some simplicity:

HELLO SIR, HOW ARE YOU TODAY
> why are you yelling
    I LIKE TO
    > Well that's stupid.
        I DO NOT LIKE YOU SIR.
> I AM FINE AND YOU
    I AM FINE THANK YOU

    LOVELY WEATHER WE'RE HAVING, AREN'T WE?
    > Sure is!
        YEAH. YEAH.
    > I've seen better.
        NOT NICE.

WELL, GOOD BYE.

Othertimes we don't:

TODO: stupidly complex script

Reference

See LANGUAGE.md for a reference of the language.

See API.md for the Lua API's documentation.