SlideShare a Scribd company logo
1 of 25
Download to read offline
twoface - an intelligent
Battlecode Agent
Final presentation - 23rd January 2015
1
Battlecode final presentation - Group n.2
• Feature Overview
• Communication
• Blackboard
• Tasks
• Macromanagement
• Opponent modeling
• Strategy decision
• Scouting
• Squad Team
• Guards
Outline
2
• Micromanagement
• Pathfinding
• Building period
• Dynamic pathfinding
• Agile pathfinding
• Testing
• Experimental setup
• Score measure
• Experimental results
• Conclusion and future
improvements
Battlecode final presentation - Group n.2 3
Blackboard
● Task-oriented modeling of the
game actions
● Public visible tasks
● Dedicated tasks
Micromanagement
● Enhanced individual attack
and defence
● Retreat calculation
Macromanagement
● Opponent model
● Adaptive behavior
● Scouts for distributed sensing
● Enemy position representation
● Leader guided squads for attack
● Guarding groups for defence
Pathfinding
● A* approach with map coarsening
● Alternative bug pathing algorithm
with I.D.
● Follow or flee from target algorithm
● Determining good locations to build
PASTRs
Feature overview: twoface
intelligent and adaptive Battlecode playing agent
Battlecode final presentation - Group n.2
• Central aspect in battlecode
• Essential for macromanagement
• Example: coordination of units according to strategy
• Exchanged data can be complex
⇒ Blackboard system with tasks
Communication
4
Battlecode final presentation - Group n.2 5
Communication - Blackboard
Public Private
...
...
Bot A Bot B
Battlecode final presentation - Group n.2
• Task Interface
• Defines only the most necessary methods
• Serialize the task object to the broadcast array
• Deserialize the task object from the broadcast array
• Task type to get the matched Implementation
• Allows a flexible way to define strategic commands
• Can be used to outsource calculations to robots
Communication - Tasks
6
Battlecode final presentation - Group n.2
• Implemented tasks:
• ComputePASTRSpotTask
• CreateMapTask
• GuardPositionTask
• ScoutAroundTask
• SingleLocationTask
• SquadTask
Communication - Tasks
7
Battlecode final presentation - Group n.2
Macromanagement - Opponent Modelling
8
INPUT
● Amount of Milk
● No. of PASTRs
● No. of killed units
● Braodcasting units
● Position of enemies
● No. of flocks
OUTPUT
● HerdingConfidence:
likelihood the enemy is
focusing on collecting milk
● AttackConfidence: likelihood
the enemy is preparing for an
attack;
Opponent behaviour classification in the class
BehaviourControl.java
called every 25 rounds (=1 timespan)
}with scouts
Battlecode final presentation - Group n.2
Macromanagement - Opponent Modelling 2
9
Battlecode final presentation - Group n.2
Defending Mode
• PASTR built immediately
• Guards are placed around PASTR
Attacking Mode
• Squad team is formed
• Enemy PASTRs are always attacked
• Enemy HQ is blocked
• PASTR building is postponed
Macromanagement - Strategy Decision
10
Confindence timer to
prevent frequent
switches
Battlecode final presentation - Group n.2
• Detect enemy location and movement → opponent
modeling
• Two approaches
a. senseBroadcastingRobots: most complete and fastest if radio
is used regularly by opponent
b. soldier exploring area in map (senseNearbyGameObjects):
• slower
• useful if no radio used by opponent
• number of units is limited → reduced attacking power
Macromanagement - Scouting
11
Battlecode final presentation - Group n.2
• Implementation
• Task blackboard system
• announced at start of match
• scout in area between two given locations
• if incoming attack detected: scouts help defending
• enemy info broadcasted to radio channels:
• location
• enemy ID
• round number enemy detected
• Scout trajectory: 3 locations between HQ and enemy
HQ
Macromanagement - Scouting 2
12
Battlecode final presentation - Group n.2
Scouting
13
Battlecode final presentation - Group n.2
• Formulated as a Task
• Contains a channel
• Same channel equals same team
• Leader
• Leader sub-task automatically taken
• Complex pathfinding
• Detects blockades and reacts
• Follower
• Will follow the leader as close as possible
• Simple pathfinding
• Complex pathfinding when lost
Macromanagement - Squad Team
14
Battlecode final presentation - Group n.2
• Formulated as a Task
• Contains a location and a channel
• Same channel equals same team
• Communication
• Broadcast information about nearby enemies
• Support broadcaster
• Rallying
• Rally around the goal
• Maintain a distance to the goal
• More defenses in direction of enemy HQ
Macromanagement - Guards
15
Battlecode final presentation - Group n.2
• When enemies are encountered
• Four Modes: Attack, Approach, Await, Retreat
• Consider global and local advantages
• Attack
• If in attack range and advantage is given
• Or if in attack range and situation is hopeless
• Await
• If slightly out of attack range and advantage is given
• Approach
• If not awaiting and advantage is given
• Retreat
• else (enemies nearby, no advantage, but not considered hopeless)
Micromanagement
16
Battlecode final presentation - Group n.2 17
• A* search
• Coarsened map
• Advantages
• Fast pathfinding
• Disadvantages
• Long graph building period
• No navigation during
building
• No dynamic obstacle
avoidance
Pathfinding
Battlecode final presentation - Group n.2 18
• Graph is serializable
• Outsource to SOLDIER using task system
• Solves:
• Immobility during build period
• Does not solve:
• Pathfinding during build period
Pathfinding - Building Period
Battlecode final presentation - Group n.2 19
• Search graph only incorporates walls
• Solution: Bugging Algorithm
• Solves:
• Dynamic Pathfinding
• Pathfinding during build period
• Simply use greedy approach
• Avoid walls when necessary
• Fails at long walls, nearby robots moving
• Solution: “Iterative deepening bugging”
Pathfinding - Dynamic Pathfinding
Battlecode presentation of the Naive Agent - Group n.2
Pathfinding - Old vs. New
Battlecode final presentation - Group n.2 21
• Squads and Micromanagement need faster pathfinding
• Completeness is not an issue
• Two new Methods:
• Simple bug pathing, as seen at MIT
• Following, as greedy as possible
• Sophisticated and fast pathfinding by dynamically
switching between methods
Pathfinding - Agile Pathfinding
Battlecode final presentation - Group n.2
• 5 opponent players (reference player, 2014 finalists)
• 9 maps (used to gain MIT course credit)
• each player alternates between Team A and Team B
• score measure
Testing - Experimental Setup
22
Battlecode final presentation - Group n.2
mA
: amount of milk by team A at end of match
mB
: amount of milk by team B at end of match
mmax
: amount of milk to win the game (107
)
nend
: number of rounds to finish the game
nmax
: maximum number of rounds allowed
η : penalty factor [0,1] : sets lower bound on “rounds” feature
Testing - Score measure
23
“milk” feature “rounds” feature
Battlecode final presentation - Group n.2
• beats reference player in all of the 9 maps
• inferior to 2014 finalists
• results of games against reference player:
Testing - Experimental Results
24
Battlecode final presentation - Group n.2
• Ad hoc data structures for saving bytecodes
• Improve the blackboard
• More cooperation at micro-level
• Improve the exploitation of the opponent modelling
• More HQ modes (now only attacking and defending)
• Define the conditions when to call the scouts
• ...
Conclusion - Future improvements
25

