There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

13
There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman

Transcript of There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Page 1: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

There’s no such thing as aFreeCiv

Marc Friedman

Ed Hong

Jon Nowitz

Steve Wolfman

Page 2: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

BIDDY: the Auction DAI• Goals

– agents compete for resources– agents control their resources independently– mediation is simple, extensible, lightweight– simple way of distributing competitive power– agents don’t reason about other agents

• Vision– income controls power of agents– resource conflicts settled through auction– maintenance costs promote sales

Page 3: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Philosophy: Steal, steal, steal!

• Steal the map from the client (done!)– Their client and server have almost identical

models of the world– Use their client’s data structures directly– Use their mutators to keep up-to-date

• Steal the UI from the client (done!)– Run CIVY as a separate executable– Do NO UI work in BIDDY

• Steal the logic from the AI– How much we can use remains to be seen

Page 4: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

BIDDY Nitty-gritty

• Language - C/C++ with LEDA libraries– Agents in C++– Stolen stuff (like map) in C

• Platform - platform independent– eXcised X from client -- just uses sockets– CivY runs separately

• Visualization - no direct visualization for client, view actions with CivY

Page 5: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Architecture of BIDDY

• Agents control some behavior independently• Factories (city production) and units are resources• Bidders (a subset of agents) can own resources• Each new year,

– Resources are bought and sold at auction– Agents GO in random order, controlling their

resources, spawning child agents, and disappearing– Agents can register handlers for asynchronous

events they are interested in• Use OLD BIDDY for behaviors that don’t fit

Page 6: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Agents and Bidders

• PLAYER -- divvies up currency, manages new and unwanted resources

• GROWTH -- settlement & improvement• OFFENCE -- conquest• DEFENCE -- garrisons, forts, roads• EXPLORE -- map territory by land and sea • GOVERNMENT, SCIENCE, POPULACE• ONE FOR EACH CITY - to buy their own

production

Page 7: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Division of Labor

• Jon -- PLAYER module, AUCTIONEER• Marc -- agent/client interface, interagent com

protocols, shared data structures, GROWTH module

• Steve -- CivY, OLD BIDDY, EXPLORER, POPULACE

• Ed -- CITIES, DEFENCE• Nobody yet -- OFFENCE

Page 8: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Old Biddy: the FreeCiv AI

• Port of server-side FreeCiv AI into client

• Main fixes– handle unknown territory (explore and reason

about danger/value)– understand penalties for build changes– support server-side data-structures (e.g., settler

minimap)– stop cheating in various other ways

Page 9: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Old Biddy: performance• Reasonably fast

– large civ handled in a few seconds (10-15)

• Reasonably effective – explores, settles, researches, builds wonders (oops),

defends cities, …

• Worse than built-in AI– consistently near the bottom of games– primarily too chicken of unexplored territory

compared to all-knowing enemies

Page 10: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Broker & Banker

• Distributes income based on events & heuristics TBA– exploration agent receives income based on #

of unexplored tiles– defense agent receives income based on phase

of game?

• Controls player bank accounts– no cheating (overbidding) allowed

Page 11: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Auctioneer• Collects resources for auction

– all unallocated units– city production which has just completed– new resources and leftovers from last year– agent-owned resources put up for sale

• Collects bids– bidders view the auction block– bidders submit one or more bids– each bid is just an amount of ogrocs

• Auctions resources– highest bidder chooses first, and so forth– agent may refuse choice for refund– may choose any available resource

Page 12: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Cheese

• Handles portions not (yet) allocated as resources– tax rates– science– city workers– government

• Based on Old Biddy components (cheesy heuristics)

Page 13: There’s no such thing as a FreeCiv Marc Friedman Ed Hong Jon Nowitz Steve Wolfman.

Auctions -- discussion

• Advantages– solves competition problem– simple communication– can do it without reasoning about other agents

• Disadvantages– optimizes the wrong thing (can an auction

maximize global utility?)– no notion of per-agent utility to learn by– ‘good’ income and maintenance costs unknown