hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.21k stars 2.17k forks source link

Choosing a scripting language #19379

Open hrydgard opened 2 months ago

hrydgard commented 2 months ago

I think we've reached the point now when we really need to add a proper scripting language.

The following uses are obvious, but there may be more:

It's just pretty hard to choose. We've discussed this previously in #15626 , but didn't reach any conclusion. So let's list the option:

Other alternatives:

Any other ideas?

LunaMoo commented 2 months ago

Honestly the reason why everyone know lua in the modding community is because it was popularized by games like for example WOW and many others then became adapted to cheat engine where it's used for everything from custom searches that standard CE UI might not include up to paid trainer stuff.

IMO there are two most important factors:

iota97 commented 2 months ago

While I don't really like Lua as a language I would prefer it over a not well maintained JS. The last thing I want are bugs in the interpreter tbh.

That being said if the JS library is solid enough I kinda like the idea of having some metaprogramming stuff like decorators and so on. That could be useful to make some complicated and repetitive stuff hidden to the user, or just to specify when a function should be called. Not sure if this is possible with Lua tbh.

Python I have a bad feeling about Android/iOS support. But beside that I share the same feeling about JS.

Nabile-Rahmani commented 2 months ago

Lua is pretty nice, but here's a shot in the dark, which somewhat sidesteps the question: would WebAssembly be viable ?

If it's easy and light enough to embed and has the ability for any supported language to produce a binary to execute, this could be nice.

I've heard good things about it, but never embedded it.

NABN00B commented 2 months ago

Does it need to be a full-feature general purpose language? I would favor something simple that people with little-to-no real development experience can easily pick up and learn on the fly.

Nemoumbra commented 2 months ago

There are 2 things I can say... 1) All hail to Python 2) https://github.com/hrydgard/ppsspp/pull/13804

hrydgard commented 2 months ago

Python is very heavy and slow, and I'm not confident it'll build on all our supported platforms, I wouldn't want to break Switch for example even though it's not very actively updated.

I'm currently leaning towards lua / luau due to it being well maintained and very easy to embed, and guaranteed to compile anywhere due to its simplicity.

I want to enable live-editing and add a development console that you can use to poke around in memory with, so something like WebAssembly would require an additional compiler from a textual language, making it less interesting.

Nemoumbra commented 2 months ago

I want to enable live-editing and add a development console that you can use to poke around in memory with

What does live-editing mean?

Next... I remember you saying this: https://github.com/hrydgard/ppsspp/pull/17661#issuecomment-1640224324 Is that the same console you mean here?

hrydgard commented 2 months ago

Live-editing means editing various scripts that can affect games without restarting the game or PPSSPP.

And yeah, it would be a convenient way to implement such a console.