More Related Content

More from Daniele Di Mitri

SenseTheClassroom Live at EC-TEL 2022
SenseTheClassroom Live at EC-TEL 2022SenseTheClassroom Live at EC-TEL 2022
SenseTheClassroom Live at EC-TEL 2022
Daniele Di Mitri
 
Guest Lecture: Restoring Context in Distance Learning with Artificial Intelli...
Guest Lecture: Restoring Context in Distance Learning with Artificial Intelli...Guest Lecture: Restoring Context in Distance Learning with Artificial Intelli...
Guest Lecture: Restoring Context in Distance Learning with Artificial Intelli...
Daniele Di Mitri
 
SITE Interactive kenyote 2021
SITE Interactive kenyote 2021SITE Interactive kenyote 2021
SITE Interactive kenyote 2021
Daniele Di Mitri
 
MOBIUS: Smart Mobility Tracking with Smartphone Sensors
MOBIUS: Smart Mobility Tracking with Smartphone SensorsMOBIUS: Smart Mobility Tracking with Smartphone Sensors
MOBIUS: Smart Mobility Tracking with Smartphone Sensors
Daniele Di Mitri
 
Visual Learning Pulse - Final Thesis presentation
Visual Learning Pulse - Final Thesis presentationVisual Learning Pulse - Final Thesis presentation
Visual Learning Pulse - Final Thesis presentation
Daniele Di Mitri
 

