Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Latest commit

 

History

History
80 lines (69 loc) · 4.14 KB

development.md

File metadata and controls

80 lines (69 loc) · 4.14 KB

Dev Docu

Dependencies

Getting started

git clone https://github.com/bottytools/botty.git
cd botty
conda env create environment.yml
conda activate botty
python src/main.py

Important info for Powershell users:

# for powershell you have to init conda before using any conda commands:
conda init powershell

Tests

All automated tests can be found within the /test/* folder. The file and folder structure is supposed to mimic the src folder.

conda activate botty
# To run all tests: (-s to see stdout, -v for verbose)
pytest -s -v
# To see std output:
# To run a specific test:
pytest test/smoke_test.py

To test single files / routines, most files also can be executed seperatly. E.g. running python src/pickit.py -> going to d2r window -> throw stuff on the groudn -> press f11, will test the pickit.

Adding Items

To add items you can check the assets/items folder. Screenshot whatever you want to pick up in the same way (all settings must be as if you ran the bot). Then add the filename to the param.ini [items] section (e.g. if boots_rare.png add boots_rare=1)

Folder Structure

/
The root contains docu, param files and development specific stuff such as .gitignore

assets
Contains all data for the project that is not source code
assets/docs
Images you can see in the .md files and logos
assets/items
Screenshot of item names that should be picked up. The filename must then be added to the param.ini
assets/npc
Templates of npcs in different poses
assets/templates
Templates for different UIs and key points. Also contains folders of "pathes" that were generated with the utils/node_creator.py

src
All python source files go here
src/char
Want to implement a new char or build. Check this folder out. You will have to inherit from IChar and go from there
src/char
Utilities functions and scripts e.g. for easily creating templates to traverse nodes and automatically generate code for it

Code routine

main.py contains the main() function and is the entry point for botty. It will start 3 threads: death monitoring (death_manager.py), health monitoring (health_manager.py) and the bot (bot.py) itself. Whenever the two monitors either detect a player's death or chicken out of the game, the bot thread will be killed and restarted.
In bot.py is a state machine in its core an executes different actions based on the current state. The goal is to remove as much implementation details as possible from bot.py and "hide" them in different manager classes (e.g. pickit.py, pather.py, npc_manager.py, etc.)

State Diagram

The core logic of the bot is determined by a state machine with these states and transations. The bot.py which contains all of the transitions should have little implementation code which should be hidden as much as possible in the "manager" classes.

Coordinate System

There are different coordinate systems used and I tried my best to add these to the variable names.
Monitor: It will have the origin at the top left of the first monitor
Screen: Same as monitor for single monitor setups, otherwise origin at top left of the screen
Absolute: Has its origin at the center of the screen, thus at the footpoint of your char
Relative: Relative coordinates as the name suggest are relative to something. It is mostly used to express relative coordinates in relation to a tempalte that is found

Release process

If you installed your miniconda in another location you will of course have ot change it for that one.

# Adapt new version with x.x.x, build .exe and bundeling all needed resource into one folder
python build.py x.x.x

For changelog run: git log <PREVIOUS_TAG>..HEAD --oneline --decorate