Hi there, having the NPC ships flying around is a multi-layered task that will require some time to complete so here’s a little interim update.
The objective is to make all NPC vessels “persistent”, that is going on performing their mission even when outside of the player’s cognitive horizon. This way ASG’s galaxy should operate as a network, with all ships acting as propagation vectors for the game’s economy in a consistent way (carrying notably information, illegal goods and criminal agents).
As part of this work all inhabited stellar systems are now equipped with facilities, and new ships were added to reach a current total of more than 1200. That would obviously be too large a number to render with the usual continuous physics (one sample or more per frame). And thus the first component for the feature is a high-level event-driven simulator that manages agents at discrete times corresponding to the main changes in their state (for instance when a ship arrives at a new celestial body or docks to a station). That simulator produces the log displayed in the post’s featured image above.
An additional difficulty in ASG is the underlying physics which obviously has to apply to both the player and all NPC vessels. Again the associated flight planning computations would not be possible to manage in real time (even on parallel working threads), especially since the player may accelerate the simulation rate to more than x2000 on long ballistic legs. To deal with this, the simulation relies on pre-computed schedules for galactic routes linking the main civilization centers (more than 150 currently). NPC ships use these tables to plan their journeys at very low computation cost
Interestingly the constant orbital motion of the visited celestial bodies makes the trajectory change over time. In some circumstances the required ΞV budget may even exceed the capability of regular starliners, effectively closing the route to the commercial traffic. These “galactic tides” are depicted in the video below. The effect is worse on the rim where usable stellar systems are sparse and relative galactic velocities higher:
Complementing the pre-computed tables, intra-system trips are planned using the path-finding heuristic. On a single dedicated parallel thread this high-level simulator can currently animate all of the 1200 ships with a time acceleration in excess of x 30 000. That’s about a x 10 worst case margin over the main thread.
There are still a few quirks to iron out with this is first layer, and then the next step will consist in properly instantiating the nearby vessels for the regular continuous simulation flow.
Thanks for reading!
Fascinating stuff as always! Will route planning take these “tides” in account? Or will active navigation be required when enroute to a long distance target?
Good question! π
For far away NPCs the pre-computed routes will be considered to remain valid within a time interval of a few days, but that’s a necessary shortcut to save computing resources. However the player’s route and flight planners build and validate exact trajectories (in space and time), that is they always take into account the actual orbital configurations along the way (more info: Route Planning)
Those “islands” that form as the orbital configurations change are very interesting. I could imagine a few ships ending up stuck between a few systems for a while. I suppose that means the systems that are often isolated together would probably tend to have faster than usual information/cargo propagation between them since there would often be no other choice of destination but the “neighboring” system. How long do these periods of relative isolation take, in the average Rim system for instance?
I’m afraid I don’t have statistics for systems yet but some routes can be blocked for months indeed. The general setting makes me think about the sailing ships here on Earth before the telegraph, so the islands you mention could very well correspond to the Caribbeans with Europe an ocean away π However I was thinking that information would probably be very valuable for such a civilization, so I added dedicated “courier” ships that will pick their destinations based on the information propagation model. That will require a second set of pre-computed schedules with a larger ΞV budget though.
About stuck ships I’m currently dealing with “docking jams” and more vessels than docking ports at some locations and times π
Very nice blog post! Do you have any measurements in case you accelerate time concerning dynamics accuracy (like the order of the error in your integrator or something)? I mean, apart from kinematics, if you for example use an integrator for dynamic objects (forces/accelerations/velocities/positions), it’s hard to make sure the sim just doesn’t “explode”?
On a side-note: Did you receive my e-mail concerning support? I was a little surprised I didn’t get any answer.
Dynamics accuracy will have to be monitored indeed π. I haven’t thought about this in relation with NPCs yet, but numerical integration will likely be used for very close ones only, and possibly with a separate adaptive sampling rate synchronized with the main frame (that’s the method used for the player ship’s systems). Further away I’m planning to use kinematics as you mention, with ships following trajectories computed once using the flight planning routines. And finally the “remote ops” (in different stellar systems) presented in that post are rendered using a discrete event-based simulator for speed. The overall scheme follows the usual “Level Of Detail” approach actually.
(I’m afraid I could not find the message you mention so I just sent you one myself!)