More from Daniele Di Mitri (20)

SenseTheClassroom Live at EC-TEL 2022
SenseTheClassroom Live at EC-TEL 2022SenseTheClassroom Live at EC-TEL 2022
SenseTheClassroom Live at EC-TEL 2022
 
Guest Lecture: Restoring Context in Distance Learning with Artificial Intelli...
Guest Lecture: Restoring Context in Distance Learning with Artificial Intelli...Guest Lecture: Restoring Context in Distance Learning with Artificial Intelli...
Guest Lecture: Restoring Context in Distance Learning with Artificial Intelli...
 
SITE Interactive kenyote 2021
SITE Interactive kenyote 2021SITE Interactive kenyote 2021
SITE Interactive kenyote 2021
 
MOBIUS: Smart Mobility Tracking with Smartphone Sensors
MOBIUS: Smart Mobility Tracking with Smartphone SensorsMOBIUS: Smart Mobility Tracking with Smartphone Sensors
MOBIUS: Smart Mobility Tracking with Smartphone Sensors
 
The Multimodal Tutor - Presentation PhD defence
The Multimodal Tutor - Presentation PhD defenceThe Multimodal Tutor - Presentation PhD defence
The Multimodal Tutor - Presentation PhD defence
 
Real-time Multimodal Feedback with the CPR Tutor
Real-time Multimodal Feedback with the CPR TutorReal-time Multimodal Feedback with the CPR Tutor
Real-time Multimodal Feedback with the CPR Tutor
 
Multimodal Tutor for CPR presented at AIME'19
Multimodal Tutor for CPR presented at AIME'19Multimodal Tutor for CPR presented at AIME'19
Multimodal Tutor for CPR presented at AIME'19
 
The Multimodal Learning Analytics Pipeline
The Multimodal Learning Analytics PipelineThe Multimodal Learning Analytics Pipeline
The Multimodal Learning Analytics Pipeline
 
Workshop: Multimodal Tutor
Workshop: Multimodal TutorWorkshop: Multimodal Tutor
Workshop: Multimodal Tutor
 
Read Between The Lines: an Annotation Tool for Multimodal Data
Read Between The Lines: an Annotation Tool for Multimodal DataRead Between The Lines: an Annotation Tool for Multimodal Data
Read Between The Lines: an Annotation Tool for Multimodal Data
 
The Multimodal Tutor - short pitch presentation at JTELSS 2018 in Durrës, Alb...
The Multimodal Tutor - short pitch presentation at JTELSS 2018 in Durrës, Alb...The Multimodal Tutor - short pitch presentation at JTELSS 2018 in Durrës, Alb...
The Multimodal Tutor - short pitch presentation at JTELSS 2018 in Durrës, Alb...
 
Sensors for Learning workshop
Sensors for Learning workshopSensors for Learning workshop
Sensors for Learning workshop
 
Multimodal Machines #JTELSS17 workshop
Multimodal Machines #JTELSS17 workshopMultimodal Machines #JTELSS17 workshop
Multimodal Machines #JTELSS17 workshop
 
Multimodal Tutor - Adaptive feedback from multimodal experience capturing
Multimodal Tutor - Adaptive feedback from multimodal experience capturingMultimodal Tutor - Adaptive feedback from multimodal experience capturing
Multimodal Tutor - Adaptive feedback from multimodal experience capturing
 
Learning Pulse - paper presentation at LAK17
Learning Pulse - paper presentation at LAK17Learning Pulse - paper presentation at LAK17
Learning Pulse - paper presentation at LAK17
 
Visual Learning Pulse - Final Thesis presentation
Visual Learning Pulse - Final Thesis presentationVisual Learning Pulse - Final Thesis presentation
Visual Learning Pulse - Final Thesis presentation
 
Lifelong Topic Modelling presentation
Lifelong Topic Modelling presentation Lifelong Topic Modelling presentation
Lifelong Topic Modelling presentation
 
Word2Vec: Learning of word representations in a vector space - Di Mitri & Her...
Word2Vec: Learning of word representations in a vector space - Di Mitri & Her...Word2Vec: Learning of word representations in a vector space - Di Mitri & Her...
Word2Vec: Learning of word representations in a vector space - Di Mitri & Her...
 
(IT) Slides della presentazione della tesi di Laurea
(IT) Slides della presentazione della tesi di Laurea(IT) Slides della presentazione della tesi di Laurea
(IT) Slides della presentazione della tesi di Laurea
 
Obessu’s inputs on «opening up education»
Obessu’s inputs on «opening up education»Obessu’s inputs on «opening up education»
Obessu’s inputs on «opening up education»
 

Battlecode2014 - final presentation - group n.2

  • 1. twoface - an intelligent Battlecode Agent Final presentation - 23rd January 2015 1
  • 2. Battlecode final presentation - Group n.2 • Feature Overview • Communication • Blackboard • Tasks • Macromanagement • Opponent modeling • Strategy decision • Scouting • Squad Team • Guards Outline 2 • Micromanagement • Pathfinding • Building period • Dynamic pathfinding • Agile pathfinding • Testing • Experimental setup • Score measure • Experimental results • Conclusion and future improvements
  • 3. Battlecode final presentation - Group n.2 3 Blackboard ● Task-oriented modeling of the game actions ● Public visible tasks ● Dedicated tasks Micromanagement ● Enhanced individual attack and defence ● Retreat calculation Macromanagement ● Opponent model ● Adaptive behavior ● Scouts for distributed sensing ● Enemy position representation ● Leader guided squads for attack ● Guarding groups for defence Pathfinding ● A* approach with map coarsening ● Alternative bug pathing algorithm with I.D. ● Follow or flee from target algorithm ● Determining good locations to build PASTRs Feature overview: twoface intelligent and adaptive Battlecode playing agent
  • 4. Battlecode final presentation - Group n.2 • Central aspect in battlecode • Essential for macromanagement • Example: coordination of units according to strategy • Exchanged data can be complex ⇒ Blackboard system with tasks Communication 4
  • 5. Battlecode final presentation - Group n.2 5 Communication - Blackboard Public Private ... ... Bot A Bot B
  • 6. Battlecode final presentation - Group n.2 • Task Interface • Defines only the most necessary methods • Serialize the task object to the broadcast array • Deserialize the task object from the broadcast array • Task type to get the matched Implementation • Allows a flexible way to define strategic commands • Can be used to outsource calculations to robots Communication - Tasks 6
  • 7. Battlecode final presentation - Group n.2 • Implemented tasks: • ComputePASTRSpotTask • CreateMapTask • GuardPositionTask • ScoutAroundTask • SingleLocationTask • SquadTask Communication - Tasks 7
  • 8. Battlecode final presentation - Group n.2 Macromanagement - Opponent Modelling 8 INPUT ● Amount of Milk ● No. of PASTRs ● No. of killed units ● Braodcasting units ● Position of enemies ● No. of flocks OUTPUT ● HerdingConfidence: likelihood the enemy is focusing on collecting milk ● AttackConfidence: likelihood the enemy is preparing for an attack; Opponent behaviour classification in the class BehaviourControl.java called every 25 rounds (=1 timespan) }with scouts
  • 9. Battlecode final presentation - Group n.2 Macromanagement - Opponent Modelling 2 9
  • 10. Battlecode final presentation - Group n.2 Defending Mode • PASTR built immediately • Guards are placed around PASTR Attacking Mode • Squad team is formed • Enemy PASTRs are always attacked • Enemy HQ is blocked • PASTR building is postponed Macromanagement - Strategy Decision 10 Confindence timer to prevent frequent switches
  • 11. Battlecode final presentation - Group n.2 • Detect enemy location and movement → opponent modeling • Two approaches a. senseBroadcastingRobots: most complete and fastest if radio is used regularly by opponent b. soldier exploring area in map (senseNearbyGameObjects): • slower • useful if no radio used by opponent • number of units is limited → reduced attacking power Macromanagement - Scouting 11
  • 12. Battlecode final presentation - Group n.2 • Implementation • Task blackboard system • announced at start of match • scout in area between two given locations • if incoming attack detected: scouts help defending • enemy info broadcasted to radio channels: • location • enemy ID • round number enemy detected • Scout trajectory: 3 locations between HQ and enemy HQ Macromanagement - Scouting 2 12
  • 13. Battlecode final presentation - Group n.2 Scouting 13
  • 14. Battlecode final presentation - Group n.2 • Formulated as a Task • Contains a channel • Same channel equals same team • Leader • Leader sub-task automatically taken • Complex pathfinding • Detects blockades and reacts • Follower • Will follow the leader as close as possible • Simple pathfinding • Complex pathfinding when lost Macromanagement - Squad Team 14
  • 15. Battlecode final presentation - Group n.2 • Formulated as a Task • Contains a location and a channel • Same channel equals same team • Communication • Broadcast information about nearby enemies • Support broadcaster • Rallying • Rally around the goal • Maintain a distance to the goal • More defenses in direction of enemy HQ Macromanagement - Guards 15
  • 16. Battlecode final presentation - Group n.2 • When enemies are encountered • Four Modes: Attack, Approach, Await, Retreat • Consider global and local advantages • Attack • If in attack range and advantage is given • Or if in attack range and situation is hopeless • Await • If slightly out of attack range and advantage is given • Approach • If not awaiting and advantage is given • Retreat • else (enemies nearby, no advantage, but not considered hopeless) Micromanagement 16
  • 17. Battlecode final presentation - Group n.2 17 • A* search • Coarsened map • Advantages • Fast pathfinding • Disadvantages • Long graph building period • No navigation during building • No dynamic obstacle avoidance Pathfinding
  • 18. Battlecode final presentation - Group n.2 18 • Graph is serializable • Outsource to SOLDIER using task system • Solves: • Immobility during build period • Does not solve: • Pathfinding during build period Pathfinding - Building Period
  • 19. Battlecode final presentation - Group n.2 19 • Search graph only incorporates walls • Solution: Bugging Algorithm • Solves: • Dynamic Pathfinding • Pathfinding during build period • Simply use greedy approach • Avoid walls when necessary • Fails at long walls, nearby robots moving • Solution: “Iterative deepening bugging” Pathfinding - Dynamic Pathfinding
  • 20. Battlecode presentation of the Naive Agent - Group n.2 Pathfinding - Old vs. New
  • 21. Battlecode final presentation - Group n.2 21 • Squads and Micromanagement need faster pathfinding • Completeness is not an issue • Two new Methods: • Simple bug pathing, as seen at MIT • Following, as greedy as possible • Sophisticated and fast pathfinding by dynamically switching between methods Pathfinding - Agile Pathfinding
  • 22. Battlecode final presentation - Group n.2 • 5 opponent players (reference player, 2014 finalists) • 9 maps (used to gain MIT course credit) • each player alternates between Team A and Team B • score measure Testing - Experimental Setup 22
  • 23. Battlecode final presentation - Group n.2 mA : amount of milk by team A at end of match mB : amount of milk by team B at end of match mmax : amount of milk to win the game (107 ) nend : number of rounds to finish the game nmax : maximum number of rounds allowed η : penalty factor [0,1] : sets lower bound on “rounds” feature Testing - Score measure 23 “milk” feature “rounds” feature
  • 24. Battlecode final presentation - Group n.2 • beats reference player in all of the 9 maps • inferior to 2014 finalists • results of games against reference player: Testing - Experimental Results 24
  • 25. Battlecode final presentation - Group n.2 • Ad hoc data structures for saving bytecodes • Improve the blackboard • More cooperation at micro-level • Improve the exploitation of the opponent modelling • More HQ modes (now only attacking and defending) • Define the conditions when to call the scouts • ... Conclusion - Future improvements 25