Game engine and moving the core from lua

As I’ve been going trough the code and chatting with other programmers in the team, we all agreed on a fact that Lua is used in too many core elements of the game engine. This brings us to a possiblity of changing the game engine and moving stuff out of Lua to C++.
Let’s leave the technical stuff on side for a moment and focus more on the architecture of the engine.

This brings us to a question, what should be moved to C++ and what should be left in Lua. What I would imagine is that Lua should be used only for mod-specific stuff and by that I mean perhaps UI architecture, adding content like more entities ( more on that later ), more assets and stuff like that. Everything else should be made in C++. This would require some model of what is modder allowed to change and what he should have no idea about.

What I imagine is that modding allows people to make more content but never ( or in a very limited way ) more game logic. Everything like rendering or actully any game system should never be exposed to Lua / modder. I have already spend some time on this topic for my projects ( even though 2D, but same design can be applied in here ) and a good way of doing this is having hash tables of game content exposed to Lua so modder can add/modify/remove stuff out of this table. All entities are defined in this table as a table of components and accessed by ID.

To give you an example, let’s say we have some Car that has specific assets like sounds, textures, and so on ( everything only as a list of IDs ) and also has some AI ( the AI can be defined somewhere in a table and accessed by ID ). This way modder can add more cars, change its assets and so on. But the modder is never allowed to modify how to car is rendered, how it’s collision detection works and so on.

To summarize this:
All systems moved to C++ ( that includes events, sounds, input and so on ) and moddable stuff will be as a table with bunch of flags that can be modified but are managed in the Engine.

What do you think?

1 Like

2 posts were merged into an existing topic: Moving Lua Scripts to C++