Game scripts and the game library ABI #22
No assignees
Labels
No labels
area/build
area/content
area/editor
area/engine
area/graphics
area/platform
area/repo-wide
area/tests
area/tools
bug
optional
roadmap
size/L
size/M
size/S
No project
No milestone
Blocks
Depends on
#56 Loading the game library in the editor
UnflavoredMeson/Primal_Plus_Plus
#21 Reflection generator PrimalReflectGen
UnflavoredMeson/Primal_Plus_Plus
Reference
No Branch/Tag specified
Notifications
1 participant
Due date
No due date set.
Reference
UnflavoredMeson/Primal_Plus_Plus#22
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Game code is a separate library. It has to register its types in the engine's registry and run game-level logic without exporting anything the engine must know by name.
Decided
PRIMAL_GAME_SCRIPT()+class X : public script::GameScriptfor game-level logic (game mode, managers). Created andbegin_play()at the first sync point,update(dt)before actors,end_play()atscript::end_game_scripts().PrimalEngineand exports nothing: its types register while the host loads it, betweenreflect::begin_library_load()andend_library_load();release_library_types()before unloading. Types registered that way are copied so they outlive the library.ScriptBasehas the name and log helpers (log_info("fmt", ...), categoryscript).Read first
Engine/Components/Script.cppandEngineTest/Scripts.cpponmaster.Steps
dlopen/LoadLibrary): its script registers, runs, and its type is gone after release.GameScriptand the load bracket until they pass.REGISTER_SCRIPTand the per-entity script component.Done when
Claude can help with
Learn