Announcement

Collapse
No announcement yet.

Fuzzy logic files (*.fli)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fuzzy logic files (*.fli)

    CivCTP doesn't allow you to program the AI itself, but it does provide an apparantly powerful ability to adjust the parameters controlling how the AI works, through the *.fli files. The syntax of those files is pretty clear, but I've only been able to make some guesses about their semantics. Could someone confirm/deny/supplement the following guesses?

    SYNTAX
    ======
    In the following syntax descriptions, items surrounded by _underscores_ are placeholders to be filled in by the programmer; the other words are fixed. a|b means that either a or b may be chosen.

    The files are broken up into short sections. Each section starts with either:

    input _variablename1_

    or

    output _variablename1_ [_minimum_,_maximimum_]=_default-value_

    Within each section, one or more entries as follows are defined:

    left|tri|right _functionname_(_variablename2_,
    _center_, _half-width_)

    In most cases, _variablename2_ matches _variablename1_; I'm not sure whether or not the few exceptions are typos, or do something unusual that I haven't figured out yet.

    A section can also contain C-like if-blocks:

    if(_condition_)
    {
    _output-function-list_
    }

    A _condition_ can be any of the following things:
    _input-functionname_
    not _condition_
    _condition_ and _condition_
    _condition_ or _condition_
    ( _condition_ )

    SEMANTICS
    =========
    The names I've used in the above syntax description reflect my current best guesses as to what they mean. Each main file in the *.fli system has inside it a name that contains "fuzzy", which inclines me to interpret the evidence in terms of some kind of fuzzy logic system.

    I believe that input functions evaluate a fuzzy true-false condition dependent upon the named variable. I'm guessing that "tri" stands for "triangle"; that "tri" functions define a truth value that is 1.0 (true)
    if the variablename has the specified _center_ value, droping linearly by 0.5 for values at _center_ +/- _half-width_, and all the way down to 0 for values twice that far from _center_, or more.

    I think that left functions evaualuate to 0.50 at the _center_ value, and rise linearly to 1.0 for values of _center_ - _half-width_ and lower, and drop linearly
    to 0.0 for values of _center_ + _half-width_ or higher.
    Right functions are the mirror image of left functions. I suspect that "not" subtracts the fuzzy-truth value from 1.0, "or" adds the fuzzy-truth values, and
    "and" multiplies them. The final number is used as the probability that the body of the if() statement is executed.

    Some of the variables used by input functions have values that are apparently set by the game itself, but the output functions appear to provide another way of setting a variable.

    I named parts of an output declaration _minimum_, _maximum_, and _default-value_, because that's my best guess of what those parts mean. I suspect that output functions assign a randomly generated value to the
    specified variable name, and that value must be in the range from _minimum_ to _maximum_; if no output function for that variable has yet been executed, the value is _default-value_.

    For "tri" functions, the variable is generated according to a probability distribution proportion
    to the fuzzy-truth value that would be returned if it was an input function.

    For left and right functions, they are generated with a
    probability that matches the part of the function that slopes from _center_ - _half-width_ to _center_ + _half-width_.

    Can anyone confirm/deny these guesses, or point me at a source that explains how *.fli files really work?

  • #2
    Kuyper,

    Check your e-mail.

    Peter

    Comment

    Working...
    X