The infrastructure for scripting Actors in Lua was pretty much reusable for the Scenes, which meant there wasn't much new code that had to be written. However, what did have to be done was mostly small changes to existing blocks of code, changing the behavior of long series of pushes and pops onto the Lua stack. C++'s static type checking stops being nearly as helpful when you have to turn everything into a void* in order to pass it through Lua, and nothing makes sure it comes back correctly on the other side. Or, you add a layer of indirection here, take one away there, and now you have a whole bunch of pop calls that are now removing important resources rather than clearing up garbage to leave yourself in a correct state. The problem seems to mostly stem from the fact that anything in Lua more complicated than a builtin type all looks the same to the C interface. I'd love to add a stronger layer of validation to the C++ interface to make sure the Lua side is working as intended, but there's not a lot of features to make that feasible. That is one of the intents of Lua however, as there are apparently features like metatables that allow me to implement any programming paradigm I want! I get all the joy of re-implementing object oriented features myself! I... really don't feel like doing that.
Eventually as I get a stronger handle on how the language works and I want to do more complicated things on the scripting side I'll start needing to make things more complicated and it'll be worth the time investment. At the moment however, it means that when things go south I wind up with esoteric pointer issues deep inside the Lua code and digging through stack traces.
Anyways, these backend features allowed me to do some neater thing in terms of actual features. The better listener code means I was able to set up a bunch of listener conditions without bloating the ActorHandler, so now Actors are able to listen for a tick each frame, key presses, mouse movement, when its looked at, wiimote orientation, and wiimote button presses. This means that the bottle is able to be grabbed with the B button when it is being looked at, and while grabbed it will sync up its orientation with the wiimote. The motion tracking isn't quite smooth or accurate enough for this to be really accurate, but its way easier to rotate with that compared to the mouse. Also, it can be moved about with the D-pad while grabbed which is important for the next new feature.
Now that the bottle's interactivity isn't based around it being some sort of special global object, it opens up the possibility of the scene adding more.
![]() |
| Also they're colorful! |
![]() |
| Slightly different angle, showing how the liquid looks bad from above. |
My plan now it to shore up some graphical stuff to make things a bit prettier. The bottles look stupid when looked at from above, the fact that the bottle's mesh doesn't actually have a top becomes rather apparent as you can see through it. In a scene where the main form of interaction is rotating things around, having a mesh that looks bad when viewed from a certain angle is a pretty big flaw. Also, the having a bunch of bottles is sort of useless if there's nothing to really do with them, so I need to have a way for them to interact with each other. This means having a bit more structure on the Lua side to let the bottles talk to each other.



