PI, your path finding needs some work...

  • We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

bbqftw

banana vendor for unhuman entities
2 Badges
Jan 18, 2014
5.394
6.187
  • Europa Universalis IV
  • Europa Universalis IV: Mandate of Heaven
Sometimes when selecting two armies located in the same province, ordering them to the same province will cause two different paths to be generated, probably to reduce attrition damage?
 

Sian

Field Marshal
85 Badges
Apr 1, 2012
2.610
1.245
  • Naval War: Arctic Circle
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Pre-order
  • Sengoku
  • Europa Universalis IV: Res Publica
  • Cities in Motion
  • March of the Eagles
  • Magicka
  • Knights of Pen and Paper +1 Edition
  • Impire
  • Heir to the Throne
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: The Old Gods
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Europa Universalis IV: Art of War
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Dungeonland
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III Complete
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Stellaris
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Cossacks
  • Stellaris: Nemesis
  • Crusader Kings II: Way of Life
  • Mount & Blade: Warband
  • Europa Universalis IV: El Dorado
  • 500k Club
  • War of the Roses
  • Warlock: Master of the Arcane
  • Teleglitch: Die More Edition
  • Europa Universalis III Complete
thinking out loud here, but wouldn't it be possible to 'steal' some code from a GPS, and feed it a map where each province is an intersection with roads to the neighboring provinces to each province, and tell it how many units long each road is, and then let that find the shortest way from Province ABC to XYZ? ... while it might be a large number it would certainly be finite and from my (admittedly somewhat limited) knowledge it shouldn't be that taxing for.
 
  • 1
Reactions:

TehJumpingJawa

Field Marshal
93 Badges
Feb 26, 2011
2.974
3.887
  • Crusader Kings II: Way of Life
  • Crusader Kings III
  • Teleglitch: Die More Edition
  • The Showdown Effect
  • Warlock: Master of the Arcane
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Hearts of Iron IV: Cadet
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome Sign Up
  • Europa Universalis IV: Common Sense
  • Stellaris: Ancient Relics
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Stellaris: Federations
  • Age of Wonders: Planetfall Sign Up
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • BATTLETECH
  • Shadowrun: Hong Kong
  • Age of Wonders III
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • BATTLETECH - Digital Deluxe Edition
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Surviving Mars
  • Europa Universalis III Complete
  • War of the Roses
  • Warlock 2: The Exiled
  • Warlock 2: Wrath of the Nagas
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV: Res Publica
  • Sword of the Stars II
  • Sword of the Stars
  • Semper Fi
Sometimes when selecting two armies located in the same province, ordering them to the same province will cause two different paths to be generated, probably to reduce attrition damage?

I've never seen this behaviour, in fact I usually have to manually force armies to take different routes precisely to avoid attrition.

I suppose hypothetically it might be possible for the armies to take different paths, if the two armies had different manoeuvre ratings, and rounding was applied during the cost evaluation(rounding to a whole number of days).
E.g.

Start---6---6---Goal
\_____12_____/

Army A, no manoeuvre bonus, picks the top route (same cost as the bottom route, so arbitrary choice)
Army B, 5% bonus, picks the bottom route; rint(6*.95) + rint(6*.95) = 12; rint(12*.95)=11

Though I doubt very much it's implemented anything like that.

As I said, I've never seen 2 armies in the same start node, take different routes to the same destination (unless ofc one was exiled, or fort ZoC was screwing with the paths)
 
Last edited:

TehJumpingJawa

Field Marshal
93 Badges
Feb 26, 2011
2.974
3.887
  • Crusader Kings II: Way of Life
  • Crusader Kings III
  • Teleglitch: Die More Edition
  • The Showdown Effect
  • Warlock: Master of the Arcane
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Hearts of Iron IV: Cadet
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome Sign Up
  • Europa Universalis IV: Common Sense
  • Stellaris: Ancient Relics
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Stellaris: Federations
  • Age of Wonders: Planetfall Sign Up
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • BATTLETECH
  • Shadowrun: Hong Kong
  • Age of Wonders III
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • BATTLETECH - Digital Deluxe Edition
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Surviving Mars
  • Europa Universalis III Complete
  • War of the Roses
  • Warlock 2: The Exiled
  • Warlock 2: Wrath of the Nagas
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV: Res Publica
  • Sword of the Stars II
  • Sword of the Stars
  • Semper Fi
thinking out loud here, but wouldn't it be possible to 'steal' some code from a GPS, and feed it a map where each province is an intersection with roads to the neighboring provinces to each province, and tell it how many units long each road is, and then let that find the shortest way from Province ABC to XYZ? ... while it might be a large number it would certainly be finite and from my (admittedly somewhat limited) knowledge it shouldn't be that taxing for.

If it's implemented as one would expect, that's precisely what it is doing.
The general algorithm is called A* (A-star), and is a "best first" search algorithm.
By using a problem specific heuristic, it explores the node graph more intelligently than simple breadth-first or depth-first search algorithms.
 
