Skip to content

A simulation about battling Wizards with AI meant to begin very simply and behave more intelligently through a process of evolution.

License

Notifications You must be signed in to change notification settings

Benjamin-Russell/WAIzards

Repository files navigation

WAIzards

Project by Benjamin Russell, 2016
A simulation about battling Wizards with AI meant to begin very simply and behave more intelligently through a process of evolution.

This is made with C++ in Visual Studio 2013, and uses SDL 2.

Note: This project is suspended indefinitely.

Currently much of the AI is fleshed out. You can edit the file Resources/AI/Waizard1.txt, which is where all WAIzards poll their AI. There is a short AI guide below. The plan is to create the evolution system which will breed the most fit WAIzards, save their AI to new files, and start the next round. This part may be done for my Capstone, so in the meantime I plan to work on more ability implementations, graphics, and optimization.

To Run:
-Open the sln file, and build (CONTROL-SHIFT-B) in Debug or Release.
-Then run the corresponding Batch file, WAIZARDS_DEBUG / WAIZARDS_RELEASE

This is done in order to link the DLL's in their folder without placing them in the working directory. Feel free to inspect the Batch files yourself.

Controls: (currently)
H - Toggle health bars
M - Toggle mana bars
L - Reload AI (WAIzard1.txt) in game
Enter - Load level_box
Escape - Quit program

AI Guide:
AI is run when a WAIzard is aligned with the tiles, and has a cooldown of half a second currently.

The first four lines define the basic attack, ultimate attack, and two passives of a WAIzard. Currently there are no ultimate attacks, and very few working passives.

Next are the AI Blocks, one line for an if condition, and the next line for the consequent action. Do_Nothing, Move, Basic, and Ultimate actions are placed at the top of the WAIzard's action vector. When all the AI has been run, the last action is chosen. The other actions like SET, CANCEL, and CHANGE do not get placed in the action vector.

OBJECTS:

  • FLOOR
  • WALL
  • SPELL
  • WAIZARD
  • EMPTY
    (No Floor or Wall)

DIRECTIONS:

  • Up
  • Down
  • Left
  • Right
  • Forward
  • Backward
  • Untried
    (A direction in which moving was not just blocked by a Wall or WAIzard. Reset upon successful move)
  • Focused
    (The direction "Focused on," held in the mFocusDirection variable)
  • Random
    (Up, Down, Left, or Right)

Conditions:

  • !
    if ! Health > 90
    (Negate any condition check)

  • CHECK_HEALTH
    if Health < 20

  • CHECK_MANA
    if Mana > 60
    (condition amounts are integers 0 to 99)

  • CHECK_TIME_MARK1
    if TimeMark1 > 20
    (tenths of a second since TimeMark1 was set)

  • CHECK_TIME_MARK2
    if TimeMark2 < 30
    (if "Reset and" begins the consequent action, set the condition TimeMark)

  • CHECK_POSITION
    if OBJECT at 7 -2
    (check 7 tiles to the right, 2 up) *See: OBJECTS
    if OBJECT DIRECTION
    (check adjacent tile in DIRECTION for OBJECT) *See: DIRECTIONS

  • CHECK_COLLISION_LINE
    if OBJECT through DIRECTION 55
    (check through (55 / 10) + 1 tiles in DIRECTION for OBJECT)

  • CHECK_RANDOM
    if Random < 50
    (Random between 0-99)

  • CHECK_ATTACKING
    if Attacking
    (if current action is a basic or ultimate attack)

  • CHECK_MOVING
    if Moving
    (if current action is a move)

  • DO_ACTION
    if True
    (tautology)

  • ELSE
    else
    (if previous condition outcome was false)

  • ALSO
    also
    (if previous condition ouctome was true)

Actions:

  • DO_NOTHING
    Do Nothing
    (An action for doing nothing)

  • SHOOT_BASIC
    Basic DIRECTION
    (Use Basic spell if has the mana and off cooldown in DIRECTION)

  • SHOOT_ULT
    Ultimate DIRECTION
    (Use Ultimate spell if has the mana and off cooldown in DIRECTION)

  • MOVE
    Move DIRECTION
    (Move in DIRECTION)

  • SET_TIME_MARK1
    SetMark1
    (Set TimeMark1 to current time)

  • SET_TIME_MARK2
    SetMark2
    (Set TimeMark2 to current time)

  • SET_FOCUS
    Focus DIRECTION
    (Set mFocusDirection in DIRECTION)

  • SET_FOCUS_CURRENT_DIR
    Focus Current
    (Set mFocusDirection to the direction of the current action to take)

  • CANCEL_NOTHING
    Cancel Nothing
    (If current action is a Do_Nothing, remove it from action vector)

  • CANCEL_MOVE
    Cancel Move
    (If current action is a Move, remove it from action vector)

  • CANCEL_ATTACK
    Cancel Attack
    (If current action is an attack, remove it from action vector)

  • CANCEL_ALL_MOVES
    Cancel Moves
    (Remove all move actions from the action vector)

  • CANCEL_ALL_ATTACKS
    Cancel Attacks
    (Remove all attack actions from the action vector)

  • CANCEL_ACTION
    Cancel Action
    (Remove the current action from the top of the action vector)

  • CANCEL_TWO_ACTIONS
    Cancel Actions
    (Remove the current and previous actions from the action vector)

  • CHANGE_DIRECTION
    Change Direction DIRECTION
    (Change the direction of the current action to DIRECTION)

  • CHANGE_TO_BASIC
    Change Basic
    (Change current action to Basic spell if able)

  • CHANGE_TO_ULTIMATE
    Change Ultimate
    (Change current action to Ultimate spell if able)

  • CHANGE_TO_MOVE
    Change Move
    (Change current action to Move)

About

A simulation about battling Wizards with AI meant to begin very simply and behave more intelligently through a process of evolution.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages