Author Topic: Civilian Contracts  (Read 4778 times)

0 Members and 1 Guest are viewing this topic.

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11675
  • Thanked: 20470 times
Civilian Contracts
« on: January 08, 2010, 04:45:25 PM »
In v4.8, the civilian shipping lines will be able to move installations for you. You can setup a supply or demand contract for a specified amount of a specified installation type using a new section on the Civilian tab of the Economics window (see below). For example, you may setup a supply contract for 20 mines on Earth and a demand contract for 20 mines on Mars. For the civilians, this works in a very similar way to trade goods. They will look for matching supply and demand contracts, in this case on Earth and Mars, and create a trade run. As soon as they select the trade run and setup their orders, one installation is deducted from both the supply and demand contracts. This is to prevent duplication. The new contract section will show outstanding contracts and any contracts in progress that affect the population you are viewing. You don't have to worry about matching up contracts as the civilians will figure that out by themselves. If you have a surplus of something on a planet, then create a supply contract. If you need something, setup a demand contract. There may not be a match for it immediately but as soon as one appears the civs will spot it. Each freighter run will cost you 5 wealth for a same system contract and 10 wealth for an interstellar contract, which is paid when the freighter completes the contract. This wealth will be added to the wealth of the shipping line.

When a freighter is looking for a new trade run it will look at government contracts at its current location first, then potential trade runs at its current location, then government contracts originating in the same system, then trade runs originating in the same system, etc. As you already know, civilians work out trade runs for themselves and trade routes and trade hubs develop. In a well-developed game, If the civilian trade routes are not going near the locations of the supply contracts because there are easier trade runs available, you may have to move your installations to the nearest trade hub. It will be up to you to decide if partial civilian shipping is better than making the whole run with your own ships.

This should add a new dimension to NPRs as well. I will be able to create demand and supply contracts for various installations on individual worlds, depending on the situation on that world, without worrying about the NPR Empire situation as a whole. The NPR civilians will do that worrying for me.

[attachment=0:3nr8vhs8]Civs.JPG[/attachment:3nr8vhs8]
Steve
 

Offline schroeam

  • Lt. Commander
  • ********
  • s
  • Posts: 217
  • Thanked: 7 times
  • "Let's try a new strategy, let the Wookiee win"
Re: Civilian Contracts
« Reply #1 on: January 08, 2010, 05:47:35 PM »
Steve,
So what happens if I have a surplus of 1 terraforming facility and Alien X, with whom I have a trade treaty, has a demand for 1 terraforming facility?  Will that facility suddenly get transferred to the alien world and would there be some sort of automatic credit transaction if that occurred?

Adam.
 

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11675
  • Thanked: 20470 times
Re: Civilian Contracts
« Reply #2 on: January 08, 2010, 05:54:20 PM »
Quote from: "adradjool"
Steve,
So what happens if I have a surplus of 1 terraforming facility and Alien X, with whom I have a trade treaty, has a demand for 1 terraforming facility?  Will that facility suddenly get transferred to the alien world and would there be some sort of automatic credit transaction if that occurred?
Unlike trade goods, all government contracts are within one Empire only.

Steve
 

Offline sloanjh

  • Global Moderator
  • Admiral of the Fleet
  • *****
  • Posts: 2805
  • Thanked: 112 times
  • 2020 Supporter 2020 Supporter : Donate for 2020
    2021 Supporter 2021 Supporter : Donate for 2021
Re: Civilian Contracts
« Reply #3 on: January 08, 2010, 07:42:15 PM »
This reminds me of a "feature" I ran into the last time I was running civies: the 4 jump limit.

Consider the following situation of 3 worlds

Homeworld A <--3 jumps --> Colony B <--3 jumps--> Colony C

I don't remember how it happened, but essentially I had colony ships that were stuck at either A or C, and didn't see any valid runs remaining so they just sat there.  I think it might have been that A and B were both sources of colonists, and the colony ships were at A, and didn't know they should go to C.

Is it possible to set the logic up so that civies will look farther than 4 jumps if they don't find anything within 4 jumps.  You could restrict it so it only looks for systems within the civie's owning empire beyond 4 jumps, so they don't end up traveling a long way into an alien empire (and so they can get back out if they do).

John
 

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11675
  • Thanked: 20470 times
Re: Civilian Contracts
« Reply #4 on: January 09, 2010, 09:30:49 AM »
Quote from: "sloanjh"
This reminds me of a "feature" I ran into the last time I was running civies: the 4 jump limit.

Consider the following situation of 3 worlds

Homeworld A <--3 jumps --> Colony B <--3 jumps--> Colony C

