Adrien Allard Florian Brulhart Sebastien Broussaud
Decision making in Endless Space 2 Background Our Studio
12 Dev 20 Dev 30 Dev 40 60 Dev 2011 2012 2013 2014 2015 2016 2017 Our 4X
Explore Exploit Amplitude touch
Search points of interest Build / research Asymmetric factions Discover the world Gather resources Quests Gather Intel Optimize economy
Expand Exterminate Diplomacy
Fight in battles Increase territory Relation with players Unit management Expand to new places Evaluate deals War management Post-mortem: Endless Legend
Control Understand Technical
• Decisions are difficult to control • Heuristic results are just numbers • Code is spread and duplicated
• AI doesn’t have global strategy • No access to intermediate • Code base is not incremental reasons friendly • Diplomatic relations can seem irrational • Decision process is opaque • Tools are too complex Objectives
For design For debugging For programming
• High level control • Understand each decision • Incremental • Low level control • Understand resource • Allow different AI techniques • Handle each resource allocation • Isolate data refining from differently • User friendly decision Meet E.N.F.E.R. Process Overview
Sync Analysis Tasks generation Data Game
Execution Tasks allocation Process Overview
Tasks generation
Game
Tasks allocation Tasks generation Situation Designer needs
Aaah, the Cravers are invading! The AI should definitely defend its system here! Goal
Defend system against enemies Defend System Designer needs
Hum ok … but how do you defend the system? Designer needs
Details, schmetails… erm... well… you know… it could build defenses or create ships. Tasks
Create ships
Defend system against enemies Defend System
Build defense Designer needs
Hum ok … but how does the AI decide which action to take? Designer needs
Well, we're talking about Cravers. Insectoid, psycho, warmachines. We need the best defense against them. Scoring
Create ships 0.4
Defend system against enemies Defend System
Build defense 0.8 Designer needs
Oh, but I forgot, it's that crappy system we stole from the Lumeris earlier. The AI shouldn't prioritise it. Scoring
Create ships 0.4
Defend system against enemies Defend System
Build defense 0.8 Scoring
Create ships 0.4
Defend system against enemies Defend System 0.5
Build defense 0.8 Scoring
Create ships 0.2
Defend system against enemies Defend System 0.5
Build defense 0.4 Designer needs
And one more thing! If the AI's planning a war against the Cravers in any case, ships should be preferred. Multiple reasons
Create ships 0.2
Defend system against enemies Defend System 0.5
Build defense 0.4 Multiple reasons
Improve military power to attack Attack Cravers 0.7 Create ships 0.2
Defend system against enemies Defend System 0.5
Build defense 0.4 Multiple reasons
Improve military power to attack Attack Cravers 0.7 Create ships 0.5
Defend system against enemies Defend System 0.5
Build defense 0.4 Multiple reasons
Reduce upkeep 0.9
Improve military power to attack Attack Cravers 0.7 Create ships 0.5
Defend system against enemies Defend System 0.5
Build defense 0.4 Multiple reasons
Reduce upkeep 0.9
Improve military power to attack Attack Cravers 0.7 Create ships 0.3
Defend system against enemies Defend System 0.5
Build defense 0.4 Associated tool Post-mortem
• Ability to iterate before implementation • Force separation between each decision step • Improve decision debugging • Feedback decision chains • Understand decision at different granularity Tasks allocation Tasks allocation
Context
• Tasks in the game have costs • Can I afford this task? • Concurrence between tasks are due to shared resources
Create ships 0.6
Build defense 0.3 Tasks allocation
Context
• Tasks in the game have costs • Can I afford this task? • Concurrence between tasks are due to shared resources
100 Create ships 0.6 10
80 Build defense 0.3 Tasks allocation
Objectives
• Use motivation to split resources • Task motivation must be independent from the cost • Each resource has its own way of being split • Handle tasks with multiple resources
100 Create ships 0.6 10
80 Build defense 0.3 Tasks allocation
0/100 Create ships 0.6 0/10
0/80 Build defense 0.3 Tasks allocation
allocator 0/100 Create ships 0.6 Stock: 100 0/10
0/80 Build defense 0.3 Tasks allocation
allocator 100/100 Create ships 0.6 Stock: 0 0/10
0/80 Build defense 0.3 Tasks allocation
100/100 Create ships 0.6 0/10
allocator 0/80 Build defense 0.3 Stock: 0 Tasks allocation
100/100 Create ships 0.6 0/10
allocator 0/80 Build defense 0.3 Stock: 0 Multiple resources
100/100 Create ships 0.6 0/10
0/80 Build defense 0.3 Multiple resources
100/100 Create ships 0.6 allocator 0/10 Stock: 0
0/80 Build defense 0.3 Multiple resources
100/100 Create ships 0.6 allocator 0/10 Stock: 0
0/80 Build defense 0.3 Resource reallocation
100/100 Create ships 0.6 0/10
0/80 Build defense 0.3 Resource reallocation
allocator 100/100 Create ships 0.6 Stock: 0 0/10
0/80 Build defense 0.3 Resource reallocation
allocator 0/100 Create ships 0.6 Stock: 100 0/10
0/80 Build defense 0.3 Resource reallocation
0/100 Create ships 0.6 0/10
allocator 0/80 Build defense 0.3 Stock: 100 Resource reallocation
0/100 Create ships 0.6 0/10
allocator 80/80 Build defense 0.3 Stock: 20 Validate tasks for execution
0/100 Create ships 0.6 0/10
80/80 Build defense 0.3 Associated tool Post-mortem
• Simplify the task generation by removing cost handling • Handle concurrence between tasks • Centralize allocation algorithms • Each resource behaves differently so we can allocate them differently Uses and improvements Where to integrate features
Decision graph
Economy
Fleet management
Diplomatic contracts
Fleet production Where to integrate features
Analysis Decision graph
Diplomacy Economy relations
Fleet War topology management
Ship/Fleet Diplomatic Design contracts
Fleet production Where to integrate features
Analysis Decision graph Execution
Diplomacy Battle Economy relations behavior
Fleet Fleet War topology management behavior
Ship/Fleet Diplomatic Design contracts
Fleet production Diplomatic relation behavior
Empire destroyed our explorer AND We are a military faction Prepare war
Ask for Alliance
In alliance Analysis Decision graph Diplomatic relation behavior
Empire destroyed our explorer AND We are a military faction Prepare war Increase ship number
Ask for Alliance
In alliance Analysis Decision graph Diplomatic relation behavior
Empire destroyed our explorer AND We are a military faction Prepare war
Ask for Build alliance Alliance contract
In alliance Analysis Decision graph Fleet Management
A fleet is a resource for military decisions
Defend empire Defend attacked system Defend system Defend empire 0.6 0.9 Pegasus Fleet Management
A fleet is a resource for military decisions
Defend empire Defend attacked system Defend system Taskforce Defend empire 0.6 0.9 Pegasus Advance tasks generation
Goals can generate goals
Defend empire Defend attacked system Defend system Defend empire 0.9 Pegasus 0.3 Advance tasks generation
Goals can generate goals
Defend empire Defend attacked system Defend constellation Defend Defend system Defend empire 0.9 constellation 0.5 Pegasus 0.3 Advance tasks generation
Tasks can generate tasks
Defend empire Defend attacked system Defend system Taskforce Defend empire 0.9 Pegasus 0.3 Advance tasks generation
Tasks can generate tasks
empire Defend attacked system Defend system Taskforce Defend empire 0.9 0.3 Escort defense Taskforce Pegasus 0.2 Assist fleet Advance tasks generation
Link tasks with an allocation rule
Build wonder Build unique wonder 1000 0.3 on Pegasus
Build wonder Build unique wonder 1000 0.6 on Andromeda Advance tasks generation
Link tasks with an allocation rule
Build wonder Build unique wonder 1000 0.3 on Pegasus
Only one in empire
Build wonder Build unique wonder 1000 0.6 on Andromeda Advance tasks generation
Link tasks with an allocation rule
Build wonder Build unique wonder 1000 0.3 on Pegasus
Only one in empire
Build wonder Build unique wonder 1000 0.6 on Andromeda Advance tasks generation
Link tasks with an allocation rule
Build wonder Build unique wonder 1000 0.3 on Pegasus
Only one in empire
Build wonder Build unique wonder 1000 0.6 on Andromeda Multiple Personalities
We have 8 different factions. Multiple Personalities
And we want to add some flashy, new, exotic gameplay! Multiple Personalities
Sheesh. Alright, we've got this. We can add a specific decision branch. Multiple Personalities
And we want some gameplay restrictions! Multiple Personalities
Well then we can cut a specific decision branch. Multiple Personalities
And the personality of the new AI faction must match the lore! Multiple Personalities
In that case we can modify a specific decision branch. Some numbers
• 90 analysis computations • 45 types of goal • 90 types of task • 300 generators • 50 types of game action handled • 70 diplomatic states • 3 programmers and 2 designers Summing-Up
• Create a language to talk about AI decision • Keep it simple • Ensure modular approach so new content doesn't break decision system • Understanding the AI is mandatory • Emergent behavior must be controlled • Tools must display a system the way you design it Thank you