Weekly post
June 15, 2024 • 1 min
- Lua API for abilities implemented and it works well. Still using luawrapper library but had to modify it to support member variable modification by reference; I did it using std::reference_wrapper as Lua userdata and some template metaprogramming additions, such as for stack reading with the LuaContext::Reader and pushing with LuaContext::Pusher, and using __index and __newindex. Lua debugging is now available using debugger.lua, a GitHub project.
- What's going well: the Lua API
- What needs work: the town level
- What I hope in future: the town level and the overall game will be well-established and fun/polished. The game will look good and have good game feel. I also want to implement these abilities over multiplayer by sending the Lua code but encoding it for security first by doing variable name verification on a whitelist essentially(rename all variables/identifiers, minify the Lua code and send, and then when receiving, ensure all variables follow the convention and aren't any other identifiers(otherwise they are potentially harmful functions). I can do this by adding a callback in the lua source code after the parsing step which can take in the ast and return true to continue with execution or false to abort due to verification error). In addition, several other checks will be needed: disabling "yield" keyword(by erroring out if it's present on sender or receiver), limiting memory usage of the Lua heap(maybe with a custom allocator), CPU time limiting, stack size / recursion limiting, script size limiting, and disabling upvalues and globals.