By Chris Castelo
Users can opt to iterate on this project and modify Fuzzy Logic behaviour by editing the rules for each existing player role:
An example of this rule is as follows:
Rule 2,IF BallOwner IS None AND BallDistance IS Near THEN Speed IS Sprint
This type of rule will apply logic to the Fuzzy Logic AI which will decided accordingly and output of speed.
BallOwner IS None
BallOwner IS Opponent
BallOwner IS Team
BallOwner IS Me
BallDistance IS Near
BallDistance IS Medium
BallDistance IS Far
GoalDistance IS Near
GoalDistance IS Medium
GoalDistance IS Far
StrategyDistance IS Far
StrategyDistance IS Medium
StrategyDistance IS Near
TeammateAvailable IS None
TeammateAvailable IS Found
Rotation IS TowardsGoal
Rotation IS TowardsBall
Rotation IS TowardsFormationSpot
Speed IS Idle
Speed IS Walk
Speed IS Jog
Speed IS Run
Speed IS Sprint
ShootOrPass IS Pass
ShootOrPass IS Shoot
ShootOrPass IS DoNotShoot
IF
THEN
AND
OR
IS
Users can also iterate in our neuro network based AI MA-POCA by modifying the hyperparameters of it:Hyperparameters
In order to train a new brain or resume training we first need to setup our virtual environment by following these steps:
-Python version used: 3.79 https://www.python.org/downloads/release/python-379/
-Navigate to project root (Unity project root) e.g.: cd C:\fuzzy_vs_poca\
Then create a virtual environment:
- Create a new environment with
python -m venv venv
- Activate the environment with
venv\Scripts\activate
- Upgrade to the latest pip version using
pip install --upgrade pip
- Install pytorch
pip install torch==1.7.0 -f https://download.pytorch.org/whl/torch_stable.html
- Now install ML-Agents with
pip install mlagents
- To verify everything installed correctly type the help command of mlagents, that is
mlagents-learn –help
. Now we are ready to resume training.
To resume training or restart a new one type the following commands:
mlagents-learn config/SpeedBall_ImitationLearning.yaml --run-id=RunIdExample --resume
mlagents-learn config/SpeedBall.yaml --run-id=RunIdExample
We can see the tensorboard of the results of the training by typing:
tensorboard --logdir results --port 6006
and then going to http://localhost:6006/