After learning a lot from the RoM project, there is a great number of problems that I would like to see resolved and many other things I want to see improved upon for GW2. I expect these changes to make coding quicker and easier, make the code easier to follow and expand upon, and improve the general flow of code as to avoid having to make hackish fixes all the time. Not all of these changes may make it into the bot; this is just a list of hopes and dreams.
- State management - The bot will use a system of states (see below for more information) that describe sets of behavior/AI instead of a mess of nested loops and functions. This will allow us to much more easily define a set of goals (for example: move to this location, target enemy, fight it, then loot it) rather than just a procedural set of functions to call. Each state will have a main update function (which does not block like the functions in RoM bot did!) that will process information then push/pop other queued states.
- Remove blocking functions - This means getting rid of functions that have while loops in them designed to take a long time to process, such as waiting for aggressive enemies or resting. These actions will still be possible, but will be done through states, not blocking functions. The purpose of this is to avoid situations where certain functions are preventing other, more important code from getting any processing time. This could potentially allow for networked botting, among other things, but will also just generally improve execution flow.
- Better object-orientation - This one is self-explanatory, really. We're just going to move more into object relations and management than a list of functions to run.
- Lower CPU & memory usage - This should tie in with removing blocking functions, I hope. Any unnecessary processing will be done away with. Anything that isn't currently needed in memory will also be deleted with its paired state.[/b]
- Function hooking - Still undecided about this one. But, potentially, we could hook some functions of the game for various reasons. This would allow us to, say, ignore all rendering while botting (No need for any strain on the GPU if the player isn't actually playing) except for maybe a screen update every second. We could also better control certain actions (any kind of movement on input) directly instead of faking keyboard input to do it. Who knows what else it can bring up.
- Minimal configuration - With the skill system that GW2 uses, the player should not be required to configure any skill settings. Just having them hotkeyed should be enough; the bot will attempt to figure out how to use the players' skills automatically.
States:
A state will be a class/table designed in a specific way that will contain logic for handling the character for that specific state. In example, one state might be designed to tell the player to combat enemies. On that state's update, the bot will attempt to use skills, re-position the player if necessary, evade attacks, heal, and whatever else. If it seems doubtful that the player can win, it will pop the combat state then push a new state into the queue: escape. On the next logic cycle, the player will now instead attempt to run away from all aggressive enemies. If the player is instead successful, it will pop the combat state and push a loot state. Once the loot state is completed, it will be popped and return to standard movement.
By pushing a chain of states, you can set up a chain of commands. For example:
Code: Select all
-- Notice these are in reverse order;
-- This is because the state at the top of the queue will be the one that executes first.
pushState(FilterInventoryState());
pushState(LootState());
pushState(AggroWaitState());
pushState(CombatState(target.GUID));