Gateways+ trade routes = massive performance drop

  • 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.

Jaydonium

Sergeant
26 Badges
Jun 12, 2018
56
5
  • Magicka
  • Stellaris: Synthetic Dawn
  • Stellaris: Distant Stars
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall
  • Stellaris: Ancient Relics
  • Prison Architect
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Stellaris: Megacorp
  • BATTLETECH: Flashpoint
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Surviving Mars
  • BATTLETECH
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Magicka 2
  • Pillars of Eternity
  • Magicka: Wizard Wars Founder Wizard
I was playing on a small galaxy, I just got gateway build tech, so I figured sweet. I can eliminate piracy by putting a gateway in all my trade starbases. About 10 gateways total would be needed.

On gateway 4 performance tanked hard. But I persevered. I finished all 10, but now the game is unplayable as theres 3-4 seconds delay with each click or action. Pausing the game eliminates the delay instantly.

I went and tested it on a new save, built 8 gateways around my home system, as soon as I built another trade starbase the performance tanked, and my empire was only 10 systems.

I tested on hive mind, I was able to colonize the whole galaxy and build roughly 100 gateways without performance issues.

So yeah, don't ruin a 10 hour game by building gateways to eliminate piracy. Unless you are hive mind. Then build all the gateways you please.
 

Dodonpa

Private
69 Badges
Aug 23, 2016
14
0
  • Crusader Kings II: Charlemagne
  • Stellaris: Synthetic Dawn
  • Cities: Skylines - After Dark
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II
  • Europa Universalis IV
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Humanoids Species Pack
  • Europa Universalis IV: Rights of Man
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Third Rome
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - Green Cities
  • Europa Universalis IV: Cradle of Civilization
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Rule Britannia
  • Victoria 2
  • Cities: Skylines - Parklife Pre-Order
  • Europa Universalis 4: Emperor
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris: Apocalypse
  • Stellaris: Galaxy Edition
Probably, distance calculation is causing a thing.

In my case, 4 trading hub with Gateway caused no problem but if I increased the trading hub to 5, it caused a slight freeze.
 

Jaydonium

Sergeant
26 Badges
Jun 12, 2018
56
5
  • Magicka
  • Stellaris: Synthetic Dawn
  • Stellaris: Distant Stars
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Stellaris: Federations
  • Stellaris: Lithoids
  • Age of Wonders: Planetfall Deluxe edition
  • Age of Wonders: Planetfall
  • Stellaris: Ancient Relics
  • Prison Architect
  • Imperator: Rome
  • Imperator: Rome Deluxe Edition
  • Stellaris: Megacorp
  • BATTLETECH: Flashpoint
  • Stellaris: Apocalypse
  • Stellaris: Humanoids Species Pack
  • Surviving Mars
  • BATTLETECH
  • Stellaris - Path to Destruction bundle
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Magicka 2
  • Pillars of Eternity
  • Magicka: Wizard Wars Founder Wizard
I managed to reduce lag by destroying every star base I owned that had access to trade resources. Oddly my empire is still in the green. but all the numbers of trade goods all over the place are kind of annoying.

As a test I built some trade hubs on my capital starbase. The game went back to taking roughly 20 seconds per day with 2 trade hubs. My income went up by 1k though.

EDIT: The game crashed when I got to 4 trade hubs.
 
Last edited:

Astax

Lt. General
39 Badges
Jun 4, 2016
1.377
482
  • Crusader Kings II: Legacy of Rome
  • Stellaris: Synthetic Dawn
  • Stellaris: Apocalypse
  • Stellaris: Galaxy Edition
  • Crusader Kings II
  • Sword of the Stars
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Stellaris: Nemesis
  • Age of Wonders III
  • Stellaris: Humanoids Species Pack
  • Surviving Mars: Digital Deluxe Edition
  • Stellaris: Distant Stars
  • Surviving Mars: First Colony Edition
  • Stellaris: Megacorp
  • Surviving Mars: First Colony Edition
  • Age of Wonders: Planetfall
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Stellaris: Necroids
  • Surviving Mars
  • Knights of Honor
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Stellaris Sign-up
  • Stellaris: Galaxy Edition
  • Stellaris
  • Mount & Blade: Warband
  • Cities: Skylines
  • Warlock 2: The Exiled
  • Stellaris - Path to Destruction bundle
  • Stellaris: Distant Stars Pre-Order
  • Stellaris: Ancient Relics
