glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] New AI System


From: Bradley Arsenault
Subject: Re: [glob2-devel] New AI System
Date: Wed, 28 Jun 2006 21:51:46 -0700

As it stands now, the AI system interface is the most inconvient thing
i have ever created. The following is the required code to order an
inn to be constructed, using the constraints provided on the page:

//The main order for the building
AIEcho::Construction::BuildingOrder bo(IntBuildingType::FOOD_BUILDING, 2);

//Constraints arround the location of wheat
AIEcho::Gradients::GradientInfo gi_wheat;
gi_wheat.add_source(new AIEcho::Gradients::Entities::Ressource(CORN));
//You want to be close to wheat
bo.add_constraint(new AIEcho::Construction::MinimizedDistance(gi_wheat, 4));
//You can't be farther than 10 units from wheat
bo.add_constraint(new AIEcho::Construction::MaximumDistance(gi_wheat, 10));

//Constraints arround nearby settlement
AIEcho::Gradients::GradientInfo gi_building;
gi_building.add_source(new
AIEcho::Gradients::Entities::AnyTeamBuilding(team->team_id));
gi_building.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource));
//You want to be close to other buildings, but wheat is more important
bo.add_constraint(new AIEcho::Construction::MinimizedDistance(gi_building, 2));

//Constraints arround the location of fruit
AIEcho::Gradients::GradientInfo gi_fruit;
gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(CHERRY));
gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(ORANGE));
gi_fruit.add_source(new AIEcho::Gradients::Entities::Ressource(PRUNE));
//You want to be reasnobly close to fruit, closer if possible
bo.add_constraint(new AIEcho::Construction::MinimizedDistance(gi_fruit, 1));

//Copnstraints arround the location of the enemy
AIEcho::Gradients::GradientInfo gi_enemy;
gi_enemy.add_source(new
AIEcho::Gradients::Entities::AnyTeamBuilding(team->enemy_id));
gi_enemy.add_obstacle(new AIEcho::Gradients::Entities::AnyRessource));
//You want to be far from the enemy, so they can't attack your inns easily
bo.add_constraint(new AIEcho::Construction::MaximizedDistance(gi_enemy, 1));

//Add the building order to the list of orders
ai.add_building_order(bo);




The above code is verbose, long, much more than what feels nesseccarry
for the construction of an Inn. I really want to discuss the interface
with some people, hopefully to work it down to size.

I've enclosed the header for this interface. Be alert that none of
this is complete yet.

Attachment: AIEcho.h
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]