I don't remember how it happened, but essentially I had colony ships that were stuck at either A or C, and didn't see any valid runs remaining so they just sat there.  I think it might have been that A and B were both sources of colonists, and the colony ships were at A, and didn't know they should go to C.

Is it possible to set the logic up so that civies will look farther than 4 jumps if they don't find anything within 4 jumps.  You could restrict it so it only looks for systems within the civie's owning empire beyond 4 jumps, so they don't end up traveling a long way into an alien empire (and so they can get back out if they do).
I can code for more than 4 jumps. The issue is more one of performance. There are a large number of checks performed during each increment with respect to finding things in other systems. Increasing the limit to 5 or 6 would potentially lead to an exponential effect on performace. Although perhaps I could set that up as a gameplay option so you could restrict or expend the limit if you wished. I'll give it some thought.

Steve
 

Offline sloanjh

  • Global Moderator
  • Admiral of the Fleet
  • *****
  • Posts: 2805
  • Thanked: 112 times
  • 2020 Supporter 2020 Supporter : Donate for 2020
    2021 Supporter 2021 Supporter : Donate for 2021
Re: Civilian Contracts
« Reply #5 on: January 09, 2010, 10:46:27 AM »
Quote from: "Steve Walmsley"
Quote from: "sloanjh"
This reminds me of a "feature" I ran into the last time I was running civies: the 4 jump limit.

Consider the following situation of 3 worlds

Homeworld A <--3 jumps --> Colony B <--3 jumps--> Colony C

I don't remember how it happened, but essentially I had colony ships that were stuck at either A or C, and didn't see any valid runs remaining so they just sat there.  I think it might have been that A and B were both sources of colonists, and the colony ships were at A, and didn't know they should go to C.

Is it possible to set the logic up so that civies will look farther than 4 jumps if they don't find anything within 4 jumps.  You could restrict it so it only looks for systems within the civie's owning empire beyond 4 jumps, so they don't end up traveling a long way into an alien empire (and so they can get back out if they do).
I can code for more than 4 jumps. The issue is more one of performance. There are a large number of checks performed during each increment with respect to finding things in other systems. Increasing the limit to 5 or 6 would potentially lead to an exponential effect on performace. Although perhaps I could set that up as a gameplay option so you could restrict or expend the limit if you wished. I'll give it some thought.

Steve

Yeah, I figured that was the case.  Two thoughts on other options:

1)  Allow the player to give Aurora "hints" specifying trade routines between specific planet pairs that are more than 4 jumps apart.  So, in the example, I could open a "trade route configuration" screen, pick system A as a starting system, give it a series of jump orders (same as for TG on the F12 screen) that wind up at system C, then hit a "store trade route".  A commercial ship in A would then add the systems at the other end of all trade routes either originating in or terminating at A to the list of systems to check for contracts.  Note that I said "system" rather than "planet" in case there's more than one population in either A or C - one trade route would get all NxM combinations if there were N in A and M in C.

