Jump to content

Developer Insights #13 – KSP2 Resource System


Intercept Games

Recommended Posts

  • KSP2 Alumni

Hi, I’m Jamie Leighton (JPLRepo). Yes, I am, or was, one of the Lead Engineers for KSP1. As you probably all know (since it was announced last year), we have stopped development on KSP1 and the KSP1 team have now transitioned over to KSP2.  I am now a Senior Engineer on the KSP2 team, and my job is to technically design, build and implement the systems and technical functionality we need to make KSP2 a fantastic game.

Of course, having worked on KSP1 for many years, I can apply all my KSP knowledge, familiarity, and learnings from spending years on KSP1 to solving some of the bigger problems we had with KSP1.

With that in mind, today we are going to talk about just one of the many things I’ve been working on, the KSP2 Resource System. There aren’t any glitzy visuals, pictures, or videos we can show you for this system, but it is a fundamental underlying system that is critical to the function of rocket ships and planes. Sorry if this gets a bit too technical for some, but without further ado, let’s go!

The KSP2 Resource System

KSP2-Resource-System

In KSP2 The resource system consists of two main components:

The Resource Core Subsystem

  • The Resource core provides the building blocks for the resource system for defining, storing and accessing resources.
  • It contains definitions and data for all resources in the game.
  • Resources are stored in containers and there can be multiple containers on a part.
  • Containers on a vessel can be grouped into collections based on various parameters – such as the resource type, a particular priority, in order of hierarchy and so on.
  • This is all managed “under the hood” by the Resource Core Subsystem.

The Resource Flow Subsystem

  • The Resource Flow subsystem provides the management, graphing query and request brokers to manage all resource flows in a vessel and is dependent on the Resource Core subsystem.
  • Fuel and resource flows between parts are handled via resource requests.
  • For any part on a vessel and a given fuel flow mode and type there is a corresponding sequenced group of containers (created and managed by the Resource Core Subsystem mentioned above).
  • The Resource Flow Subsystem is split into two halves:
    • Flow Requests – which consists of the Resource Flow Request Broker is responsible for marshalling resource requests and interfacing between requestors (usually Part Modules) and the vessel’s Resource Flow Manager.
    • Flow Management – which consists of the Resource Flow Manager, Resource Flow Priority Query Solver and Resource Flow Graph, is responsible for creating and caching the resource container groups and processing Flow Requests.
  • KSP2 Resource requests are rate-based, which is to say that they are “set and forget”. A requestor can setup a flow request and specify the units of a resource it wants at a fixed rate per second. The resource system will automatically continue to process resource requests at the rate specified and provide a request response to the requestor. It will continue to do this, even if the resource runs out, until the requestor turns off the request.
  • The requestor can adjust any of the resource request parameters at any time (such as the amount requested per second) and the resource system will automatically begin processing the request with the updated details.
  • Like KSP1, KSP2 resource requests can also be on a once-per-update tick of the game.

n KSP1, one of the most common issues was that resources could only be accessed, consumed, and generated if the parts of a vessel were loaded into memory/within physics range. What we referred to as “loaded” or “off-rails”. In KSP2 these issues are no longer a problem/restriction due to the KSP2 Resource System being Architected and built from the ground up. All of the components of the Resource System live and execute in the Simulation side of the KSP2 Architecture which means they are independent of physical objects and parts.

Hopefully this gives a little insight into just a small part of what we have been up to when it comes to building KSP2. Until next time, Thank you!

View the full article

Link to comment
Share on other sites

Interesting. I am getting a bit of Factorio/Satisfactory/DysonSphereProject vibes from this. I am certainly not expecting resource management to be anywhere close as in depth as those automation games, but I will be interested to see as to what depth KSP2 might venture into that area of game play in regards to colony management.

Edited by MechBFP
Link to comment
Share on other sites

9 minutes ago, MechBFP said:

Interesting. I am getting a bit of Factorio/Satisfactory/DysonSphereProject vibes from this. I am certainly not expecting resource management to be anywhere close as in depth as those automation games, but I will be interested to see as to what depth KSP2 might venture into that area of game play in regards to colony management.

Did you get lost for a bit too?

Link to comment
Share on other sites

8 hours ago, Intercept Games said:

In KSP2 these issues are no longer a problem/restriction due to the KSP2 Resource System being Architected and built from the ground up. All of the components of the Resource System live and execute in the Simulation side of the KSP2 Architecture which means they are independent of physical objects and parts.

In what ways will these improvements be applied? Will colonies have full background simulation even when out of focus?

Link to comment
Share on other sites

I'm glad this is getting a technical overhaul- I won't be able to leave the SAS wheels stabilizing my craft for years at a time, but I also can say goodbye to having to stay on a craft while it runs its ISRU and the frequent loss of power when time warping with probes. Cool elegant system!

Link to comment
Share on other sites

2 minutes ago, Pthigrivi said:

How are you deducing that?

Ya I wouldn’t think that either. It’s entirely possible, and extremely likely given the game isn’t an automation game, that resources are infinite. The focus of the game is space flight and travel, and the devs have already said they want to avoid pressuring the player, which finite resources would most certainly do. Not to mention the headaches of time warp thrown into the fix making that problem infinitely worse. 

Link to comment
Share on other sites

6 hours ago, shdwlrd said:

I'm wondering if there will be any performance increases for KSP2 compared to KSP1?