Last edited:
  • 1
Reactions:

TehJumpingJawa

Field Marshal
93 Badges
Feb 26, 2011
2.974
3.887
  • Crusader Kings II: Way of Life
  • Crusader Kings III
  • Teleglitch: Die More Edition
  • The Showdown Effect
  • Warlock: Master of the Arcane
  • 500k Club
  • Europa Universalis IV: El Dorado
  • Magicka: Wizard Wars Founder Wizard
  • Mount & Blade: Warband
  • Mount & Blade: With Fire and Sword
  • Hearts of Iron IV: Cadet
  • Imperator: Rome
  • Prison Architect
  • Imperator: Rome Sign Up
  • Europa Universalis IV: Common Sense
  • Stellaris: Ancient Relics
  • Crusader Kings II: Conclave
  • Stellaris
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Stellaris: Federations
  • Age of Wonders: Planetfall Sign Up
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • BATTLETECH
  • Shadowrun: Hong Kong
  • Age of Wonders III
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Surviving Mars: Digital Deluxe Edition
  • BATTLETECH - Digital Deluxe Edition
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Europa Universalis IV
  • Europa Universalis III Complete
  • Surviving Mars
  • Europa Universalis III Complete
  • War of the Roses
  • Warlock 2: The Exiled
  • Warlock 2: Wrath of the Nagas
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria 2
  • Europa Universalis IV: Res Publica
  • Sword of the Stars II
  • Sword of the Stars
  • Semper Fi
Can't easily explain this behaviour :confused:

Auto-pathing:

Arsi -> Gonder; generates erroneous very much longer route.
Gonder -> Arsi; generates correct shortest route.

output_aCjiZQ.gif


A* certainly shouldn't make such broken paths. (unless the heuristic is really quite broken)
 

ForzaA

Thalassic QA
Paradox Staff
QA
69 Badges
Apr 1, 2001
10.288
1.546
  • Rome Gold
  • Knights of Pen and Paper +1 Edition
  • Leviathan: Warships
  • The Kings Crusade
  • Lost Empire - Immortals
  • Magicka
  • Majesty 2
  • Majesty 2 Collection
  • March of the Eagles
  • Europa Universalis III Complete
  • Naval War: Arctic Circle
  • Victoria: Revolutions
  • Europa Universalis: Rome
  • King Arthur II
  • Semper Fi
  • Ship Simulator Extremes
  • Sword of the Stars
  • Sword of the Stars II
  • Supreme Ruler 2020
  • Starvoid
  • Teleglitch: Die More Edition
  • The Showdown Effect
  • Victoria 2
  • Rome: Vae Victis
  • Warlock: Master of the Arcane
  • Imperator: Rome Sign Up
  • Dungeonland
  • Arsenal of Democracy
  • Hearts of Iron II: Armageddon
  • Cities in Motion
  • Cities in Motion 2
  • Crusader Kings II
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Deus Vult
  • Diplomacy
  • A Game of Dwarves
  • East India Company Collection
  • Europa Universalis III
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • For The Glory
  • For the Motherland
  • Hearts of Iron III
  • Heir to the Throne
  • Impire
While I really like the discussion on search algorithms and path finding, I'd like to repeat the "save games please" for specific situations. It doesn't seem like the algorithm as a whole is broken, but there are specific edge cases where (presumably due to rounding or "good enough" conditions) the results are suboptimal.
 

Voigt

General
66 Badges
Mar 15, 2012
2.253
2.761
A question about pathfinding in General in Paradox Games.

Does it only look for the shortest route, or does it also look for a short route with low attrition on the way, because of insufficent provincesupply?
 

hwoosh

Field Marshal
61 Badges
Aug 5, 2013
2.976
1.231
  • Crusader Kings II
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Pre-order
  • Cities: Skylines Deluxe Edition
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Europa Universalis IV: Res Publica
  • Knights of Pen and Paper +1 Edition
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Wealth of Nations
  • Cities in Motion 2
  • Europa Universalis IV: Art of War
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Jade Dragon
  • Stellaris: Digital Anniversary Edition
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Stellaris - Path to Destruction bundle
  • BATTLETECH
  • Surviving Mars
  • Victoria 3 Sign Up
  • Tyranny - Bastards Wound
  • Age of Wonders III
  • Age of Wonders
  • Age of Wonders II
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Pillars of Eternity
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Victoria 2
  • Teleglitch: Die More Edition
While I really like the discussion on search algorithms and path finding, I'd like to repeat the "save games please" for specific situations. It doesn't seem like the algorithm as a whole is broken, but there are specific edge cases where (presumably due to rounding or "good enough" conditions) the results are suboptimal.

Considering there's suboptimal pathing all over the map and it's 100% reproducible (not talking about anything to do with forts here, just cases of the algorithm spitting out bad paths), do you really need actual save games?

Just load up a new game as the Timurids and try walking from one end of your country to the other. There's your save file, the unmodified 1444 start. :D
 
  • 1
Reactions: