DemoCoder said:
I understand that "hard work" will be a native callout from the script code, but AI is "hard work" too. IMHO, and if the bots are executing alot of script, then bot-heavy stuff will be a much bigger CPU hog than a C++ version. In particular, if the script has to traverse data structures it's going to be much slower than a compiled or JIT'ed version.
To be honest, the division of code doesn't seem to be decided by hard work vs easy work in the Unreal Engine. It's more of engine code vs game code. Engine code is the generic, underlying logic that is used regardless of the content or gameplay -- or
game. Game code is code specific to a particular game. It just so happens that most of the "hard work" is generic engine code and therefore in C++. There are generic UnrealScript classes in the Unreal Engine, but they're mostly extendable interfaces to native code.
High-level AI code, bots' high-level decision making process, is most of the time game code. What to do in UT2004, for example, is dependant on the gametype. Depending on how smart the bot is, this could end up being "hard work", as you say, but putting it in C++ code would be breaking the standard for division of code. It would also make things much more difficult for mod-maker seeking to make a new, complex game-type with competent bots. In the original Unreal and UT, C++ code could have been used as Epic released the C++ header files to allow modders to use native code. However, Epic hasn't seemed to want to do this for UT2003 and beyond (probably in part to eliminate some of the more sophisticated cheat/hack possiblities). As such, specific bot AI
must be coded in UnrealScript.
I'm not sure how the division of code is in FarCry. I used to have the demo installed, but I deleted it a while ago so I can no longer check. However, I do recall that mission scripting is coded entirely in Lua.