Post
by Higor » Thu Mar 29, 2012 10:43 pm
Newer UT 'controller' approach would have made that a lot easier, subclassing (hypotethic) BotController would have been a nice choice to have.
But since the Pawn and the AI are not separate, it's not as attractive, here are some of the reasons I didn't employ Bot AI as base...
- Bot code outside of Bot.
This is a real problem, weapons, navigation points, triggers, translocators, game infos all have code that directly affect the Bot AI, these don't send notifications to the AI but instead modify or change AI states.
So the entirety of Bot code isn't inside Bot, which means 2 things, subclassing Bot would make it subject to this outside code, subclassing Pawn (like i did) would not be affected by this code.
- Pawn-Ai link.
Bot has varying subclasses, one per mesh.
BotZ was intended from the very beginning to work like Valhalla Avatar, one Pawn, many meshes supported by it, emulating the 'controller' approach.
- Aim system.
Bot doesn't aim, weapon does it for it, this means that aim is directly controlled by a few FRand() statements which do not account for velocity, direction, prediction...
BotZ always calls UpdateEyeHeight() like a playerpawn does and weapon only fires at where BotZ is looking at, this way the BotZ view rotation is the actual aim and in most cases is updated one tick behind + prediction, so quickly moving left and right can cause misses, even on maximum accuracy bots (no annoying loques).
- Code to rewrite was more than 80%.
Why subclass Bot and rewrite nearly all of it, this way I don't have to worry about all those states/functions/variables that were already defined and I wasn't going to use.
- Separation between Bot and BotZ
Useful for server filling, and KillAll commands.
Of course, there are a few disadvantages to this, I had to figure out a way to make BotZ interact with Bot-only waypoint system which is present in nearly all maps, it's a kinda slow approach but gave me more freedom to make the BotZ act accordingly.
I also had to hack the translocator, the BotZ translocator posseses own outside code that only interacts with BotZ, because it's easier to let the translocator target decide how and when to teleport instead of having to process that in BotZ.
I'm going to have lots of time this week, anything you want?