2)  (independent of #1)  You could add a second phase to the analysis of trade routes between systems.  In the first phase, Aurora finds all trade routes of length 4 or less between populated systems (this is essentially whats coded up now).  These, plus any player-defined trade routes (if you implemented #1) are used to build a graph (in the graph theory sense).  The nodes of the graph are populated systems, and the links are trade routes between them, plus the links could have a weight that was the number of jumps.  The idea here is that the trade routes can be thought of as "super jumps", with a variable cost.  You can the use the code you've already got to look for super-trade-routines that are up to 4 super jumps long.  In the example, there'd be trade routines AB (cost 3) and BC (cost 3).  A ship at A wouldn't find any contracts using a simple trade route.  So it would then look at the super-jump network, and notice a 2 super-jump route between A and C.

While typing this I realized that #2 is an optimization that can be stored in the data base.  There shouldn't be that many populated systems in an Aurora game (no more than a few hundred), so N^2 won't get you, and the trade routes will only change rarely (when a new jump gate is added, a new system is colonized (or decolonized), a new trade route defined by the player, etc), so the calculation of the trade route network would only need to be done infrequently.  The trade routes could also be used in the F12 orders screen - in addition to listing populations to jump to at the top of the screen, you could list populated systems to jump to (possibly on a checkbox option similar to waypoints).

John
 

Offline Father Tim

  • Vice Admiral
  • **********
  • Posts: 2162
  • Thanked: 531 times
Re: Civilian Contracts
« Reply #6 on: January 09, 2010, 11:34:53 AM »
To keep the preformance costs down, you can simply set it up so that civilians will only look beyond four jumps if they can't find anything within four jumps.  That should solve the problem of 'stranded' ships that no longer have a trade route back to civilization.
 

Offline sloanjh

  • Global Moderator
  • Admiral of the Fleet
  • *****
  • Posts: 2805
  • Thanked: 112 times
  • 2020 Supporter 2020 Supporter : Donate for 2020
    2021 Supporter 2021 Supporter : Donate for 2021
Re: Civilian Contracts
« Reply #7 on: January 09, 2010, 12:26:34 PM »
Quote from: "Father Tim"
To keep the preformance costs down, you can simply set it up so that civilians will only look beyond four jumps if they can't find anything within four jumps.  That should solve the problem of 'stranded' ships that no longer have a trade route back to civilization.

Yep, that was my original suggestion.  OTOH, my old empire got into a situation where there was more cargo capacity than interstellar trade would support.  I think Steve's afraid that one could get into a situation where a significant number of "extended searches" were happening every turn, and since the number of combinations probably grows exponentially in the number of jumps, that can get really slow really fast.

John
 

Offline boggo2300

  • Registered
  • Rear Admiral
  • **********
  • Posts: 895
  • Thanked: 16 times
Re: Civilian Contracts
« Reply #8 on: January 09, 2010, 05:10:51 PM »
There will be much rejoicing throughout the United Kingdom of Terra (until they realise theyre about to be deleted for 4.8  :wink: ) I really like Johns idea of definig trade routes instead of just increasing the 4 jump limit, though not sure how easy that would be to impliment

Matt
The boggosity of the universe tends towards maximum.
 

Offline alanwebber

  • Warrant Officer, Class 1
  • *****
  • a
  • Posts: 99
Re: Civilian Contracts
« Reply #9 on: January 10, 2010, 07:13:35 AM »
Steve

I have a problem with shipping lines. I have a colony next to Sol which is now over 30 million colonists. I set the colony to be a supplier of colonists and have another small colony within 2 jumps of Sol. All jumps have gates in place. However all the shipping lines stopped shipping colonists and are only moving freight to the one next door. I was also wondering about setting up transit lines which used to be available until you put the automatic system in place.
Regards

Alan Webber
 

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11675
  • Thanked: 20470 times
Re: Civilian Contracts
« Reply #10 on: January 11, 2010, 07:17:56 AM »
Quote from: "Father Tim"
To keep the preformance costs down, you can simply set it up so that civilians will only look beyond four jumps if they can't find anything within four jumps.  That should solve the problem of 'stranded' ships that no longer have a trade route back to civilization.
That is what happens at the moment. A fleet looks at every system within 1 jump. If nothing found then moves on to trying every system within 2 jumps, excluding the ones it just checked, etc.. My concern is more about the fact that some fleets are making four jump checks every increment for months on end until something changes. If that becomes five and six jump checks it will have an impact on performance.

Steve
 

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11675
  • Thanked: 20470 times
Re: Civilian Contracts
« Reply #11 on: January 11, 2010, 07:19:30 AM »
Quote from: "alanwebber"
Steve

I have a problem with shipping lines. I have a colony next to Sol which is now over 30 million colonists. I set the colony to be a supplier of colonists and have another small colony within 2 jumps of Sol. All jumps have gates in place. However all the shipping lines stopped shipping colonists and are only moving freight to the one next door. I was also wondering about setting up transit lines which used to be available until you put the automatic system in place.
Has there been any combat in the affected system or en route? Civilians will avoid systems with recent combat for quite a while.

Steve
 

Offline Steve Walmsley (OP)

  • Aurora Designer
  • Star Marshal
  • S
  • Posts: 11675
  • Thanked: 20470 times
Re: Civilian Contracts
« Reply #12 on: January 11, 2010, 07:36:35 AM »
Quote from: "sloanjh"
1)  Allow the player to give Aurora "hints" specifying trade routines between specific planet pairs that are more than 4 jumps apart.  So, in the example, I could open a "trade route configuration" screen, pick system A as a starting system, give it a series of jump orders (same as for TG on the F12 screen) that wind up at system C, then hit a "store trade route".  A commercial ship in A would then add the systems at the other end of all trade routes either originating in or terminating at A to the list of systems to check for contracts.  Note that I said "system" rather than "planet" in case there's more than one population in either A or C - one trade route would get all NxM combinations if there were N in A and M in C.

