Version 1 (modified by trac, 16 years ago) ( diff )

--

This development notepad is an organized way to jot down preliminary API decisions. Nothing is finalized. If it doesn't add up, it WILL change.

TODO

Decision Tree Generation
Event Handler
State Machine

Mediator

Mediators encapsulate how a set of objects interact. We will have a mediator that describes the heirarchy and how the nodes (objects) relate to eachother. A scripter could choose to create his own mediator to change the way the AI "thinks". For example, one could make it so Military interacts directly to Economy and Diplomacy instead of having to go through Commander. The nodes somehow will be responsible for the pieces of the State Machine that pertain to it probably using a chain of responsibility or simply encapsulating it by node which is much more flexible.

The interaction between nodes will need handlers to Filter Up and Specify Down the various messages it needs to work with.

Filter Up:
We will need to create objects that can analyze an array of recieved messages and return a more general state/need. When it does that, it also removes the states/needs it used to make the recognition.
Specify Down:
We will also need objects that can intelligently seperate messages into smaller messages.

Commander

The Commander node makes sure everything is up to date and creates the strategies the other nodes must accomplish.

Economy

The Economy node makes sure the economy is running as smoothly as possible and decides on how to manage civilians based on needs.

Diplomacy

The Diplomacy node handles issues that can be categorized as diplomatic and political. The major role of diplomacy is communicating with the AI: Player to AI and AI to AI. The Diplomacy node can send messages to any AI's Commander node. It's the only way to communicate, it should not be possible to directly communicate with other nodes. Player to AI communication could simply be taking notice of all available ways a player can communicate such as signals and chat. The node can then decide what to do with that information.

Military

The Military node develops military tactics to accomplish goals set by the Commander.

Groups

The Groups node is the Flocking logic of the game.

Units

The Units node is the lowlevel logic for units such as attack, walk, garrison, etc.

Decision Trees

Constraints

Learning

The AI can be capable of learning by remembering past experiences. Experiences can be outlined using the route chosen in a Decision Tree. The AI could learn as it plays the game by figuring out which past decisions were more favorable to reach a defined goal.

State Machine

Game

State

string Game.getMap()

Player Game.getPlayers()

Resource Game.getStartingResources()

int Game.getTime()

int Game.getType()

int Game.getStartingPhase()

int Game.getMapSize()

int Game.getBorderTimer()

int Game.getMaxCenters()

int Game.getVisibility()

int Game.getPopCap()

int Game.getDifficulty()

int Game.getVictoryCondition()

bool Game.isOnline()

bool Game.hasTeams()

bool Game.hasTeamsLocked()

bool Game.cheatsEnabled()

bool Game.playerInGame(String player)

bool Game.playerResigned(String player)

int Game.buyingPrice(String resource)

int Game.sellingPrice(String resource)

Action

void Game.chatLocalToSelf(String message)

void Game.chatToAllies(String message)

void Game.chatToNeutrals(String message)

void Game.chatToEnemies(String message)

void Game.chatToPlayer(String player, String message)

void Game.tauntLocalToSelf(int tauntID)

void Game.tauntToAllies(String message)

void Game.tauntToNeutrals(String message)

void Game.tauntToEnemies(String message)

void Game.tauntToPlayer(String player, String message)

void EventHandler.acknowledgeEvent(String eventID, String player)

void EventHandler.acknowledgeSignal(String signalID, String player)

void EventHandler.disableTimer(int id)

void EventHandler.enableTimer(int id, int time)

Players

State

string Player.getCiv()

bool Player.receivedResourceFromPlayer(String resource, String player)

int Player.resourceAmountReceivedFromPlayer(String resource, String player)

int Player.getID()

int Player.getScore()

int Player.getPhase()

int Player.getTimeInAge()

int Player.getCurrentPop()

int Player.getEconomicPop()

int Player.getNonEconomicPop()

Resource Player.getResources()

array Player.getUnits()

array Player.getStructures()

bool Player.isDefeated()

bool Player.canAffordUnit(Type)

bool Player.canAffordBuilding(Type)

bool Player.canAffordTech(Type)

bool Player.canAffordWall()

bool Player.canBuy(Type)

bool Player.canSell(Type)

bool Player.canResearch(Type)

bool Player.canTrain(Type)

bool Player.canBuild(Type)

int Player.getBuyPrice(Type)

int Player.getSellPrice(Type)

int Player.numEnemyBuildingsInTown()

int Player.numEnemyBuildingsOfTypeInTown(Type t)

int Player.wallCompletedPercentage(int perimeter)

int Player.wallInvisblePercentage(int perimeter)

int Player.stanceToward(String player)

Action

void Player.tribute(Player, int food, int wood, int stone, int ore)

void Player.resign()

void Player.setStance(Player, int)

void Player.research(Type)

void Player.buy(Type)

void Player.sell(Type)

void Player.declareCentralObject(Type t, Array pos)

void Player.declarePlayerCentralObject(String player, Type t, Array pos)

void Player.build(Type t, int distance)

void Player.buildAtPos(Type t, Array pos)

void Player.buildForward(Type t, String player, int distance)

void Player.buildWall(int distance)

void Player.buildWallAroundPlayer(String player, int distance)

void Player.train(Type unitType)

void Player.trainInBuilding(type unitType, Building b)

void Player.acknowledgeTribute(String resource, String player)

Resources

State

int Resource.getWood()

int Resource.getFood()

int Resource.getStone()

int Resource.getOre()

int Resource.getMinDistance()

Structures

State

array Structure.getWaypoint()

int Structure.getPercentConstructed()

Unit Structure.getLastAttacker()

int Structure.getLastAttacked()

bool Structure.isConstructing()

bool Structure.isConstructed()

bool Structure.isLocked()

bool Structure.isQueued()

bool Structure.isUnderAttack()

Action

void Structure.setWaypoint(x, y)

void Structure.train(Unit)

void Structure.cancel(Unit, amount = 1)

void Structure.lock()

void Structure.unlock()

void Structure.delete()

Units

State

array Unit.getPosition()

int Unit.getCurrentHP()

int Unit.getMaxHP()

int Unit.getCrushArmor()

int Unit.getHackArmor()

int Unit.getPierceArmor()

Type Unit.getType()

int Unit.getCurrUP()

int Unit.getNextUP()

Unit Unit.getLastAttacker()

int Unit.getLastAttacked()

bool Unit.isBalanced()

bool Unit.isAggressive()

bool Unit.isDefensive()

bool Unit.isDead()

bool Unit.isIdle()

bool Unit.isRepairing()

bool Unit.isConstructing()

bool Unit.isPatrolling()

bool Unit.isHealing()

bool Unit.isEscorting()

bool Unit.isAttacking()

bool Unit.isGathering()

bool Unit.isGatheringWood()

bool Unit.isGatheringFood()

bool Unit.isGatheringStone()

bool Unit.isGatheringOre()

bool Unit.isGarrisoned()

array Unit.getPosition()

int Unit.getCurrentHP()

int Unit.getMaxHP()

Action

void Unit.repair(Structure)

void Unit.patrol(array, array)

void Unit.heal(Unit)

void Unit.escort(Unit)

void Unit.attack(Unit)

void Unit.attackPlayer(Player)

void Unit.gather(Type)

void Unit.move(x, y)

void Unit.garrison(Structure)

void Unit.construct(Type, x, y)

void Unit.buildWall(array, array)

void Unit.delete()

Entity Filters

Note: See TracWiki for help on using the wiki.