Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Fair enough. Just wondering then, what would the performance implications of creating many separate Lua states be? The main thing I plan to use this for is creating scripted cutscenes/dialogue sequences (I.E. something that I really needed coroutines for). I'm used to working with MoonSharp, so I usually encapsulate loaded scripts into their own tables so I can define variables local to the script outside the main function that executes as a coroutine. (That's just the way I'm used to doing it for the huge JRPG I'm making though, this game is a lot simpler. I'd still like control)

For this case, my next option would be to try just spinning a separate state up for each loaded script. I don't have a lot of global state that I'd need to pass between scripts. I'd just like to know how "heavy" a lua state is in this instance, and how much performance one of them would take up.

(1 edit)

There are no performance implications as no logic runs unless triggered, but states do take up some memory.

However, if this is primarily for dialogues and not any of the specialized things that Lua can do, you could look into TXR? It’s 100% GML and can yield at any point by design. People have modified it to have custom syntax for dialogue trees before, and some of the recent additions to base source code (like select statements) aid with that.