Skip to content

ChrisCastelo/fuzzy_vs_poca

Repository files navigation

Fuzzy and MA-POCA: AIs that play games


By Chris Castelo

Instructions Fuzzy Logic

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.

Supported Inputs:


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

Supported Outputs:

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

Supported Operators:

IF THEN AND OR IS

Instructions MA-POCA

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:

  1. Create a new environment with python -m venv venv
  2. Activate the environment with venv\Scripts\activate
  3. Upgrade to the latest pip version using pip install --upgrade pip
  4. Install pytorch pip install torch==1.7.0 -f https://download.pytorch.org/whl/torch_stable.html
  5. Now install ML-Agents with pip install mlagents
  6. 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

Evaluation - Viewing the results

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/

About

Fuzzy and MA-POCA: AIs that play games - CM3070

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published