Melee Modding Library  2.0.0
A C library for modding Super Smash Bros Melee
Data Structures | Macros | Functions
ai.h File Reference

Automated player. More...

#include "logic.h"
#include "moves.h"
#include "controller.h"
#include "gctypes.h"
#include "input_queue.h"

Go to the source code of this file.

Data Structures

struct  AI
 Holds all information about an AI. More...
 

Macros

#define INIT_AI(port_val, characters_val)
 
#define DR_MARIO   (1 << 0)
 
#define MARIO   (1 << 1)
 
#define LUIGI   (1 << 2)
 
#define BOWSER   (1 << 3)
 
#define PEACH   (1 << 4)
 
#define YOSHI   (1 << 5)
 
#define DK   (1 << 6)
 
#define FALCON   (1 << 7)
 
#define GANON   (1 << 8)
 
#define FALCO   (1 << 9)
 
#define FOX   (1 << 10)
 
#define NESS   (1 << 11)
 
#define ICE_CLIMBERS   (1 << 12)
 
#define KIRBY   (1 << 13)
 
#define SAMUS   (1 << 14)
 
#define ZELDA   (1 << 15)
 
#define LINK   (1 << 16)
 
#define YOUNG_LINK   (1 << 17)
 
#define PICHU   (1 << 18)
 
#define PIKACHU   (1 << 19)
 
#define PUFF   (1 << 20)
 
#define MEWTWO   (1 << 21)
 
#define MR_GNW   (1 << 22)
 
#define MARTH   (1 << 23)
 
#define ROY   (1 << 24)
 

Functions

void addLogic (AI *ai, const Logic *logic)
 Add single logic rule to AI. More...
 
void addMove (AI *ai, const Move *move)
 Tell AI to execute a move. More...
 
void updateAI (AI *ai)
 Check logic rules and queued inputs. More...
 
bool needLogic (const AI *ai)
 Check if AI has no logic or inputs queued. More...
 
void clearAI (AI *ai)
 Clear all logic and inputs from AI (reset controller) More...
 

Detailed Description

Automated player.


Data Structure Documentation

struct AI

Holds all information about an AI.

Data Fields
Controller controller

Controller this AI uses

InputQueue inputQueue

Array of inputs to execute

Logic * logicQueue

Array of logic to evaluate

size_t logicSize

Size of logic/input arrays

size_t logicCapacity

Capacity of arrays

u32 characters

Characters this AI can control

u32 port

Port this AI plays at

u32 opponent

Port of this AI's opponent

bool active

Whether or not this AI is active in the game

Macro Definition Documentation

#define DR_MARIO   (1 << 0)

AI Character Bit Mask

#define MARIO   (1 << 1)

AI Character Bit Mask

#define LUIGI   (1 << 2)

AI Character Bit Mask

#define BOWSER   (1 << 3)

AI Character Bit Mask

#define PEACH   (1 << 4)

AI Character Bit Mask

#define YOSHI   (1 << 5)

AI Character Bit Mask

#define DK   (1 << 6)

AI Character Bit Mask

#define FALCON   (1 << 7)

AI Character Bit Mask

#define GANON   (1 << 8)

AI Character Bit Mask

#define FALCO   (1 << 9)

AI Character Bit Mask

#define FOX   (1 << 10)

AI Character Bit Mask

#define NESS   (1 << 11)

AI Character Bit Mask

#define ICE_CLIMBERS   (1 << 12)

AI Character Bit Mask

#define KIRBY   (1 << 13)

AI Character Bit Mask

#define SAMUS   (1 << 14)

AI Character Bit Mask

#define ZELDA   (1 << 15)

AI Character Bit Mask

#define LINK   (1 << 16)

AI Character Bit Mask

#define YOUNG_LINK   (1 << 17)

AI Character Bit Mask

#define PICHU   (1 << 18)

AI Character Bit Mask

#define PIKACHU   (1 << 19)

AI Character Bit Mask

#define PUFF   (1 << 20)

AI Character Bit Mask

#define MEWTWO   (1 << 21)

AI Character Bit Mask

#define MR_GNW   (1 << 22)

AI Character Bit Mask

#define MARTH   (1 << 23)

AI Character Bit Mask

#define ROY   (1 << 24)

AI Character Bit Mask

#define INIT_AI (   port_val,
  characters_val 
)
Value:
{ \
.inputQueue = INIT_INPUT_QUEUE(port_val), \
.logicQueue = NULL, \
.logicSize = 0, \
.logicCapacity = 0, \
.characters = characters_val, \
.port = port_val, \
.active = false \
}
#define INIT_INPUT_QUEUE(port)
Definition: input_queue.h:37
#define NULL
Definition: gctypes.h:45

helps with ai initialization

Function Documentation

void updateAI ( AI ai)

Check logic rules and queued inputs.

Parameters
ai- Pointer to AI struct
Returns
none
bool needLogic ( const AI ai)

Check if AI has no logic or inputs queued.

Parameters
ai- Pointer to AI struct
Returns
Return true if AI has no logic or inputs queued
void clearAI ( AI ai)

Clear all logic and inputs from AI (reset controller)

Parameters
ai- Pointer to AI struct
Returns
none