1 The FreeCiv AI Zack Ives Steve Wolfman CSE 590AG April 20, 1999.

Slides:



Advertisements
Similar presentations
STRUCTURES & STRATAGIES
Advertisements

Objective The student will learn basic skills of the simulation software. The student will use knowledge learned to develop a simulated city. The student.
Credit Card Option Announcement March 21, Exciting News! As of April 2, 2008 homeowners will be able to use Credit Cards with the current Version.
Heuristic Search techniques
Chapter Twelve The Citizen in Government Paying for Government ~~~~~ Raising Money.
Why do Empires Fall?.
2.1.4.G1 Setting Financial Goals Advanced Level. © Take Charge Today – August 2013 – Setting Financial Goals – Slide 2 Funded by a grant from Take Charge.
The Perfect Job Written and Presented by: Seikou Triangle.
Topics in Programming Reactive Systems Prof. Ronen Brafman and Dr. Gera Weiss.
Artificial Intelligence in Game Design Introduction to Learning.
1 PROCEDURAL DUE PROCESS. 2 Texas Education Agency provides Notice of Procedural Safeguards Rights of Parents of Students with Disabilities Download this.
SOUTHWEST ASIA (Middle East)
By Dr. David Agnew and Mr. Jim Wendell Arkansas State University Making Decisions.
ENGINEERING PROFESSIONALISM AND ETHICS EGN 4034 FALL 2008 CHAPTER 3-4 Organizing Principles.
BUDGETING Financing for Students The Basics of Financing for Students.
Savings and Investing Yes a PowerPoint by, Jon Jedziniak.
The Greedy Wall Building algorithm Rami Khouri. Ideal definition of Wall Either keeps valuable assets in, or enemies out…mostly keep enemies out Impassable,
Types of Local Governments
UNDERSTANDING VALUE THROUGH VISUAL QUADRANT ANALYSIS BY ELIZABETH BOETTCHER, RED BRICK MARKETING, INC. An Exercise For Small Business Owners.
This presentation will guide you though the initial stages of installation, through to producing your first report Click your mouse to advance the presentation.
Chapter 3 1) What is the first step in money management? – Organize your financial documents 2) What are two benefits to having your financial documents.
Chapter 17, Lesson 2.  Making a trade-off is giving up one alternative good or service for another.  If you choose to buy one thing, you may not be.
Summary Buyer or Seller: You will be randomly assigned to the role of a Buyer or Seller by the computer. Your role will remain the same throughout the.
Civ89 Instructions for PowerPoint. Getting Started Civ89 is a game of military, technological, and economic conquest played with two people, identified.
ECONOMIC DECISION MAKING IS PRETTY SIMPLE BECAUSE IT ONLY INVOLVES A FEW TERMS AND RULES. IN FACT, YOU PROBABLY ALREADY THINK ABOUT MANY PROBLEMS IN THE.
Starcraft Opponent Modeling CSE 391: Intro to AI Luciano Cheng.
Module 4: Systems Development Chapter 12: (IS) Project Management.
What is Economics? Chapter 18.
No Recourse to Public Funds 30 April The Scheme –The scheme is intended for victims of Domestic Violence (DV) who were previously admitted to,
Ch 7.2: Performing Qualitative Terrain Analysis in MoO3.
There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.
SKULLS OF THE SHOGUn AI POST-MORTEM Borut Pfeifer Developer: Haunted Temple Studios Publisher: Microsoft Platforms: XBLA, Windows Phone, Windows 8 Release.
Warm Up Turn to page 25 in your textbook Read “Consumer Action” What can Yolanda do to help her business be more profitable? How will she know if her price.
Personal Goals and Career Planning
OOAD Unit – I OBJECT-ORIENTED ANALYSIS AND DESIGN With applications
Using Credit SSEPF4.a, SSEPF4.b, SSEPF4.c. Loans and Credit Cards: Buy Now, Pay Later The U.S. economy runs on credit. Credit – The ability to obtain.
Job Creation transportation By Gyasi Edwards. Introduction: Have you ever wonder how bad the unemployment in Cincinnati is? Ever wanted to know how to.
School of Systems, Engineering, University of Reading rkala.99k.org April, 2013 Motion Planning for Multiple Autonomous Vehicles Rahul Kala Conclusions.
2.1.4.G1 Setting Financial Goals Advanced Level. © Take Charge Today – August 2013 – Setting Financial Goals – Slide 2 Funded by a grant from Take Charge.
Artificial Intelligence in Game Design Influence Maps and Decision Making.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Credit 411 UNDERSTANDING HOW CREDIT CARDS WORK ADAPTED FROM “THE ABCS OF CREDIT CARD FINANCE: ESSENTIAL FACTS FOR STUDENTS” BY CAROL A. CAROLAN, PH.D.
BUSINESS WITH CONFIDENCE icaew.com Budgeting – personal finance for students Rebecca Benneyworth MBE BSc FCA.
IT ISN’T GOING TO BE LIKE THIS PERSONAL FINANCE & ECONOMICS.
SOUTHWEST ASIA (Middle East) Economic Understandings.
Chapter 1 Choosing Which Debts to Pay First. First Steps to Dealing with Debt Problems Most people in financial distress will first want to deal with.
How To Build Your Own Country. Have you ever wanted to just be ‘the boss’? To make all the decisions, to say how things ought to be run? Of course you.
Setting Financial Goals
Setting Financial Goals
Quiz: How Are Your Meetings
Corin Anderson Eric Anderson Geoff Hulten Tessa Lau
Setting Financial Goals
Announcements Homework 3 due today (grace period through Friday)
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Setting Financial Goals
Presentation transcript:

