So, finally we’ve implemented an awesome Lua interface for the creature AI. It took us quite some time to get into the topic, because integrating Lua in a real-time engine comes with several different challenges, at least when you’ve never done this before. It turned out that the most difficult part was to maximize the performance of the Lua scripts while still offering a neat interface that you can work with when programming your AI.
We’ve actually completey redesigned the control implementation several times now, and we are very happy that we’ve found a solution that works well and pretty fast. AND we’ve made a short video showing Lua scripted AI in action:
Pretty fast means that for the bats (as in the video), using Lua yields around 95% of the performance of the corresponding hard-coded AI. The lag after spawning the 250 bats occurs due to the huge amount of simultaneous script registrations, and won’t occur in normal situations.
The next step is to further develop our Lua interface to allow for programming more complex behaviour and to clean up and refactor the current creature control implementation. Stay tuned!