2)  (independent of #1)  You could add a second phase to the analysis of trade routes between systems.  In the first phase, Aurora finds all trade routes of length 4 or less between populated systems (this is essentially whats coded up now).  These, plus any player-defined trade routes (if you implemented #1) are used to build a graph (in the graph theory sense).  The nodes of the graph are populated systems, and the links are trade routes between them, plus the links could have a weight that was the number of jumps.  The idea here is that the trade routes can be thought of as "super jumps", with a variable cost.  You can the use the code you've already got to look for super-trade-routines that are up to 4 super jumps long.  In the example, there'd be trade routines AB (cost 3) and BC (cost 3).  A ship at A wouldn't find any contracts using a simple trade route.  So it would then look at the super-jump network, and notice a 2 super-jump route between A and C.

While typing this I realized that #2 is an optimization that can be stored in the data base.  There shouldn't be that many populated systems in an Aurora game (no more than a few hundred), so N^2 won't get you, and the trade routes will only change rarely (when a new jump gate is added, a new system is colonized (or decolonized), a new trade route defined by the player, etc), so the calculation of the trade route network would only need to be done infrequently.  The trade routes could also be used in the F12 orders screen - in addition to listing populations to jump to at the top of the screen, you could list populated systems to jump to (possibly on a checkbox option similar to waypoints).
Interesting idea about creating a stored trade network. Would be a lot of work but might be worth it. One significant problem though is that a lot of the multi-system jump checks (especially for NPRs) are not just for civilian traffic. At the moment checks are made for geological and gravitational survey opportunities, friendly pops generally, pops with 25m+, suitable colonies for unloading (that do not already have inbound fleets), pops with fuel, specific ordnance, maint supplies or maint facilties, fleets with tankers or supply ships, unexplored jump points, JPs with no gate, mining populations, ship contacts, population contacts, fleets with specific ship types (such as escorts looking for capital ships), points of interest for NPRs, import requirements for trade goods, goods available for export, ruins, specific installations required (in v4.8), specific installations supplied (v4.8), etc.. Any overall changes I make will affect all of the above. Although one option would be to prevent longer searches for certain search types, the temptation would be to use the code (especially for NPRs) if it was available. I couldn't build all of these into a node system as they change too often and I am reluctant to create different code for different types of searches. At the moment the specifics of what you are looking for are separated from the generic code that handles the searching, which means it is very easy to add new searches. You have given me some things to think about though.

Steve
 

Offline alanwebber

  • Warrant Officer, Class 1
  • *****
  • a
  • Posts: 99
Re: Civilian Contracts
« Reply #13 on: January 11, 2010, 07:59:36 AM »
Quote from: "Steve Walmsley"
Quote from: "alanwebber"
Steve

I have a problem with shipping lines. I have a colony next to Sol which is now over 30 million colonists. I set the colony to be a supplier of colonists and have another small colony within 2 jumps of Sol. All jumps have gates in place. However all the shipping lines stopped shipping colonists and are only moving freight to the one next door. I was also wondering about setting up transit lines which used to be available until you put the automatic system in place.
Has there been any combat in the affected system or en route? Civilians will avoid systems with recent combat for quite a while.

Steve

No combat on route. Once I reset the 30 million + world as a destination for colonists, the shipping lines started moving colonists into there again but nowhere else.

Alan
Regards

Alan Webber
 

Offline sloanjh

  • Global Moderator
  • Admiral of the Fleet
  • *****
  • Posts: 2805
  • Thanked: 112 times
  • 2020 Supporter 2020 Supporter : Donate for 2020
    2021 Supporter 2021 Supporter : Donate for 2021
Re: Civilian Contracts
« Reply #14 on: January 11, 2010, 10:00:45 AM »
Quote from: "Steve Walmsley"
Interesting idea about creating a stored trade network. Would be a lot of work but might be worth it. One significant problem though is that a lot of the multi-system jump checks (especially for NPRs) are not just for civilian traffic. At the moment checks are made for geological and gravitational survey opportunities, friendly pops generally, pops with 25m+, suitable colonies for unloading (that do not already have inbound fleets), pops with fuel, specific ordnance, maint supplies or maint facilties, fleets with tankers or supply ships, unexplored jump points, JPs with no gate, mining populations, ship contacts, population contacts, fleets with specific ship types (such as escorts looking for capital ships), points of interest for NPRs, import requirements for trade goods, goods available for export, ruins, specific installations required (in v4.8), etc.. Any overall changes I make will affect all of the above. Although one option would be to prevent longer searches for certain search types, the temptation would be to use the code (especially for NPRs) if it was available. I couldn't build all of these into a node system as they change too often and I am reluctant to create different code for different types of searches. At the moment the specifics of what you are looking for are separated from the generic code that handles the searching, which means it is very easy to add new searches. You have given me some things to think about though.

Steve

Quick implementation idea for the issue you pose:  I assume you would save trade route links in the DB, e.g. with "start system" and "end system" fields.  You could add additional (boolean) attribute fields for each of the various types of criteria you're using, so the "find a path given a set of links" code could be generic, but the criterion passed to "find the links associated with this criterion" would vary.

John