1 The FreeCiv AI Zack Ives Steve Wolfman CSE 590AG April 20, 1999

2 Cheesy Heuristics!  Mostly a series of rules with weights and randomness  Different options are evaluated for desirability  Roulette-wheel-style ai_fuzzy function decides whether AI will follow heuristics  Mostly a peer-model agent structure with a bit of hierarchy, mostly re-evaluating at each turn  Different AI’s to control cities, tech advances, units, etc.  (Though military AI is somewhat hierarchical; both coordinator to assign roles and a unit-level AI)  Each AI gets “votes” weighting decisions

3 The AI Files  aihand - main AI routines  aicity - city-level AI  aitech - tech goal AI  aitools - utility routines (choose wonders, govt)  aiunit - unit-level AI; settlers - settler AI (in server)  advdomestic - intra-city advisor (worker placement, valuation of improvements)  advisland, advscience, advtrade, advattitude - blank  advmilitary - offense & defense for units  server/citytools - city/worker reasoning functions

4 General AI Components  In aihand, several important functions:  ai_manage_units - control units, assess defense & offense & needs  ai_manage_cities - control city building, spending  ai_manage_taxes - set tax/science/luxury rate  ai_manage_government - set government style  ai_manage_tech - tech advances  No coordinating AI, but inter-module communication

5 Interesting Ideas  Bodyguard  if city already defended, defensive unit will try to find a low- defense “charge” and AI will coordinate movement  Urgency and value  Cities and domestic and military advisors collaboratively determine how valuable improvements, reinforcements, or new technologies will be, and how urgently they’re needed  Tech is valued according to needs noticed throughout movement, building, …  Sacrifice  If city is ready to be conquered, try to sell what you can

6 What the AI Emphasizes  Wonders and caravans  Diplomats If opponent’s diplomat or spy is nearby, builds diplomat for defense  Builds up money to buy improvements  If troops not serving purpose, AI brings them home  Transports try to land near destination  Republic and “We love the consul day”

