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

Pancakelord

Lord of Pancakes
44 Badges
Apr 7, 2018
3.375
12.292
  • Cities: Skylines - Green Cities
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Stellaris: Ancient Relics
  • Cities: Skylines - Mass Transit
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Imperator: Rome
  • Stellaris: Digital Anniversary Edition
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Cities: Skylines - Parklife
  • Stellaris: Distant Stars
  • Shadowrun Returns
  • Cities: Skylines Industries
  • Imperator: Rome Deluxe Edition
  • Magicka: Wizard Wars Founder Wizard
  • Stellaris: Nemesis
  • Europa Universalis IV
  • Stellaris: Necroids
  • Sword of the Stars
  • Crusader Kings III
  • War of the Roses
  • Cities: Skylines
  • Stellaris: Federations
  • Cities: Skylines - After Dark
  • Cities: Skylines - Snowfall
  • Stellaris: Lithoids
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Stellaris - Path to Destruction bundle
  • Stellaris: Megacorp
  • Stellaris: Synthetic Dawn
  • Crusader Kings II
  • Stellaris
  • Cities: Skylines Deluxe Edition
  • Sword of the Stars II
  • March of the Eagles
  • Darkest Hour
Ok so was trying to compress my scripts and noticed that the game is totally fine with everything being on a single line (i'd tried this before but it didnt work, must have missed a bracket last time)
Anyway.

wh_network_1 = { name = WH_NETWORK_NAME is_pathfind = yes uses_action = no requires_exploration = no always_active = yes windup_time = 30 winddown_time = 30 ftl_multiplier = 1 icon_frame = 25 remember_instances = no galactic_map_tooltip_header = WH_NETWORK_HEADER galactic_map_tooltip_desc = WH_NETWORK_DESC connection_type = scripted_connection animation_time = 30 ftl_ship_effect = "gateway_ftl_ship_effect_entity" ftl_bypass_effect = "gateway_ftl_bypass_effect_entity" country_can_use = { custom_tooltip = { fail_text = WH_NETWORK_COUNTRY_CANNOT_USE has_civic = wh_network_civilization_civic_1 } } scripted_connection = { node = { has_star_flag = wh_network_node_set_1 } nexus = { has_star_flag = wh_network_station_nexus_set_1 } } }
You can compress - say the Bypass function into a single string like the above. Now i've copy-pasted the L-Gate script and changed the words to read Wormhole network.

Now... I feed this in to excel and dynamically swap out these 3 sub-strings:
wh_network_1
wh_network_node_set_1
wh_network_station_nexus_set_1

and do autofill... for 2000 rows.
1613873273532.png

wh_network_2000 = { name = WH_NETWORK_NAME is_pathfind = yes uses_action = no requires_exploration = no always_active = yes windup_time = 30 winddown_time = 30 ftl_multiplier = 1 icon_frame = 25 remember_instances = no galactic_map_tooltip_header = WH_NETWORK_HEADER galactic_map_tooltip_desc = WH_NETWORK_DESC connection_type = scripted_connection animation_time = 30 ftl_ship_effect = "gateway_ftl_ship_effect_entity" ftl_bypass_effect = "gateway_ftl_bypass_effect_entity" country_can_use = { custom_tooltip = { fail_text = WH_NETWORK_COUNTRY_CANNOT_USE has_civic = wh_network_civilization_civic } } scripted_connection = { node = { has_star_flag = wh_network_node_set_2000 } nexus = { has_star_flag = wh_network_station_nexus_set_2000 } } }

I now have a 1.6 MEGABYTE TEXT FILE filled with 2000 valid scripted bypasses.

Next step - in my theory - is to add a new megastructure that can be built... The wormhole network station [one per system]. Its only buildable by countries with the "Wormhole drive empire" civic (not removable after start, doesnt consume a civic slot but has a very low chance to appear in-game on random AIs).

From here, on completion of the WH Station, several things need to happen.

  • Upon completion, search the system for flags, make sure it doesnt have a "has_wormhole_network" flag.
  • Then search global_flags for a free index (wormhole_network_used_1, wormhole_network_used_2, wormhole_network_used_3, ... wormhole_network_used_2000)
  • Find the next free one, and assign that to your system with the wormhole station,
  • using an if-statement attach the equivalent bypass to the station
    • e.g. system now has "active_wh_station_1439". attach bypass "wh_network_1439" to the wormhole station megastructure
  • spawn a wormhole disk entity by/above the wormhole station (just for graphics)
  • run an event that uses distance to find all stars within range
    • distance = { source = [the WH Station's system] min = 0 max = @max_wh_station range type= euclidean uses_bypass= no }
  • spawn "wh_network_node" megastructures randomly on the edges of all previously flagged systems (that do NOT* spawn megastructure icons on the galaxy map)
  • assign the same bypass ID number to those flagged systems (e.g. wh_network_1439)
*As you also attach a sensor range property (= @max_wh_station range) [lifted off the sensor megastructure] to the wormhole station megastructure, too. This will let you see a yellow ring indicating the systems in-range.

Also Have a separate script that can undo all of this if the megastructure is dismantled via event (e.g. if you want crises to "blow these up" when they kill the local starbase).

Now, perhaps its possible to compress most of this into scripted effects and only call relevant functions as needed, vastly cutting down on the amount of text - otherwise more dynamic macros need to be made in excel to account for all 2000 permutations of this (if wh_network_1111 = xyz else wh_network_1112 = ....) - for testing/development you'd just start with say _1, _2, _3 networks and if it works well you can scale up via macro.

You then give all ships for empires using this civic a "Wormhole FFID" FTL drive that doesnt actually let them use hyperlanes (just copy-paste the HL component but remove the hyperdrive property and change the fluff text) as these WH bypasses have a check in them to see if countries with this civic can use them (you'll get a few odd events where you inherit hyperlane ships - but a housekeeping event could hot-swap their FTL drives at the end of the month)

Surely I'm missing something obvious here? The LGate script works on the same basis as the old wormholes (ie. you can jump out to any target system, but you have to go via the L-cluster to visit another L-gate) so it near-perfectly mimics how wormholes used to play.

How it would play:
  • First you build a WH station (or start with one, thanks to the civic running an event on start).
  • Your ships would only be able to travel from the wormhole_station_IDX to any wormhole_node_IDX of the same IDX number (ie only to wormhole points in nearby stars)
  • But you can then go to another system and build another wormhole station megastructure with a new IDX number - now your ships can travel from home, to a system with two different network's nexuses (e.g. Alpha Cen has the wormhole_nexus_1 and wormhole_nexus_2 egress points in it) and use that to hop between networks and travel the galaxy (SOL / wh_network_1 station to blorgalorg / wh_network_2 station)..
  • The system above would be good for 2000 wormhole networks/stations - but you can only have 1 station per star (with maybe 50 more generated at runtime in a game, tops) so it'd work with larger mod galaxies (up to say 1800 too) - and I could easily generate a file with 10000 bypasses in it (4mb probably)
  • WH station range could be tweaked to find something decent.
    • You could even bring back 3 tiers of WH drive, increasing range - but this would involve re-calculating scripts for distance, so a bad idea, better to pick 1 WH network range and stick to it.
Would the AI be able to use it?
  • Navigation: Yes. If it can use L-gates, it can navigate this and path between different bypasses no problem.
  • Construction: A bit trickier.... but yes. With work.The AI could be given decisions that automates the build process (probably best, less confused constructors flying around) or pulsed events could fire ordering it to it build a network on any star X-Y distance away from its stations (i.e. on the leading edge of it's "wormhole bubble").
    • An event that (every 6m) flags stars X dist away from existing AI wormhole_networks ("build a station here") in owned territory [destroyed if outpost changes hands] could be used as a targeter for where to build these things - via event or via constructor given scripted orders.
Note: I have no clue what such a large bypass set would do to RAM overheads or performance... having that 1.6mb file in the game's folder structure didn't affect main boot times of the game (and it needs to index, if not call, everything on start-up - so a good sign, at least).

..... And that is it. Wormhole drives and stations are back in Stellaris?

Surely it's not this easy? Right?
 
Last edited:
  • 2Like
  • 1Love
Reactions:
Considering some have cited pathfinding as one of the likely culprits for endgame lag, this leaves me somewhat terrified.
Pre 2.0 pathfinding was handled differently for Hyperlanes, wormholes & Warp, leading to terrible slowdowns and (i think) ram usage for the 3 different movement networks. With post 2.0 I think it is all handled 1) using the same network and 2) using the same pathfinder code. A gateway is literally just teleporting ships from A to B - you can treat it like an extra, hidden, hyperlane with an FTL speed of 9999999

War-pathfinding (a key component of lag in something like the war in heaven) is bad for a few reasons - FTL inhibitors & open/closed borders all regularly shifting force the hyperlane network to change, causing recalculations often, which then causes thread locks elsewhere, whilst something like this mod would ignore FTL inhibitors - though it'd still be subject to the re-calculation side effects of borders opening/closing.
  • Though I personally play with closed borders disabled via a quick mod of mine, magical closed borders are a terrible feature that hurts immersion, is a core cause of the midgame being stagnant [as AIs cant interact with eachother much], reduces your ability to explore the galaxy and encourages turtling / boxing off other nations, imo.
  • I also personally disable planetary FTL inhibitors, only leaving them enabled on starbases (again, it's a single line edit to do this) - which to me makes the game feel a little smoother in wars.
I suppose testing performance of something like this wormhole mod would be easy enough. Disable the hyperdrive and spawn an active gateway in most systems to see what performance is like. Ships will only be able to path via bypasses (gateways) then, not by gateways and hyperlanes. It wouldn't be quite the same as this mod, as all pathing would be point-to-point whereas with this mod it'd be point - to 1-N intermediaries - to point, but the average path length would definitely be shorter than with vanilla hyperlanes in either case and it would give a rough idea of performance impacts (which I don't expect to really be large at all).
 
Last edited:
  • 1
Reactions: