3 ms·
I think I should clarify this in the article further. What I meant to say is: "after you've implemented the basics, e.g. input handling, basic renderer, file I/
by eliasdaler 4y ago
I think I should clarify this in the article further. What I meant to say is: "after you've implemented the basics, e.g. input handling, basic renderer, file I/O etc. and you've got a basic game running, then you can start with prototyping code in Lua".
I feel like I've fallen into a trap of writing the code in C++ first ("because it's fast!") and then porting it to Lua when I realized that I need to write too much "binding" code.
For example, if you're writing a very simple AI, you can write a FSM/Behaviour Tree implementation entirely in Lua and then write AI logic directly in Lua. This way, you won't need to write binding code between Lua/C++ for these FSM/BT implementations.
And then, after you've written some code with these structures, you can see if you need to port it to C++ for performance or not. And if you do, it will be easier to design API since you already know which parts you need to expose.
One thing that makes prototyping in Lua fast is that the code, which looks simple in Lua, can easily become a pretty difficult template meta-programming code in C++.