Green Rollover Red Rollover Arrow Rollover Focused Userbar Register Button Rollover Red Button Rollover
Welcome Guest ( Log In / Register )

Explanation of Empire At War's AI "engine"

Avatar of Drieick

Drieick

Category: Coding
Level: Intermediate
Created: Monday February 25, 2008 - 3:03
Updated: Monday May 5, 2008 - 22:43
Views: 6349
Summary: Taken from the forums, a tutorial on EAW's AI

Rating

Staff says

5.0

Members say

-

Average

5.0/5.0

1 vote

Page 1 2 3 4 5 6
Basic expression syntax
It's quite simple, really. You basically just follow the order of operations found in math. All you really need to know are the operators:

* = Multiply/can be used as a form of an "If" statement
+ = Add
- = Minus/Subtract
/ = Divide
> Greater than
< = Less than
() = Blocks of expressions which end up as one value
# = Unknown/I'm not sure what this operator means

The mulitply, I think, is the hardest to get used to, but it's quite easy. It can be used to multiply or an "If" statement. How? Well, remember how each function returns a value? Well, if one expression in that function require something and that requirement isn't met, then it returns 0; if it's true, then returns 1. Something such as this...

(Variable_Self.BaseLevel > 0)

...will return 0 if it's false and 1 if it's true. What's the point? The multiplication. If the statement is false and it's multiplied by something, then the result is 0. For example:


<Allowed_To_Retreat_From_Space>
    Game.IsCampaignGame
    *
    Variable_Self.CanRetreat
    *
    (1.0 - Variable_Self.IsFaction {Parameter_Faction = "Pirates"})
</Allowed_To_Retreat_From_Space>


If Game.IsCampaignGame returns 0, then the function returns a 0, no matter what the other values are. If Variable_Self.CanRetreat returns 0, but Game.IsCampaignGame and (1.0 - Variable_Self.IsFaction {Parameter_Faction = "Pirates"}) return 1, the whole thing is 0: 1 * 0 * 1 = 0.

Links / Downloads

 HitsAdded
NameSpace and TestFunction (Page 6)2607February 25, 2008 - 3:19
News article pertainting to tutorial3063February 25, 2008 - 3:07
The original thread2978February 25, 2008 - 3:06

Add comment

Please enter your message below. Max 10000 characters.