This makes sense. The calculation due to the extra connections must be ridiculous. And no easy way to fix this unless they specificially omit the gateways (not a good idea) or redo how the hubs actually work.
 

Mastikator

Technocrat
16 Badges
Jul 2, 2017
3.372
4.598
  • Cities: Skylines
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Stellaris: Synthetic Dawn
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Prison Architect
  • Stellaris: Ancient Relics
  • Stellaris: Federations
  • Stellaris: Nemesis
  • Magicka
  • Stellaris
This makes sense. The calculation due to the extra connections must be ridiculous. And no easy way to fix this unless they specificially omit the gateways (not a good idea) or redo how the hubs actually work.
Finding loops in node trees is a well known problem (and solution), just add a flag that says "I've been here before" when searching through the nodes and stop when you see the flag so you never continue through a node more than once. This is programming 101 and it's probably just an oversight that they'll fix in 2.2.2 :)
 

MagKel

Private
12 Badges
Dec 21, 2017
18
0
  • Stellaris
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Age of Wonders III
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Crusader Kings II
  • Stellaris: Synthetic Dawn
Mathematically what could happen is that pathing algorithms are breath-first, which means that for each node the software iterates every path until exhausted, which is very common strategy where O(|V|+|E|) or Linear Time.

No matter how many CPU-cores you have, since gateways are infinite endpoints upon which you can build infinite edges E with V zero, the algorithm loops until it is pushed out of queue for the tick.
 

A Cat

Second Lieutenant
56 Badges
Dec 21, 2014
160
207
  • Crusader Kings II: Charlemagne
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Sword of the Stars
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Heir to the Throne
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Europa Universalis III
  • Europa Universalis III Complete
  • Europa Universalis IV: Art of War
  • Crusader Kings II: Sword of Islam
  • Stellaris: Distant Stars
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Cities: Skylines - Green Cities
  • Crusader Kings II: Jade Dragon
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Lithoids
  • Shadowrun: Dragonfall
  • Cities: Skylines Industries
  • Stellaris: Ancient Relics
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: El Dorado
  • Stellaris: Nemesis
  • Crusader Kings III
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Stellaris: Federations
  • Victoria 2
  • Warlock: Master of the Arcane
  • Cities: Skylines
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Conclave
  • Stellaris
  • Crusader Kings II: Reapers Due
Finding loops in node trees is a well known problem (and solution), just add a flag that says "I've been here before" when searching through the nodes and stop when you see the flag so you never continue through a node more than once. This is programming 101 and it's probably just an oversight that they'll fix in 2.2.2 :)

That's probably part of it.

Actually, it almost sounds like this is based on trade hubs which shouldn't even be a path finding deal. Its finding every node within a given distance, so you don't care about paths.

I don't think they should be running the trade path finding algorithm every day either.
 
Last edited:

Captain Conundrum

Sergeant
58 Badges
May 27, 2018
61
0
  • Crusader Kings II
  • Stellaris - Path to Destruction bundle
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Megacorp
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Stellaris: Federations
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Europa Universalis IV: Dharma
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Golden Century
  • Stellaris: Synthetic Dawn
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Crusader Kings II: Holy Fury
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Magicka: Wizard Wars Founder Wizard
  • Stellaris: Lithoids
  • Europa Universalis IV: El Dorado
  • War of the Roses
  • Victoria 2
  • Teleglitch: Die More Edition
  • Stellaris: Ancient Relics
  • Europa Universalis IV: Common Sense
  • Stellaris: Necroids
  • Prison Architect
  • Europa Universalis IV
  • Ship Simulator Extremes
  • Sengoku
  • Magicka
  • Knights of Pen and Paper +1 Edition
  • Impire
  • Hearts of Iron III
  • Crusader Kings II: Sons of Abraham
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Crusader Kings II: Rajas of India
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Legacy of Rome
Is it the trade routes causing this, the collection distance going through gateways, or both? If it is just being caused by collection distance, it might be better to just not allow starbases to collect trade value through gateways and wormholes.
 

Jorrhast

General
Apr 24, 2017
2.403
0
What's there to solve? Specifically for trade routes (which apparently use their own PF algo since patrol routes differ from TRs), quick and dirty fix till they have more time:
1) for GW trade systems, the route is 2-point, direct from here to capital;
2) for non-GW trade systems, ignore all gateways for purpose of PF; after the path is plotted, check for nearest GW system on the path and if there is one, go to p.1.