Price Formula

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Makita
Posts: 123
Joined: Sat, 14. Jan 06, 01:32
x4

Price Formula

Post by Makita »

Looking for the formula for pricing in the tships so i can adjust some ships properly but can seem to find any info on it, any help would be appreciated. Thanks
exogenesis
Posts: 2718
Joined: Sun, 9. Sep 07, 15:39
x4

Post by exogenesis »

factor = 80.7212
except for M6M, M7 & M7M: factor = 65.555784
(one-off exceptions are SS_SH_A_M1: factor = 49.892, SS_SH_A_M2 & SS_SH_T_M2: factor = 50.299)

Initial base ship price = factor * Production RelVal (NPC)

Actual base price is dependent on built-in-wares
eg for Argon Nova Sentinel : Fight1 & Fight 2, adding around 6000 credits (only 0.25% of the ship price)

Real price at shipyard depends on other optional installed equipment (shields, lasers etc, as in S, M & L variants for sale),
and also speed-tuning and cargo-hold-extension (if either is possible for a given ship).
These can add a signifiacant %age to the price.
Makita
Posts: 123
Joined: Sat, 14. Jan 06, 01:32
x4

Post by Makita »

Thanks you for the info Exogenesis
User avatar
em3e3
Posts: 2245
Joined: Tue, 15. Aug 06, 00:04
x3tc

Post by em3e3 »

I realize that this thread is 8 months old, and it will probably be locked after this post, but after spending hours over the past year searching for the answer provided here, and trying different calculations, my OCD side is very happy to finally have a solution. I'm wondering why the formula provided by exogenesis isn't readily available in the other stickied/guide threads?
8^)

Online Complex Calculators - X3:TC • X3:R • X2
Online Ship Compurator - X3:TC
jlehtone
Posts: 22499
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone »

Such a short thread must have slipped South unnoticed at the time. (There are other such threads too. Seen them, considered valuable but had no time to link, and then failed to find them again. :( ) [url=http://forum.egosoft.com/viewtopic.php?t=216693]TC Tutorials[/url] updated.

S&M is programming, and programming encourages reuse. We have multiple entries in [url=http://forum.egosoft.com/viewtopic.php?t=216696][b]T[/b][b]C[/b] [b]S[/b]&M Posting [b]R[/b]ules[/url] about that (reuse of threads). You chose Rule #0 option 1. A wise choice. :)
User avatar
em3e3
Posts: 2245
Joined: Tue, 15. Aug 06, 00:04
x3tc

Post by em3e3 »

Oh good, too used to reg. forums. Back OT, has the posted formula been confirmed by ES, or did it come from ES? I'd like to know, if only for peace of mind.
8^)

Online Complex Calculators - X3:TC • X3:R • X2
Online Ship Compurator - X3:TC
exogenesis
Posts: 2718
Joined: Sun, 9. Sep 07, 15:39
x4

Post by exogenesis »

As you say, suprised thread is allowed to live, but
if this sort stuff is of interest there must be tons of individual
threads with snippets on the forum - how would you collect them?
(although jlehtone is making a good effort to do so, well done :))

The figures are from inspection (reverse-engineered / emperical), and are as used in the
model viewer. 100% accurate so far compared to in-game values.
User avatar
em3e3
Posts: 2245
Joined: Tue, 15. Aug 06, 00:04
x3tc

Post by em3e3 »

Ship prices shown in-game, in the Info screen of the shipyards, don't perfectly match the factors that exogenesis provided. A table of the Argon ships, with their price related info and calculations from the TShips file is below. As you can see, something else must be influencing the base ship price, and it doesn't appear to be the cost of the installed extensions.

The best example is the Disco Raider, with an NPC RelVel of 1000, and the standard Centaur, NPC RelVal 120000. You would assume that the base price of the Centaur is 120 times that of the Disco Raider, but if you look at the table, it's higher by 32 credits. Base price must somehow depend on the NPC Production RelVal!

Code: Select all

Ship Name                 Ship ID         Class   PRV (NPC)   PRV (Player)   Base Price (In-Game)   Base Price / PRV (NPC)
Discoverer                SS_SH_A_M5        M5       666          5028            53761                80.7222222222222222
Discoverer Hauler         SS_SH_A_M5_2      M5       733          5028            59167                80.7189631650750341
Discoverer Raider         SS_SH_A_M5_1      M5      1000          5028            80721                80.721
Mercury                   SS_SH_A_TS        TS      2333          2333           188323                80.7213887698242606
Mercury Tanker            SS_SH_A_TS_1      TS      2333          2333           188323                80.7213887698242606
Magnetar                  SS_SH_A_TM        TM      3500          3500           282522                80.7205714285714286
Mistral                   SS_SH_OTAS_TS     TS      3560          3560           287366                80.7207865168539326
Zephyrus                  SS_SH_OTAS_TM     TM      3950          3950           318847                80.7207594936708861
Buster                    SS_SH_A_M4        M4      5028          5028           405864                80.720763723150358
Solano                    SS_SH_OTAS_M4P    M4P     5028          5028           405864                80.720763723150358
Express                   SS_SH_A_TP        TP      5028          5028           405864                80.720763723150358
Buster Vanguard           SS_SH_A_M4_2      M4      6285          6285           507334                80.7214001591089897
Mercury Hauler            SS_SH_A_TS_2      TS      6416          6416           517907                80.7211658354114713
Mercury Tanker            SS_SH_A_TS_3      TS      6416          6416           517907                80.7211658354114713
Mercury Super Freighter   SS_SH_A_TS_4      TS      6416          6416           517907                80.7211658354114713
Buster Raider             SS_SH_A_M4_1      M4      7543          7543           608879                80.7210658889036193
Elite                     SS_SH_A_M4P       M4P    10522         10522           849347                80.7210606348602927
Mercury Super Freighter   SS_SH_A_TS_5      TS     16333         16333          1318417                80.7210555317455458
Mistral Super Freighter   SS_SH_OTAS_TS_1   TS     18560         18560          1498187                80.7212823275862069
Nova                      SS_SH_A_M3        M3     19847         19847          1602074                80.7212173124401673
Nova Raider               SS_SH_A_M3_1      M3     19847         19847          1602074                80.7212173124401673
Nova Vanguard             SS_SH_A_M3_2      M3     24809         24809          2002612                80.721189890765448
Nova Sentinel             SS_SH_A_M3_3      M3     27786         27786          2242921                80.7212625062981358
Eclipse                   SS_SH_A_M3P       M3P    66000         66000          5327602                80.7212424242424242
Gladiator                 SS_SH_A_M8        M8     66950         66950          5404290                80.7212845407020164
Centaur                   SS_SH_A_M6        M6    120000        120000          9686552                80.7212666666666667
Heavy Centaur             SS_SH_A_M6M       M6M   216852        216852         14215902                65.5557799789718333
Skiron                    SS_SH_OTAS_M6M    M6M   218450        218450         14320661                65.5557839322499428
Mammoth                   SS_SH_A_TL        TL    351145        351145         28344868                80.7212632957894887
Cerberus                  SS_SH_A_M7        M7    548190        548190         35937026                65.5557854028712673
Sirokos                   SS_SH_OTAS_HCF    M7    580345        580345         38044972                65.5557849210383479
Aquilo                    SS_SH_OTAS_M7M    M7M   580345        580345         38044972                65.5557849210383479
Minotaur                  SS_SH_A_M7M       M7M   765330        765330         50171808                65.5557837795460782
Colossus                  SS_SH_A_M1        M1   1355948       1355948         67651530                49.8924221282822055
Titan                     SS_SH_A_M2        M2   1374045       1374045         69112343                50.2984567463219909
Boreas                    SS_SH_OTAS_M2     M2   1387000       1387000         90925873                65.5557844268204758
8^)

Online Complex Calculators - X3:TC • X3:R • X2
Online Ship Compurator - X3:TC
exogenesis
Posts: 2718
Joined: Sun, 9. Sep 07, 15:39
x4

Post by exogenesis »

The existing 'HQ Production Costs' spread sheet I put up relates to X3:Reunion.

I haven't looked to see if TC has changes many ship relvals,
and don't forget the Raider has built-in items (triplex scanner etec)
which alter the raider's base price.

Perhaps I should update the sheet, but I think Carlo's TC version
covers the main values, doesn't it?
User avatar
em3e3
Posts: 2245
Joined: Tue, 15. Aug 06, 00:04
x3tc

