Thinking back to the first chapter in the series - what is our goal here? It takes significant time to get to max level in WoW, and significant portions of that time can be rather repetative. So one primary goal is to train our bot to gain experience and level up without human intervention. We want it to run around, find enemies of an appropriate difficulty, and dispatch them. The two most important elements here are 1) finding a target and moving to it, and 2) killing the enemy. However, there are plenty of other small things we need to worry about. Here's a totally incompletely list of additional details to consider:
- Looting fallen enemies.
- Resting after combat (eating/drinking/casting healing spells/buffing).
- Traveling to town to buy more food/drink, sell loot, and repair gear.
- What happens if we're in combat, and a second NPC attacks us?
- If we're on a PvP server, what happens if another player attacks us?
- What happens if the server dies, or our internet cuts out, and we get disconnected?
- What happens when we level up and we have new important skills available at the trainer?
- What happens if our bot identifies a target and starts moving toward it, but on the way, another enemy moves into range and attacks us?
The list above is essentially endless. While the low-level programming concepts we're working with are fascinating to me, the behavior aspect of botting is equally intriguing. For better or for worse, the environment our bot operates in is total chaos. If we're on a PvP server, players from the opposing faction can make our lives hell. Even if we aren't on a PvP server, it's totally possible for friendly players to grief us by dragging mobs to attack us, following us around and pulling enemies before we can tag them, etc. The nature of online games means our client is in constant communication with the server, and if we experience network issues, or the server does, it can impact the behavior of our bot. To me, this is one of the most addictive parts of this exercise. Our bot's AI can always be just a little bit better. There's truly no limit to how effectively we can train our bot's anticipation and improvisation skills.
A big part of the infrastructure is in place at this point. A lot of effort in the next few chapters will be focused on the behavior of our bot where we'll create states to encapsulate certain discrete categories of behavior. But there are still some very interesting non-behavioral problems that we'll solve down the road. For example:
- How do we modify the bot's AI without closing the client and restarting the bot?
- How will we organize the projects and solution?
- Smart pathfinding (avoid running straight into a wall, trees, etc).
- How do we avoid being flagged by Warden anti-cheat?
- How do we support different versions of bots? For example, the way the bot behaves in combat is specific to its class, so how do we support more than one class, and change that at runtime?
Before we really dig into behavior, we need to talk about Lua, and the WoW scripting API that the WoW client exposes. We'll do so in the next chapter.