Performance tuning is one of the top priorities for our team, and it's an aspect I've stressed since joining up on KSP2 just over two years ago. Our engineers are working on runtime performance as part of every feature that goes in the game, and I'll have more to elaborate on this at a later date.

Link to comment
Share on other sites

This sounds like it sets up for colonies, long-haul travel and other features that allow for remote management and persistent-world dynamics for ships and structures without having to 'pilot' them in active control.  For instance, controlling and monitoring a long burn from an interstellar, from the mission control on Kerbal....or....    automated resupply missions....

Link to comment
Share on other sites

17 minutes ago, Redneck said:

Long Story short, KSP2 not even close to release!

For the umpteenth time, the releases here, especially the tiny technical details have no bearing on whether the game will release sooner or later. If we were showcased the entire finished and polished colony system we could assume the game is coming soon and if we are showcased a prototype system for colonies we can assume that it will take them a while to develop it, but the fact that fuel flows in the background is not at all indicative of a release date. So far, almost all of the releases are specifically on things that don't really tell us how the core gameplay is going, so we cannot make any assumptions. 

1 hour ago, Basesixty said:

I think it may mean we can have fuel flow in the background. This would help produce fuel on colonies when not loaded.

And engine burning in the background, and if there are other mechanics that produce or consume fuels, it is easily implemented and modders should be able to do stuff with it. 

Link to comment
Share on other sites

On 2/25/2022 at 1:00 AM, Intercept Games said:

Hi, I’m Jamie Leighton (JPLRepo)

...

The Resource Flow Subsystem

  • ...
  • The Resource Flow Subsystem is split into two halves:
    • Flow Requests – which consists of the Resource Flow Request Broker is responsible for marshalling resource requests and interfacing between requestors (usually Part Modules) and the vessel’s Resource Flow Manager.
    • Flow Management – which consists of the Resource Flow Manager, Resource Flow Priority Query Solver and Resource Flow Graph, is responsible for creating and caching the resource container groups and processing Flow Requests.
  • KSP2 Resource requests are rate-based, which is to say that they are “set and forget”. A requestor can setup a flow request and specify the units of a resource it wants at a fixed rate per second. The resource system will automatically continue to process resource requests at the rate specified and provide a request response to the requestor. It will continue to do this, even if the resource runs out, until the requestor turns off the request.
  • The requestor can adjust any of the resource request parameters at any time (such as the amount requested per second) and the resource system will automatically begin processing the request with the updated details.

Still picturing that silly monorail mod idea I posited: can requests be made so that are sent or arrive in block-like increments? 

I know that "rate-based" means basically Flowrate and assuming the resource (say, a fluid, or even electricity or solar energy) is arriving by some kind of direct pipeline (fuel pipe, wire, line-of-sight to a star, etc.) Would it be a manner of programming to build a flowrate so that the resource "is delivered" as, say, a tank of fuel that's 5000L all at once (because the tanker arrived at the depot) instead of 50L/min ?

Or is the core of the system made so that the only way fuel can be transferred is between containers with the flowrate? Meaning if I want to run a fuel delivery railroad, I still gotta discreetly transfer fuel from the depot tank to each railroad car.

Link to comment
Share on other sites

On 2/25/2022 at 1:00 AM, Intercept Games said:

KSP2 Resource requests are rate-based, which is to say that they are “set and forget”. A requestor can setup a flow request and specify the units of a resource it wants at a fixed rate per second. The resource system will automatically continue to process resource requests at the rate specified and provide a request response to the requestor. It will continue to do this, even if the resource runs out, until the requestor turns off the request.

What's the advantage of this system over one that shuts off when a resource runs out? As someone with 0 experience with game design, I don't understand why repeatedly sending request responses that say "0 resource remaining" could be useful.

Link to comment
Share on other sites

3 hours ago, TROPtastic said:

What's the advantage of this system over one that shuts off when a resource runs out? As someone with 0 experience with game design, I don't understand why repeatedly sending request responses that say "0 resource remaining" could be useful.

I think it is more versatile to have the option to keep requesting, so that systems don't get messed up when resources run out. If a ship requests materials from a base and the base runs out of materials before the ship is full, this system will allow the ship to keep requesting new materials as the base produces them. Additionally, I think it is possible and even easy to program shutting off the request, so this isn't a blanket rule that all craft will constantly request.

Link to comment
Share on other sites

Some specific questions please:

1. Regarding "global" craft resource usage (RCS monopropellant and Vernor fuel): will we have the possibility to create stage/sub-craft resource groups, so for example RCS only uses fuel from the currently controlled lower stage and not from upper stages? This can be done now through manual priority setting on individual tanks, but we need better separation.

2. Somewhat related to previous point, will we have an improved fuel transfer interface (between tank groups, not only individual tanks)?

3. Can you clarify if we will have continuous resource usage during time warp / for on-rails craft? Does this extend to being able to accelerate during time warp / on-rails mode?

4. Will Kerbals require life-support resources?

5. Will we have resource transfer conveyors / tubes / hoses / wires?

6. How will resource collection and transportation be automated? Will we have automated rover / train / helicopter / plane / rocket transports? Will we have a logistics map-view mode?

7. Will resource scarcity and competition be integrated in multiplayer?

8. Will resource collection also be necessary on Kerbin?

Edited by Vl3d
minor wording change
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...