Post by em3e3 »

Even the HQ production cost price doesn't seem to relate exactly to the 'base' shipyard price. HQ production cost * 3.73 is pretty close to the base price for the Argon ships, but the prices are still off by a few credits.

And from what I can tell, it doesn't seem like the base price includes installed extensions or upgrades.
8^)

Online Complex Calculators - X3:TC • X3:R • X2
Online Ship Compurator - X3:TC
exogenesis
Posts: 2718
Joined: Sun, 9. Sep 07, 15:39
x4

Post by exogenesis »

Er, sorry got a bit confused there, ignore previous post.

You right there's a discrepancy, but I make it an error of only 7 credits
for the centaur, it's only a question of the accuracy of the factor.
The factor 80.7212 given above is correct, but only quoted to 6 significant figures.

Apply it for disco raider and centaur you get base prices of

raider : 1000 * 80.7212 = 80721.2
centaur : 120000 * 80.7212 = 9686544.0

In-game (TC) min price at shipyard - price of things in ship:
raider : 101665 - 5192 - 9828 - 2416 - 3508 = 80271
centaur : 9842368 - 155816 = 9686552

Error in calculated values:
raider = 0.2 credits
centaur = -7.0 credits

So the more accurate factor is the one you get from the centaur figures, i.e. 80.72126.
If you apply that factor to the raider, you still get 0 credits error.

I think the real factor is between 80.72121 and 80.72126,
when you start to get errors of only 1 credit in big ship prices, you're
only looking a rounding errors.
User avatar
Litcube
Posts: 4254
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube »

Just a note, the SS_SH_A_M1 & SS_SH_A_M2 are not hardcoded. They simply have RelVals over 1,323,077 as a value, at which point prices start to wrap.

I have no idea what the formula is on the wrap, but it starts at just under a divisor of 49.8.

TrixX and I have also discovered that setting Price Mod 1 to 25 keeps all ships at the 80.7212 modifier (M6Ms, M7s, M7Ms are all set to 1).
User avatar
Sam L.R. Griffiths
Posts: 10522
Joined: Fri, 12. Mar 04, 19:47
x4

Post by Sam L.R. Griffiths »

I am currently looking at Ware price calculations in general (for my Changeling tool) of which Ship prices is a part.

My focus so far has been on Laser pricess and how they compare with other wares, but so far I have not come up with a consistent overall calculation.

For Lasers there appears to be an approximate scaling factor of 64.9239 from the NPC RelVal to Average Price.

For Missiles there appears to be an approximate scaling factor of 28.075.

For Bio Wares there appears to be an approximate scaling factor of 5.25.

Given that the MCSI domain uses integer maths (nominally signed 32-bit) perhaps there is some common link between the value calculations?

Modifier 1 seems to affect the min/max values (perhaps a normal distribution factor?)

