You must be logged in to post messages.
Please login or register

The University

Hop to:    
Topic Subject: Finaldeath's AI Tutorials
posted 11-13-12 06:35 AM CT (US)   
Hi all, Finaldeath from the AI Scripting Forums

I'm going to start posting up text and images for a long set of AI tutorials...

  • User Patch based: shows off the power of goal manipulation and information processing
  • Basic introduction to get the bare bones of an AI present
  • Sectioned information on everything; basics onto advanced subjects
  • Heavy focus on setting up structure, not copying and pasting huge examples which require existing code from previous tutorials. This allows existing AI authors to use it, and for new users to pick and choose what to implement (beyond the basics).

    I need to have some posts here to sort formatting. I'm writing all the text and gathering images as necessary, but I need to know if I should format HTML for the necessary code highlighting and other things.

    I also think it might be necessary to, while having the different tutorials split up, them all linked as one big article; is this possible? (Rather then filling up the University with a ton of articles all at once; which would be a bit spammy!).

    I also might just finish them over the course of a few months; I have several already written, but a few are both waiting on UP changes or are things I am myself not too great at so need to finish writing bits of my own AI to document it!

    I'm also looking for feedback; what the content should be and how I write it. I am willing to rewrite large sections and add in things as necessary.

    Currently these are my plans (with notes), subject to abject change on a whim:
    Tutorials to write:

    Basics Series.

    Possibly include User Patch in all of them from the start, makes it a lot easier!

    - Basics 1: Introduction to AOK2 AI Scripting
    - Hello world example
    - comparison with other scripting/coding
    - Basics 2: Rules, Commands and Constants
    - defrule/defconst (integers and strings) and comments
    - facts and actions
    - disable-rule, up-jump-rule
    - Basics 3: Goals and Timers
    - set-goal, up-modify-goal, etc.
    - up-timer-status
    - Basics 4: Strategic Numbers
    - How they work, what ones sync...
    - Basics 5: Load - Loading More Files
    - (load) (load-random)
    - Basics 6: System Symbols
    - #load-if-defined XXX

    Advanced Series

    Everything else! Everything is pretty in depth! But more seriously have to have these separately:

    - Advanced 1: File / Rule / Constant / Loading In Depth
    - Advanced 2: Debugging
    - up-chat-data-to-all / up-chat-data-to-player / up-chat-data-to-self / up-get-cost-delta
    - Advanced 3: Optimisation (maybe just merge with rest of the things):
    - up-jump-rule
    - SN syncs over network
    - high lag actions
    - moderate lag facts


    - Scouting 1: Basics, Scout Cavalry/Eagle Warrior
    - Scouting 2: Civilian Scouting
    - how to do post-game-start/with gatherers?
    - Scouting 3: Advanced Scouting
    - UP functions, resetting scouts, reassigning groups, use when attacking/retreating or not
    - up-disband-group-type, up-send-scout
    - Notes about up-retreat and up-stop

    Economy Series.

    - Economy 1: General Resource Gathering
    - up-gaia-type-count, up-gaia-type-count-total
    - Economy 2: Food Gathering (Boar, Deer, Forage, Farming, Fishing)
    - How to do each of the types
    - up-remaining-boar-amount, up-request-hunters
    - Economy 3: Wood Gathering (Lumber camps)
    - How to build next to nearby wood if possible, and expand radius well over time with possible dual drop sites
    - Economy 4: Mining (Gold and Stone)
    - How to build next to what we see as the nearest stone and gold piles
    - Economy 5: Escaping an attacked camp
    - How to build a further camp at another resource patch rather then suicide gathering from an existing one
    - Economy 6: Advanced Economy
    - up-drop-resources, up-retask-gatherers

    Escrow Series

    - Escrow 1: What is Escrow?
    - Escrow 2: Basic Escrow Usage
    - Escrow 3: Advanced Escrow Usage
    - Cost data (up-setup-cost-data, up-add-cost-data, up-reset-cost-data)
    - up-modify-escrow, up-release-escrow


    - Population 1: Population Percentages
    - Population 2: Management and Deletion
    - up-delete-idle-units - as well as detecting when certain units are useless (Trade Carts/Cogs, Fishing Boats)


    - Information 1: Your own facts
    - Your pop, unit counts, etc.
    - up-get-fact, up-resource-amount, up-resource-percent
    - Information 2: Your allies facts
    - Their goals, coordination, use for auto trading/feeding
    - up-allied-goal, up-allied-resource-amount, up-allied-resource-percent
    - up-get-focus-fact
    - Information 3: Your enemies facts
    - Military pop, unit counts, etc.
    - up-get-player-fact, up-get-fact-max, up-get-fact-min, up-get-fact-sum
    - target-player; up-get-target-fact

    Training Units

    - Training 1: Training Units
    - Checking if things are being trained too
    - up-pending-objects
    - up-train-site-ready
    - up-train
    - Training 2: Escrow Usage
    - Training 3: Garrisoning and Release
    - Advanced technique
    - up-ungarrison, up-gather-inside
    - Training 4: Water Unit Training
    - Same body of water etc. SNs


    - Research 1: Researching Upgrades
    - up-research, up-research-status
    - Research 2: Escrow Usage
    - Research 3: Automatically Build Research Buildings
    - Research 4: Advanced: Cancellation
    - Research 5: Age Progression (Advanced)
    - How to codify conditions to age up
    - Set amount of villagers (noting fishing ships?)
    - Set research (Loom/Wheelbarrow/Hand Cart usually)
    - 2+ Town Centers or masses of resources
    - Rush conditions versus Boom conditions
    - Detecting when we are progressing
    - Build things in preperation for the next age
    - Keep training villagers!


    - Construction 1: Building Basics
    - Construction 2: Advanced Building Techniques
    - up-assign-builders, up-can-build, up-build, up-set-placement-data, forward building etc.
    - up-pending-objects, up-pending-placement
    - up-reset-building
    - Construction 3: Farms
    - up-delete-distant-farms, farm usage due to max food distance, etc.
    - Construction 4: Towers and Outposts
    - Forward, and specifically notes about minimum build distance.
    - Tower elevation SN
    - Defending specific places
    - Construction 4: Walls
    - All wall information
    - Construction 5: Docks
    - Constructing together/apart, same body of water, etc.

    - When and what
    - Repair SN

    Attacking and Defending:

    - Attack and Defence 1: How the AI works by default
    - Attack and Defence 2: How attack groups work
    - SNs and attack-now
    - up-disband-group-type, up-reset-attack-now
    - up-reset-target-priorities, up-set-offense-priority
    - Attack and Defence 4: How siege units work
    - Siege units are: Rams, Trebuchet, Petards
    - Non-siege siege units: Mangonel, Scorpion, Bombard Cannon
    - Attack and Defence 3: How defence groups work
    - up-defender-count
    - up-reset-target-priorities, up-set-defense-priority
    - Attack and Defence 5: Town Under Attack!
    - up-attacker-class, up-get-attacker-class, up-get-projectile-player, up-get-threat-data
    - up-building-type-in-town / up-enemy-buildings-in-town / up-enemy-units-in-town / up-enemy-villagers-in-town / up-unit-type-in-town / up-villager-type-in-town
    - up-projectile-detected / up-projectile-target
    - Attack and Defence 6: Advanced Defence
    - up-garrison, up-gather-inside (defending army)
    - Attack and Defence 7: Unit Micro
    - up-reset-unit, up-retreat-now, up-retreat-to
    - up-set-attack-stance

    Targeting Enemies

    - up-find-player, up-player-distance
    - team fights, helping allies

    Diplomacy and Communication (to be split)
    - Human Communication via. text
    - Computer Communication via. goals
    - Taunts (reacting to/using)
    - Alliances (detecting and setting stance towards players)
    - Trading

    Names and Personality
    - Setting a new AI name ( up-change-name )
    - Taunting
    - Communication with allies

    - Graceful resign (tributing resources, deleting buildings, telling everyone)
    - Human-like detection of defeat (large military force opposing you late game with few troops, early loss of population, etc.)

    Strategy and Tactics

    - Boom or Rush?
    - Army planning/composition
    - Detection of enemy forces
    - Counter units
    - Changing strategy

    Game Types (order from in game sans Scenario). Possibly one article?

    - Game Types 1: Random Map
    - Default stuffs; including victory condition options
    - Game Types 2: Turbo Random Map
    - Faster except villager production
    - Game Types 3: Regicide
    - Conquest with additional "Lost King" condition
    - Extra castle!
    - Different resources
    - Game Types 4: Death Match
    - Extra resources
    - Game Types 5: King of the Hill
    - Standard apart from large area in the middle; possibly not accessible if islands.
    - Basic commands to attempt to win at it...
    - Game Types 6: Wonder Race
    - No combat, first wonder built wins...
    - Pretty boring and basic.
    - Game Types 7: Defend the Wonder
    - Bonus resources
    - Defending and attacking team(s) (who may not be allied!)

    Starting States

    - Starting States 1: Starting Age
    - Dark Age to Post Imperial Age, suggestions and strategies
    - Starting States 2: Starting Resources
    - Low (normal), Medium, High, how it affects strategy
    - Starting States 3: Teams
    - Positioning (flank/pocket knowledge), how to scout, detection for trade routes

    Victory Types

    Applies to what game types?
    - up-get-victory-data
    - Standard
    - Wonder, Conquest, Relics
    - Conquest
    - Basic info
    - Time Limit
    - Basic info
    - Score
    - Special game-type cases

    Game Maps; possible one article?

    - Game Maps 1: General Info
    - Usual distributions of resources, players, wolves
    - General amount of space for building (and noting distance between players - min/max along with info on differnet map sizes)
    - Game Maps 1: Land Maps
    - IE: No large body of water whatsoever
    - Game Maps 2: Mixed (Water) Maps
    - IE: Connecting land but has sea fish/large water body
    - Game Maps 3: Island Maps
    - IE: No connecting land between players
    - Note about map sizes; these ones are larger!
    - Note about detecting island maps
    - Game Maps 4: Arena and Fortress
    - Note about walls/strategy/extra things we get/don't get
    - Game Maps 5: Nomad
    - No scout, TC, spread out etc.
    - Game Maps 6: Michi maps
    - Imperial Rush
    - Game Maps 7: Migration
    - AI's can't play them! Some notes though.

    Difficulty Settings

    - Difficulty 1: Built in Difficulty Changes
    - Big note on adjust-difficulty-auto-disable SN
    - Notes on SNs automatically changed if not disabled
    - Big note on Hardest extra resources
    - Notes on all in built difficulty levels and changes
    - Simple tips to decrease AI difficulty outside of Hard/Hardest, aim is to build for Hard/Hardest however.

    - Difficulty 2: Tuning AI for different difficulties

    In-depth on Game Data (basically Erreta)
    - Hidden Data: Siege Armor/Siege Attack, building armor, fortified building armor
    - Hidden Data: Attack speed, "Damage Per Second"
    - Hidden Data: Attack bonuses versus units (eg: spearmen versus cavalry, also inc. things like villagers versus buildings)
    - Hidden Data: How Monks convert units
    - Hidden Data: Gaia Unit Stats: Wolves and Boar attack/armor, Villager Hunter attack bonuses.
    - Ballistics - who it affects (note about cannons and Spanish)
    - Thumb Ring - who it affects (note about All Techs and Britons for instance)
    - Bugs:
    - Fervor not affecting non-Relic carrying monks (fixed in FE)
    - Trample Damage

    Broken things

    - Spies and scouting LOS/counting issues
    - Seeing enemy upgrades are impossible (but you can usually detect unit line upgrades)
    - Wall attacking and focusing is difficult
    - Formations for groups, focus fire
    - Transport ships; esp. building on other islands with villagers (impossible!)
    - Deleting certain buildings until damaged (walls, houses)
    - Suiciding monks (going to relics), scouts (going to explore the same places) and armies (walking past castles/enemy units)
    - No stances for monks; always attacking/will always form groups
    - No walls on Nomad and Islands maps (but island detections!)

    Finaldeath (AOK AI Maker)
  • Replies:
    posted 11-15-12 05:37 PM CT (US)     1 / 11  
    This looks like it could be very promising. Are you from AIScripters?
    posted 11-15-12 06:13 PM CT (US)     2 / 11  
    Yeah, he is. I directed him here.

    FD, I'll take a look over this list in more detail later tonight, but it looks quite nice at the moment.

    ~`o~|\  Join the fresh and exciting AI Ladder for its fourth season!
     `  |_\
           |    Learn the joy of AI scripting in my guide: The World of AI Scripting
     \        /
       .....Hinga Dinga Durgen! - SpongeBob
    posted 11-15-12 06:19 PM CT (US)     3 / 11  
    You have a lot of work to do.. GL!
    posted 11-16-12 07:31 AM CT (US)     4 / 11  
    Will take me a little while but I don't have to release it all at once. A lot of the smaller sections are only a few pages long w/code.

    Finaldeath (AOK AI Maker)
    posted 11-16-12 08:24 AM CT (US)     5 / 11  
    We'll figure out how to organize it all. You can just write the articles, and we'll do the rest. You can do it all in BB code if you like. We use a utility to convert the BB code to HTML.

    ~`o~|\  Join the fresh and exciting AI Ladder for its fourth season!
     `  |_\
           |    Learn the joy of AI scripting in my guide: The World of AI Scripting
     \        /
       .....Hinga Dinga Durgen! - SpongeBob
    posted 11-16-12 11:04 AM CT (US)     6 / 11  
    Looks good, this also might help me to get into AI scripting.

    posted 11-18-12 09:27 PM CT (US)     7 / 11  
    If you want to AI script, you should probably go to AIScripters. Its a whole forums with nice people most of whom are AI scripters and are willing to help answer your questions.
    posted 11-20-12 09:24 AM CT (US)     8 / 11  
    Really interesting article. I'm an expert scripting for 1.c, but my knowledges of UP stuff are still not spectacular. I'll read these articles once finished.

    P.D: Lazarus is right, aiscripters is a wonderful place to learn and discuss things about AI scripting, and with a lot of stuff and scripts.

    Crusade 4.42a. Every setting. AI compatible with UserPatch 1.1
    Xafaxarcos 1. The first chapter of my unfinished AI tutorial
    posted 12-03-12 10:41 AM CT (US)     9 / 11  
    Okay progress:

  • Basics - mostly done
  • Advanced - done debugging
  • Scouting - still testing (basics started)
  • Economy - market usage done, rest is testing (see construction)
  • Escrow - in testing (basically is economy, see construction)
  • Population - basics done
  • Information - basics done, testing finished
  • Training units - not started - doing Buildings first, needs some specifics testing before I start
  • Research - not started - doing Buildings first, needs some specifics testing before I start
  • Construction - hooboy. A lot of mess in the build system unlocked with 1.1 means a lot more testing. Done a ton, got a bit more to do. Written up half of this. Ties in with economy (resource usage) and unit training (in similarities to phantom resource usage)
  • Repairing - pretty basic, done a little
  • Attacking and Defending - Still got a lot to test, but got some basics done.
  • Targeting Enemies - not started
  • Diplomacy and Communication - not started, but got a general idea and most research done
  • Names and Personality - ideas down, not started
  • Resigning - not started, but is pretty short
  • Strategy and Tactics - not started, needs more research
  • Game Types - most game data research done, pretty much listing it left.
  • Starting states - most research done
  • Victory Types - research done, not started
  • Game Maps - most research done. A few things need sorting, specifically detecting ocean and water maps correctly.
  • Difficulty Settings - research done
  • Broken Things - apart from being told some of these "are not broken" as it were, I still need to expand this list.

    Progress continues! I'll need to start doing more screenshots and videos of tests to show how changing SNs and settings changes how the AI works too.

    Finaldeath (AOK AI Maker)
  • posted 02-27-14 02:07 PM CT (US)     10 / 11  
    Please forgive if I am simply overlooking where the finished Tutorial(s) is (are) located. I cannot find them - did you finish and post them yet, FD?

    (Also, a bit new/old to this forum - as the overall post-rate is slower than other forums I use, what is the stance around here about necro posting?)

    a.k.a. rob77dpAOE
    Author of: "f1@$h" AoC AI's
    "Bears eat beets. Bears. Beets. Battlestar Galactica."
    -Jim Halpert
    posted 03-19-14 11:16 PM CT (US)     11 / 11  
    In general, I would check the AI & RM scripting forums and the University...but I have not found these articles there either. But feel free to double check, it never hurts.
    Age of Kings Heaven » Forums » The University » Finaldeath's AI Tutorials
    You must be logged in to post messages.
    Please login or register
    Hop to:    
    Age of Kings Heaven | HeavenGames