Add scripting support
Maybe it will be a good feature to use Python as a scripting language for scenes. 🤔
What? Why not Nim? Are you yanking our (project lurkers) chain? Some other projects have used the VM for live scene and creative programming if that's your intention.
If you're looking at broader project adoption, then maybe just export the interface through something like https://github.com/treeform/genny?
nimscript is a module that just uses the Nim VM and implements stuff for actual file scripting and building convenience.
I'm referring to using the VM directly in the same manner as this cool project by @dsrw: https://github.com/dsrw/enu/blob/main/src/engine/engine.nim.
Here is a presentation he gave for NimConf 2021: https://youtu.be/ECJsq7BeZ8w
@quantimnot, I tried to do something similar, it seems to work...
https://github.com/Ethosa/nodesnim/commit/4bd60100a290d624e60c9a1824b17b11a573ff25#diff-fa731b6fc0fcf751f578c8847de7d08d29c674bc1dcf9bb70e2dbe173c61daee
- scripts.nim
- test.nim
- output
Excellent!
There is another game library that I watch called paranim by @oakes. He created an opengl-rendered embedded Vim module that he uses for an editor: https://github.com/paranim/paravim Maybe you could use that.
You may want to checkout his clever rule engine too: https://github.com/paranim/pararules
The problem with the interaction of Nodesnim objects in scripts:
Error: undeclared identifier: 'Vector2Obj'
-
script.nimproc sum*(vec2: Vector2Obj): float = return 12 -
main.nimvar compiled = compileScript("script.nim") - configRef:
let std = AbsoluteDir(getHomeDir() / ".nimble" / "lib") # Search .nimble/lib folder 👀 cfg.libpath = std cfg.searchPaths.add(cfg.libpath) cfg.searchPaths.add(AbsoluteDir($std / "pure")) cfg.searchPaths.add(AbsoluteDir($std / "pure" / "collections")) cfg.searchPaths.add(AbsoluteDir($std / "core")) cfg.searchPaths.add(AbsoluteDir($std / "impure")) cfg.searchPaths.add(AbsoluteDir($std / "std")) cfg.implicitIncludes.add(getCurrentDir() / "scripts_api.nim")