EDIT: WRT Ships specifically, I believe the shipyard price is affected by your reputation with the Shipyard race.
Lenna (aka [SRK] The_Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams
User avatar
Carlo the Curious
Posts: 16999
Joined: Mon, 5. Mar 07, 22:03
x4

Post by Carlo the Curious »

Roger L.S. Griffiths wrote:EDIT: WRT Ships specifically, I believe the shipyard price is affected by your reputation with the Shipyard race.
The old X3R HQ spreadsheet used (1+(16-rank)/20) as a multiplier to adjust the price (where 1 is max rank). Apparently you also got a bonus for selling to a shipyard of the same race as that of the ship as well.

No idea if it's the same in TC though...
User avatar
Sam L.R. Griffiths
Posts: 10522
Joined: Fri, 12. Mar 04, 19:47
x4

Post by Sam L.R. Griffiths »

Carlo the Curious wrote:
Roger L.S. Griffiths wrote:EDIT: WRT Ships specifically, I believe the shipyard price is affected by your reputation with the Shipyard race.
The old X3R HQ spreadsheet used (1+(16-rank)/20) as a multiplier to adjust the price (where 1 is max rank). Apparently you also got a bonus for selling to a shipyard of the same race as that of the ship as well.

No idea if it's the same in TC though...
I would imagine that price calculations fall into the category of "it's not broke so don't fix it".

I take it you are refering to converting from the in-game sale price to the HQ manufacturing value?
Lenna (aka [SRK] The_Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams
jlehtone
Posts: 22499
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone »

Roger L.S. Griffiths wrote:Given that the MCSI domain uses integer maths (nominally signed 32-bit) perhaps there is some common link between the value calculations?
One would have to do integer math like:

Code: Select all

RelVal * M / N
Naturally, the order of operators does matter to rounding. M/N would show as the "scaling factor". Btw, Ecells do have factor 4.0.

M might be common constant for all and N a ware class specific value.
User avatar
Carlo the Curious
Posts: 16999
Joined: Mon, 5. Mar 07, 22:03
x4

Post by Carlo the Curious »

Roger L.S. Griffiths wrote:I take it you are refering to converting from the in-game sale price to the HQ manufacturing value?
Calculating the sale price from the RelVal.

Actually, I think it's exogenesis' spreadsheet, so he should know!
User avatar
Sam L.R. Griffiths
Posts: 10522
Joined: Fri, 12. Mar 04, 19:47
x4

Post by Sam L.R. Griffiths »

jlehtone wrote:
Roger L.S. Griffiths wrote:Given that the MCSI domain uses integer maths (nominally signed 32-bit) perhaps there is some common link between the value calculations?
One would have to do integer math like:

Code: Select all

RelVal * M / N
Naturally, the order of operators does matter to rounding. M/N would show as the "scaling factor". Btw, Ecells do have factor 4.0.

M might be common constant for all and N a ware class specific value.
I have tried to run a linear least-squares fit on a sample of the ship values but did not get any closer to the scaling factor (could not force the offset to 0 on my calculator).
Lenna (aka [SRK] The_Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"When eating an elephant take one bite at a time" - Creighton Abrams
User avatar
F.A.B.
Posts: 767
Joined: Fri, 27. Feb 09, 18:47

Post by F.A.B. »

em3e3 wrote:[...] The best example is the Disco Raider, with an NPC RelVel of 1000, and the standard Centaur, NPC RelVal 120000. You would assume that the base price of the Centaur is 120 times that of the Disco Raider, but if you look at the table, it's higher by 32 credits. Base price must somehow depend on the NPC Production RelVal! [...]
this is because 1 point relval is 64.9238892 credits. if you want to alter the price for a ship, try this formula.
best,
F.A.B.
User avatar
em3e3
Posts: 2245
Joined: Tue, 15. Aug 06, 00:04
x3tc

Post by em3e3 »

Some of the new posts have help me get closer to the actual formula used. Given these bits of information, I have a new working theory, but it's still not 100% accurate. I'm thinking reputation may be the final link…
Litcube wrote:Just a note, the SS_SH_A_M1 & SS_SH_A_M2 are not hardcoded. They simply have RelVals over 1,323,077 as a value, at which point prices start to wrap.

I have no idea what the formula is on the wrap, but it starts at just under a divisor of 49.8.
This is because 1,323,077 * 25 (Price Mod 1) * 64.9238892 = 2^31, and anything higher will result in the value turning 'signed'.
Litcube wrote:TrixX and I have also discovered that setting Price Mod 1 to 25 keeps all ships at the 80.7212 modifier (M6Ms, M7s, M7Ms are all set to 1).
64.9238892 * ( 1 + 25 / 100 ) ~= 80.7212
Roger L.S. Griffiths wrote:Given that the MCSI domain uses integer maths (nominally signed 32-bit) perhaps there is some common link between the value calculations?

EDIT: WRT Ships specifically, I believe the shipyard price is affected by your reputation with the Shipyard race.
F.A.B. wrote:this is because 1 point relval is 64.9238892 credits.
Here's the (somewhat) working formula:

Code: Select all

INT(NPC RelVal * Price Mod 1 * 64.9238892) = Base Value  <<< value over 2^31 will turn it negative (signed 32-bit)
NPC RelVal * 64.9238892 + Base Value = Base Shipyard Price
UPDATE: I have the first part figured out, it's ROUND(NPC RelVal * 64.9238892/4)*4 = Base Value
8^)

Online Complex Calculators - X3:TC • X3:R • X2
Online Ship Compurator - X3:TC

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”