7 Cheats Apparently not as many as we’d think!  AI has knowledge of full map and enemy unit locations  AI has no penalty for changing what’s being built  At higher difficulty levels, AI not constrained by maximum rates on tax, science, etc.  Civil disorder - last-second fix for unhappy city (though does suffer effects if unable to make city happy)  AI changes government for free (no Anarchy)

8 The Unit AI - Structure  In aiunit and advmilitary  Main function ai_manage_units  ai_manage_settler  ai_manage_caravan  ai_manage_ferryboat  ai_manage_explorer  ai_manage_military: based on role, auto-settle, build city, defend home, attack, fortify, run, escort, explore  Can ask for units (ai_wants_role_unit) and get closest possible match (due to tech limitations)

9 The Unit AI - What It Does  Settlers - auto_settler_findwork  Check terrain for value as city  Rate usefulness of mining, roads, irrigation, detox, etc.  Exploration  Top priority = huts  Then randomly explore  Caravan  Find city building wonder not near completion, send caravan

10 Unit AI - Military  Calculate belligerence (offensive rating), vulnerability (defensive rating) of units  Military finds victim based on attack power vs. vulnerability  Bodyguard - extra defensive unit finds vulnerable unit, becomes its bodyguard; AI synchronizes movement  Assigns roles to units (auto-settle, build city, defend home, attack, fortify, run, escore, explore)  find_something_to_kill - main controlling function for coordinating attacks  generate_warmap - assessment of distances, possibilities, & costs of moving & attacking  Choose most appealing targets, send forces to eradicate

11 Military Advisor  Assess danger due to opposing forces  Assess city defenses  If city in danger, may specify desire for coastal fortress, SAM, SDI  Based on this, may want prerequisite new technologies  Assess offensive capability and desires  May wish to build new units, acquire new technologies  Decide what to kill

12 The City AI - structure  In aicity and advdomestic  Main function in aicity is ai_manage_cities  ai_manage_city - arrange workers  ai_manage_buildings - globally important bldgs (palace & wonders)  ai_city_choose_build - locally evaluate buildings (calls domestic advisor)  Main function in advdomestic is ai_eval_buildings  individually rates each type of building according to food/prod/gold/bulb  considers luxury result in terms of new available workers

13 Money Management in the City AI  Money spent based on collaborative needs (“votes”)  Considers cities in order of greatest need  Tries to buy something for every city  Becomes frugal with remaining money if ever it cannot afford something “important” (highly desired)  Some heuristics restrict buying  Don’t spend too much at once (except for high want)  Don’t build Wonder in threatened city

14 Taxes, Luxury, and Sciency (oh my!)  Handled in ai_manage_taxes (in aihand )  Luxuries considered first  Only if government is Republic  Try to maximize population gain from “we love the consul”  Sacrifice if leaves insufficient tax rate to acquire needed funds or if unable to reach optimal celebration point  Taxes next  Gathers enough money to cover expenses plus population dependent “spare change” requirements  Science gets leftovers

15 Government changes  Simple module (partly because AI cheats!)  Different possible goal governments define track  Change as soon as next government on track becomes available  No backtracking to earlier government  Current AI hardwired to Republic track

16 Useful code  AI code is hard to reuse  AI uses many server structures unavailable to client (e.g., warmap)  Shared structures (such as tech_want ) are hard to disentangle from code  Smallest functions most useful  City calculations in advdomestic such as pollution caused/ameliorated by an improvement  Danger assessments?

17 Bonus: FreeCiv AI Fun!  “hhjj” is a structure used to calculate celebration levels in cities at various luxury levels… what does hhjj stand for?

18 Technology  tech_want structure maintains desire levels for various techs  Each component can up tech requirements  Military wants better units/transports  Missing wonder/governments cause want for enabling techs  Global AI adds hardwired want for Republic track techs  Cities want enabling techs for buildings  Global AI fudges philosophy want upward (if not developed yet)  Prerequisites of desired tech weighted  Weights reduced according to time to reach tech