Contest: Capture The Flag - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Contest: Capture The Flag

Description:

10 agents per side. If you touch the enemy's flag, you pick it up ... Best performance (i.e. wins largest percentage of games) Most creative ... – PowerPoint PPT presentation

Number of Views:292
Avg rating:3.0/5.0
Slides: 18
Provided by: martinc51
Category:
Tags: action | capture | com | contest | flag | games

less

Transcript and Presenter's Notes

Title: Contest: Capture The Flag


1
Contest Capture The Flag
  • Martin C. Martin
  • with Jon Klein

2
Capture The Flag
  • 10 agents per side
  • If you touch the enemys flag, you pick it up
  • The first team to bring a flag to the center line
    wins
  • You cant pick up or move your own flag
  • If you touch an enemy on your side, they go to
    jail
  • If you touch an enemy on their side, you go to
    jail
  • If one of your agents touches the enemy jail, all
    your agents are released, placed randomly on your
    side

3
Basics of Agent Based Simulation
  • Time is broken into discrete segments called
    timesteps
  • 0.05 sec long for the capture the flag tournament
  • At each timestep, breve calls every agents
    iterate method
  • This is what you write
  • In breves Capture The Flag, this simply decides
  • The speed of each player
  • Whether to turn right, left, or not turn at all

4
breves Main Loop
  • At each timestep, breve
  • Computes all sensor values (e.g. who is touching
    who who has the flag etc.)
  • Calls each agents iterate method
  • Moves every agent according to its speed and
    heading
  • Draws the graphics

5
Available Information
  • get-id-number an int from 0 to 9.
  • sense-my-team list of agents on same team in
    sensor range.
  • sense-other-team list of other teams agents in
    sensor range.
  • sense-my-flag agents teams flag, if in sensor
    range
  • sense-other-flag other teams flag, if in sensor
    range.
  • sense-my-jail jail where team is held, if in
    sensor range.
  • sense-other-jail jail where other team is held,
    if in the sensor range.
  • get-my-home-location closest point to agent on
    agent's home-side.
  • get-angle to location angle to location in
    radians
  • get-location the location of any object, a vector

6
Available Info/Actions
  • Information
  • get-time current time in simulated seconds
  • get-jailed-red-count the number of Red agents in
    jail.
  • get-jailed-blue-count the number of Blue agents
    in jail.
  • Action
  • turn-left Turns the agent left by a small amount
  • turn-right Turns the agent right by a small
    amount
  • set-speed to speed Sets speed of agent to speed
    units.

7
breves coordinate system
25
x axis
-25
25
-25
8
Heading To A Given Location
desired
9
Demonstration
10
A Taste of Bot AI in Unreal Tournament 2004
  • All written in UnrealScript, very similar to Java
  • If you can read C or Java, you can read
    UnrealScript
  • AI code consists mostly of if statements to
    select between competing objectives

11
OrdersForFlagCarrier
  • function bool OrdersForFlagCarrier(Bot B)
  • if ( B.Pawn.Health lt 40 )
  • B.TryCombo("xGame.ComboDefensive")
  • else
  • B.TryCombo("xGame.ComboSpeed")
  • if ( !FriendlyFlag.bHome (FriendlyFlag.Holder
  • None) B.LineOfSightTo(FriendlyFlag.Positi
    on())
  • (VSize(B.Pawn.Location -
    FriendlyFlag.Location) lt
  • 1500.f) GoPickupFlag(B) )
  • return true

12
OrdersForFlagCarrier
  • If my health is lt 40, try a defensive combo,
    otherwise a speed combo
  • If my flag isnt at its base, and nobody is
    carrying it, and I have line of sight to the
    flag, and Im within 1500 units, head toward it
  • If my skill level is gt 2, and Im not within 2000
    units of the friendly flag, and there is a super
    pickup within 800 units that hasnt been taken,
    head toward it
  • If Im being attacked and my health is lt 60,
    broadcast a need backup message
  • Head to home base

13
CheckSquadObjectives
  • If my flag isnt home, and I have line of sight
    to it
  • If nobodys holding it, head toward it
  • If Im not attacking the flag carrier, then call
    FindNewEnemyFor(B)
  • Broadcast Enemy flag carrier is here if its
    been at least 6 seconds since the last time
  • If Im not sniping, TryToIntercept the enemy flag
    holder, assuming theyre heading to their base

14
Information Used In If Statements
  • Health
  • What I have line of sight to
  • Orders attack, defend, follow, freelance,
    sniping
  • My skill level
  • Status of flags at base, being carried, dropped
  • Whether I need a weapon
  • Whether pickups are nearby
  • Am I attacking/pursuing someone?
  • Times when I respawned, when flag was taken, how
    long its been since Ive seen the enemy Im
    trying to pursue
  • Distance to various things (flag, my base, enemy
    base, etc.)
  • Whether youve just reached a desired location

15
Tactical
  • Programmer can define states for an object
  • Can override functions within those states
  • Bots have states RestFormation, MoveToGoal,
    Roaming, Retreating, Charging, StakeOut,
    RangedAttack, etc.
  • state Charging extends MoveToGoalWithEnemy
  • function bool TryToDuck(vector duckDir, bool
    bReversed)
  • if ( FRand() lt 0.6 )
  • return Global.TryToDuck(duckDir, bReversed)
  • if ( MoveTarget Enemy )
  • return TryStrafe(duckDir)

16
Contest A Few Last Things
  • Submission a single text file, containing a
    subclass of CaptureTheFlagPlayer
  • breve has no notion of data hiding all fields
    are public.
  • Call only the functions listed in the rules.
  • E.g. calling move on agents other team or yours
    is cheating.
  • Two conditions
  • Best performance (i.e. wins largest percentage of
    games)
  • Most creative
  • Prizes book and/or T-shirt

17
Sharing your source code
  • We encourage people to share source code, to
    learn from one another, and to bounce ideas back
    and forth
  • If someone submits a modified version of someone
    elses code, then both will win the same prize
  • As long as the change is substantial, decided
    primarily on ability to win
  • Maximum 2 prizes per condition
  • Join us on the breve forums!
Write a Comment
User Comments (0)
About PowerShow.com