The brain is going to be the most conceptually complex part – it actually has to make a ton of decisions, might have to keep state, and will have to handle a wide variety of circumstances. As such, it’s also the one I currently understand the least and, at least for now, is going to be the one described in the vaguest of terms and probably the last thing I build.
Like any thinking thing, the brain is going to need to have a purpose or some kind of motivation. In the case of Rube Goldbot, the brain is probably going to have the goal of “knowing itself, finding things to kill, killing them, taking their shit, and staying alive.” Normally I’d worry about lil’ Rube being a sociopath, but in the World of Warcraft where we’re all murder hobos to begin with, this behavior is totes cool.
“Who am I” is a pretty reasonable question to want to know an answer to. Our brain needs to know who it is, too. In WoW, this means knowing what class and level it is, what faction it belongs to, and maybe to a lesser extent, what race it is, since there are different abilities available to different races, but they are super situational. As we play, the level part can change, but everything else should stay static. So, we can pass in the class, faction and race stuff at the beginning, and then only update the level information as we need it.
Finding things to kill
Azeroth (and whatever other lands get added to the game as time goes on) is broken up into zones. Each zone is, generally speaking, appropriate for a certain level of character to go exploring in. Starting zones are safe as houses – there’s nothing very scary in them anymore, and they’re designed to let newbies frolic and play without having to confront their impending mortality. Later zones get progressively more challenging – instead of most things having a live and let live mentality, some of them will attack you without provocation. In any case, zones are very helpfully defined as being appropriate for a certain range of levels, and so if we want to find things to kill that are worth killing, our brain needs to have a library of zones and their level ranges. Zones also have an x/y coordinate system that tells you where you are in a given zone, as well as a facing value that tells you, in a 360 degree circle, which direction you’re facing – WoW makes this info available to the player.
There are also good parts of zones to go when you want to mindlessly kill – each zone has several areas where monsters are plentiful and relatively easy to make sure you don’t accidentally pick a fight with too many. Given that we know (thanks to the x/y coordinates and facing value) where we are, we can probably map out a rough path where I’m more likely to run into things that need killing. We could give our brain a sequence of waypoints to hit and let it figure out how to get from point to point to point, and have it keep running in a loop.
So, we’ll need a list of zones by level as well as a list of subzones and patrol routes and waypoints for each route. Maybe as a bonus we can have another set of routes for each zone that tell us how to get from one subzone to another and, of course, a list of connections that tell us how to get from one zone to another zone. This is a graph data structure and pathing problem – if I’m in Zone A and want to get to Zone F, what’s the quickest way to get there, so that should be pretty fun to figure out. There’s also the question of just how autonomous do I want this bot to be. Do I want to have Rube start off at level 1 and figure things out for itself until it hits the level cap, or do I want there to have to be human intervention at parts that might be hard to code? I vote for autonomous right now since that will be more challenging.
As it’s running in circles, we can have it spam a command that tries to target an enemy. We have the addon in the game under the Watcher (Uatu) system create a QR code that has relevant information about the target, and that sends this info to our brain. Brain then will use certain criteria to determine whether or not we want to pick a fight with this target. We don’t want to attack something that’s already claimed (no gain from it), or something that we think can kill us instantly (too high level!), something that will flag us as attackable by other players, or something that is too weak, dead, or whatever else we decide. If it matches the criteria, we Do, and if it doesn’t, we Do Not. There is no try. This brings us to…
We have a target! We are weapons free! We need to know what the hell to do! In this case, I think our brain will have to look at what class we are and what abilities we have available for our level, and then use an attack sequence that is relatively optimized. So, when the bot goes into a combat mode, the brain should probably loop through that attack sequence, take in both good and bad events (“I’ve been hit!” or “My super powerful attack ability that isn’t always enabled is now ready to use!”) that require special handling, and then repeat until the thing is dead. There are a number of ways this can be handled – lots more thinking to be done here. I can make extensive use of macros and castsequences to reduce the burden on the brain – maybe it doesn’t need to know what class it is, just know that one macro is for single target, another is for multi-target, another is for special abilities, etc.
Taking their shit
The target is down, now just target the corpse, run over to it (or use a Lootarang if that’s available) and then skin it afterwards if it’s skinnable. All of these things are easily detectable from within the game, and Interact With Target is a keybind we can use to help. When we’re done with this, we can look at the x, y and facing values, figure out what the next waypoint was and go towards it, and then continue.
In this case, we’ve got the staying alive in combat handled, so maybe we just need to worry about making sure our gear is repaired and our bags aren’t too full, as well as selling the shit we’ve just taken or auctioning it, etc. This MIGHT just be as simple as having an event pop up when our bags are at 90% capacity or our gear has turned yellow and having the bot hearth home, sell and repair. Selling and repairing from our hearth location could be handled by waypoints as well – they’re fixed locations. Maybe have it put anything it doesn’t know what to do with in the bank, if possible. There are multiple existing addons in WoW that will help with this stuff.
For the brain, I’m probably going to use whichever language I didn’t use with Uatu – Lisp or Haskell – since I don’t know either of them and the purpose of this is to learn stuff.
Our brain also needs a name. I think “Grace” will be a good one – Admiral Hopper was definitely a brain.