Oh, oh, lack of focus right? Lua and Artificial Intelligence, WTF, well I get in trouble with “lack of focus” from time to time…ok, all of the time. Life is like taking a walk on the beach, you see the ocean, the birds, and the sand. Then you look more carefully at the waves, you lose focus of the “beach”, then you watch the birds in flight, again focus on the beach is lost. That’s the way I think, act and write. So good luck on keeping up with me, sometimes the threads get confused since I am maintaining several blogs with my writing, as well as developing talks, write code and do the paperwork any job reasonably requires.
Lua and AI meet in the realm of scripting.
First of all: What is scripting, this is a term that is bandied about when talking about server support, Microsoft Office, Game Design and so forth. Lua is used as a scripting language that works with World of Warcraft application programming interface (API). WOW scripting language is Lua (or LuaLanguage) is an example of a Domain Specific Language.
Lua is a Domain Specific Language in the manner that it consumed by WOW. You can create your own DSL that does specific work. In the case of WOW, if you figure out how to utilize the API and consume XML, you could use another language than Lua, maybe your own language. But that won’t count for much if it is hard to use.
A specialized language that would build on Lua, would be to connect the Lua to a database (thanks to Kenny Spade) that would track player ratings for friendliness, etc. In this case you may need to build a simple AI that helps make decisions on how your profile would work with other players.
Examples in WOW there are addons that utilize some of the concepts of Artificial intelligence like the “Traveling Salesman” problem, which is really a topology problem, but looks like the common definition of artificial intelligence.
Let’s take a look at the way that you would use the WOW Addon Studio from Codeplex, once you have it loaded, make sure to work through the initial tutorial under Help menu. Note: The screen shots in the tutorial are slightly different than the current version of Addon Studio (this may change in the future when new tutorials are created, but on 3/10/2009 they are out of synch, slightly).
Make sure you understand that the XML is controlling the presentation and the Lua code is providing the functionality. Once you add an object like a frame or button to the design environment the related XML is added to the “coded” XML, the Lua is a “code behind”, like ASP.NET. In the next posting I will be discussing XML in the WOW and how you can make changes directly to the code.
In the next post I will walk through the most basic XML used by the WOW engine