Vehicle Cost Calculation
(→Variable Running Cost) |
|||
Line 217: | Line 217: | ||
In addition to modifying the running cost based on phase of flight, I also modify costs based on the planespeed setting. I use the same multipliers as the planeset; 1, 0.9, 0.8 and 0.5 for planespeeds 1/1 to 1/4 respectively. | In addition to modifying the running cost based on phase of flight, I also modify costs based on the planespeed setting. I use the same multipliers as the planeset; 1, 0.9, 0.8 and 0.5 for planespeeds 1/1 to 1/4 respectively. | ||
+ | |||
+ | Running costs for the buy menu also, obviously, need to change according to planespeed. I either do this with an action 0 blocked off by an action 9, or for the generational vehicles I have to do it by callback. | ||
====NFO: Av8 subroutine==== | ====NFO: Av8 subroutine==== |
Revision as of 01:20, 26 April 2011
This page outlines some basic cost calculations I use in my vehicle sets, both pre-calculated spreadsheet numbers, and the code used for variable running costs in the game. When designing a set in a spreadsheet, it's probably best to use standard numbers first, then fudge values for vehicles which you think need to be more or less expensive.
Base Costs
I use the following base costs:
- 0F/4B8E for locomotive purchase, multiplier 08
- 10/4B94 for wagon purchase, multiplier 0A
- 2A/4C30 for locomotive running, multiplier 0B
- 2B/4C36 for wagon running, multiplier 05
- 2D/xxxx for aircraft running, multiplier 0C
The NFO looks like this:
1 * 7 00 08 01 01 0F 08 08 // loco cost 1 * 7 00 08 01 01 10 08 0A // wagons cost 1 * 7 00 08 01 01 2A 08 0B // running cost 1 * 7 00 08 01 01 2B 08 05 // wagon running cost
Contents |
Trains
Locomotives
Purchase Cost
Steam Locomotives
Weight in Tons * ProdCost
- ProdCost is usually 0.25, but can be fudged between 0.2 and 0.3.
- Example: 4-6-0 Jubilee, 126 * 0.25 = 32
Diesel and Electric Locomotives
Weight in Tons * ProdCost * (Horsepower / BaseHP )
- ProdCost starts at 0.4 for early experimental diesels, 0.3 for 1960s production units, down to 0.22 for 21st century designs. Again, these numbers are fudgable if you think a particular vehicle should be more or less expensive. For electric locomotives, early vehicles are 0.5, and is down to 0.4 by the end of the century.
- BaseHP is a "typical" power output for engines of that type/era. For diesels, I use 2000 for models designed before 1975, 2500 from 1975 to 1990, and 3000 after 1990. For large electrics, I use 4000.
- Example: EE Type 3, 107 * 0.3 * (1750 / 2000) = 28
Running Cost
(Horsepower * EffCost) / (SuspCost - MaxSpeed)
- EffCost is the efficency of the design, where a higher number is worse; 5 for pre-WWI steam locomotives, down to 4.5 for the latest post-WWII designs. 4 for early diesels, with 3.75 for production diesels from the 1960s down to 3.5 for modern designs. 3 for most electrics. Very powerful locomotives may need lower numbers and very underpowered vehicles (eg railbusses) may need higher numbers.
- SuspCost represents the wear and tear on the traction system and track, and is a number roughly imagined as the speed at which the vehicle will fall apart. I use 200 for steam locomotives and 300 for modern electric locomotives, 225 for first generation diesels and 250 for modern diesels.
- Example: 4-6-0 Jubilee, (1550 * 4.75) / (200 - 90) = 67
- Example: EE Type 3, (1750 * 3.75) / (225 - 80) = 45
Variable Running Cost
NFO: UKRS2 subroutines
// ============ diesel engine running cost subroutine (action 2 98) 403 * 11 02 00 80 81 7D 01 00 FF 00 00 80 // return value in 7D 01 404 * 28 02 00 81 81 7D 01 20 FF \2u/ 1A 20 \b10 \2+ 7D 01 20 FF \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value +10%, resave to 7D 01 405 * 27 02 00 82 81 7D 01 20 FF \2u/ 1A 20 \b03 \2* 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -33%, resave to 7D 01 406 * 23 02 00 83 81 7D 01 20 FF \2u/ 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -50%, resave to 7D 01 407 * 23 02 00 84 81 7D 01 20 FF \2u/ 1A 20 \b03 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -66%, resave to 7D 01 408 * 23 02 00 85 81 7D 01 20 FF \2u/ 1A 20 \b04 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -75%, resave to 7D 01 // bonuses: // hybrid bonuses for Junker: 409 * 14 02 00 82 81 C6 00 FF 01 83 00 5C 5C 82 00 // -33 becomes -50 410 * 14 02 00 83 81 C6 00 FF 01 84 00 5C 5C 83 00 // -50 becomes -66 411 * 14 02 00 84 81 C6 00 FF 01 85 00 5C 5C 84 00 // -66 becomes -75 // running (+10% for running hard, -33% for running idle, -66% when stationary) 412 * 18 02 00 97 82 98 20 FF \2- B4 00 FF 01 82 00 00 0C //running idle 81 00 // running hard 413 * 14 02 00 97 82 B4 00 FF 01 97 00 02 FF 84 00 // stationary 414 * 17 02 00 97 86 90 00 FF FF 01 97 00 00 00 00 00 84 00 // at signal/station/depot? // running -25% = (0 for running hard, -50% for running idle, -66% when stationary) // 551 * 18 02 00 96 82 98 20 FF \2- B4 00 FF 01 // 83 00 00 0C //running idle // 80 00 // running hard // 552 * 14 02 00 96 82 B4 00 FF 01 96 00 02 FF 84 00 // stationary // 553 * 17 02 00 96 86 90 00 FF FF 01 96 00 00 00 00 00 84 00 // at signal/station/depot? // running - 50% = (-33% for running hard, -50% for running idle, -75% when stationary) 415 * 18 02 00 95 82 98 20 FF \2- B4 00 FF 01 83 00 00 0C //running idle 82 00 // running hard 416 * 14 02 00 95 82 B4 00 FF 01 95 00 02 FF 85 00 // stationary 417 * 17 02 00 95 86 90 00 FF FF 01 95 00 00 00 00 00 85 00 // at signal/station/depot? // position (50% for > 0) 418 * 14 02 00 97 81 40 00 FF 01 97 00 00 00 95 00 419 * 27 02 00 22 81 7D 01 20 FF \2u/ 1A 20 \b4 \2* 1A 20 \b3 \2s 1A 00 \b01 01 97 00 00 00 97 00 // ai run cost - 75% 420 * 14 02 00 97 81 43 10 FF 01 22 00 01 01 97 00 // AI company? // base calculations: // add the base, max 220, resave to 7D 01 421 * 27 02 00 97 81 1C 20 FF \2+ 7D 01 20 FF \2u< 1A 20 \b220 \2s 1A 00 \b01 01 97 00 00 00 97 00 // add age of loco\2 422 * 26 02 00 97 85 C0 60 FF FF 00 00 \w730 \2+ 1C 00 FF FF 01 97 00 00 00 00 00 97 00 // (low) add 1 per 3 years after 1970 up to max 20 423 * 20 02 00 94 81 01 60 FF CE 02 \2u< 1A 00 \b20 01 97 00 00 00 97 00 // (medium) add 1 per 2 years after 1970 up to max 30 424 * 20 02 00 96 81 01 60 FF CE 02 \2u< 1A 00 \b30 01 97 00 00 00 97 00 // (high) add 1 per year after 1970 up to max 50 425 * 20 02 00 98 81 01 60 FF CE 01 \2u< 1A 00 \b50 01 97 00 00 00 97 00 426 * 19 02 00 98 81 7D 01 00 FF 02 94 00 00 \b50 96 00 \b51 \b75 98 00 // add different fuel costs based on original runcost 427 * 14 02 00 97 81 1A 00 00 01 97 00 00 00 97 00 // set 1C to 0 428 * 14 02 00 98 81 01 00 FF 01 97 00 00 \b50 98 00 // the base loco running cost is stored in 7D 01. // =========== end of diesel engine running cost subroutine // ============ steam engine running cost subroutine (action 2 97) 429 * 11 02 00 80 81 7D 01 00 FF 00 00 80 // return value in 7D 01 430 * 27 02 00 81 81 7D 01 20 FF \2u/ 1A 20 \b04 \2* 1A 20 \b03 \2s 1A 00 \b01 01 80 00 00 00 80 00 // -25%, resave to 7D 01 431 * 23 02 00 82 81 7D 01 20 FF \2u/ 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // -50%, resave to 7D 01 // bonuses: 432 * 14 02 00 97 82 B4 00 FF 01 80 00 02 FF 82 00 // stationary 433 * 14 02 00 96 82 B4 00 FF 01 81 00 02 FF 82 00 // stationary 434 * 17 02 00 97 86 90 00 FF FF 01 97 00 00 00 00 00 82 00 // at signal/station/depot? 435 * 17 02 00 96 86 90 00 FF FF 01 96 00 00 00 00 00 82 00 // at signal/station/depot? // position (-25% for > 0) 436 * 14 02 00 97 81 40 00 FF 01 97 00 00 00 96 00 437 * 27 02 00 22 81 7D 01 20 FF \2u/ 1A 20 \b4 \2* 1A 20 \b3 \2s 1A 00 \b01 01 97 00 00 00 97 00 // ai run cost - 75% 438 * 14 02 00 97 81 43 10 FF 01 22 00 01 01 97 00 // AI company? // base calculations: // add the base, max 220, resave to 7D 01 439 * 27 02 00 97 81 1C 20 FF \2+ 7D 01 20 FF \2u< 1A 20 \b220 \2s 1A 00 \b01 01 97 00 00 00 97 00 // add age of loco\3 440 * 26 02 00 97 85 C0 60 FF FF 00 00 \w1095 \2+ 1C 00 FF FF 01 97 00 00 00 00 00 97 00 // add 1 per 2 years after 1940 up to max 40 441 * 20 02 00 96 81 01 60 FF EC 02 \2u< 1A 00 \b40 01 97 00 00 00 97 00 442 * 14 02 00 97 81 1A 00 00 01 97 00 00 00 97 00 // set 1C to 0 443 * 14 02 00 97 81 01 00 FF 01 97 00 00 \b20 96 00 // the base loco running cost is stored in 7D 01. // =========== end of steam engine running cost subroutine // ============ electric engine running cost subroutine (action 2 96) 444 * 11 02 00 80 81 7D 01 00 FF 00 00 80 // return value in 7D 01 445 * 28 02 00 81 81 7D 01 20 FF \2u/ 1A 20 \b10 \2+ 7D 01 20 FF \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value +10%, resave to 7D 01 446 * 27 02 00 82 81 7D 01 20 FF \2u/ 1A 20 \b03 \2* 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -33%, resave to 7D 01 447 * 23 02 00 83 81 7D 01 20 FF \2u/ 1A 20 \b02 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -50%, resave to 7D 01 448 * 23 02 00 85 81 7D 01 20 FF \2u/ 1A 20 \b04 \2s 1A 00 \b01 01 80 00 00 00 80 00 // return base value -75%, resave to 7D 01 // bonuses: // running (+10% for running hard, -33% for running idle, -75% when stationary) 449 * 18 02 00 94 82 98 20 FF \2- B4 00 FF 01 82 00 00 0C //running idle 81 00 // running hard 450 * 14 02 00 94 82 B4 00 FF 01 94 00 02 FF 85 00 // stationary 451 * 17 02 00 94 86 90 00 FF FF 01 94 00 00 00 00 00 85 00 // at signal/station/depot? // running - 50% = (-33% for running hard, -50% for running idle, -75% when stationary) 452 * 18 02 00 95 82 98 20 FF \2- B4 00 FF 01 83 00 00 0C //running idle 82 00 // running hard 453 * 14 02 00 95 82 B4 00 FF 01 95 00 02 FF 85 00 // stationary 454 * 17 02 00 95 86 90 00 FF FF 01 95 00 00 00 00 00 85 00 // at signal/station/depot? // position (50% for > 0) 455 * 14 02 00 95 81 40 00 FF 01 94 00 00 00 95 00 456 * 30 02 00 95 81 C6 00 FF 05 // skip this check for EMUs 94 00 76 77 // Met Cam, southern 94 00 7B 7B // renewal 94 00 67 69 // AM10, 321, Atrain 94 00 7A 7A // networker 94 00 80 80 // electrostar 95 00 457 * 27 02 00 22 81 7D 01 20 FF \2u/ 1A 20 \b4 \2* 1A 20 \b3 \2s 1A 00 \b01 01 95 00 00 00 95 00 // ai run cost - 75% 458 * 14 02 00 95 81 43 10 FF 01 22 00 01 01 95 00 // AI company? // base calculations: // add the base, max 220, resave to 7D 01 459 * 27 02 00 95 81 1C 20 FF \2+ 7D 01 20 FF \2u< 1A 20 \b220 \2s 1A 00 \b01 01 95 00 00 00 95 00 // add age of loco\2 460 * 26 02 00 95 85 C0 60 FF FF 00 00 \w730 \2+ 1C 00 FF FF 01 95 00 00 00 00 00 95 00 461 * 14 02 00 96 81 1A 00 00 01 95 00 00 00 95 00 // set 1C to 0 // the base loco running cost is stored in 7D 01. // =========== end of electric engine running cost subroutine // =========== electric engine power subroutine (95) 462 * 12 02 00 80 85 7D 01 00 FF FF 00 00 80 // return base value 463 * 22 02 00 81 85 7D 01 20 FF FF \2u/ 1A 20 \w03 \2* 1A 00 \w02 00 00 80 // return base value -33% // 199 * 17 02 00 83 85 7D 01 20 FF FF \2u/ 1A 00 \w02 00 00 80 // return base value -50% // position (-33%) 464 * 14 02 00 95 81 40 00 FF 01 80 00 00 00 81 00 // the base loco power is stored in 7D 01. // =========== end of electric engine power subroutine
NFO: UKRS2 locomotive hook
// RUNNING COSTS (subroutine 97) ============= 4858 * 11 02 00 22 81 7E 97 00 FF 00 00 80 // gogo gadget subroutine // vv 4859 * 18 02 00 21 81 1A 20 \b33 \2s 1A 00 \b01 01 22 00 00 00 22 00 // store the running cost 4860 * 14 02 00 21 81 10 00 FF 01 21 00 0D 0D 11 00 4861 * 14 02 00 11 81 0C 00 FF 01 21 00 36 36 11 00 // cb36
Aircraft
The purchase and running costs in av8 are done by eye, not by calculation. I do have some comparative calculations though to check if my costs are in the right ballpark; see Aviators Aircraft Vehicle Statistics for details.
Variable Running Cost
In addition to modifying the running cost based on phase of flight, I also modify costs based on the planespeed setting. I use the same multipliers as the planeset; 1, 0.9, 0.8 and 0.5 for planespeeds 1/1 to 1/4 respectively.
Running costs for the buy menu also, obviously, need to change according to planespeed. I either do this with an action 0 blocked off by an action 9, or for the generational vehicles I have to do it by callback.
NFO: Av8 subroutine
// VARIABLE RUNNING COSTS OMGZ! ======================================================================== // ============================ // planespeed cost multipliers // ============================ // Get planespeed value and save it in parameter 3 181 * 9 0D 03 00 10 FE FF FF 00 00 // skip 1 if planespeed not off 182 * 6 09 85 01 00 4F 01 // parameter 3 = 1 183 * 9 0D 03 00 FF 00 01 00 00 00 // 1577 * 11 0B 01 1F FF 80 80 7B 00 "=" 00 03 // display planespeed test // ============================= //Subroutine 9A - running cost stored in 7D 01. 184 * 19 02 03 91 81 1C 20 FF \2u/ 1A 20 04 \2+ 7D 01 00 FF 00 00 80 // 125% 185 * 23 02 03 91 81 7D 01 20 FF \2u< 1A 20 CC \2s 1A 00 01 01 91 00 00 00 91 00 // clamp to CC if 125% 186 * 11 02 03 92 81 7D 01 00 FF 00 00 80 // 100% 187 * 19 02 03 93 81 7D 01 20 FF \2u/ 1A 20 04 \2* 1A 00 03 00 00 80 // 75% 188 * 15 02 03 94 81 7D 01 20 FF \2u/ 1A 00 02 00 00 80 // 50% 189 * 15 02 03 95 81 7D 01 20 FF \2u/ 1A 00 04 00 00 80 // 25% 190 * 15 02 03 96 81 7D 01 20 FF \2u/ 1A 00 0A 00 00 80 // 10% 191 * 26 02 03 9A 81 E2 00 FF 04 91 00 0D 0F // takeoff 92 00 12 12 // cruise 93 00 10 14 // circuit 94 00 15 16 // land 95 00 // on the ground 192 * 26 02 03 9B 81 E2 00 FF 04 92 00 0D 0F // takeoff 93 00 12 12 // cruise 94 00 10 14 // circuit 94 00 15 16 // land 96 00 // on the ground 193 * 17 02 03 9B 85 BC 00 FF FF 01 9B 00 00 00 00 00 9A 00 // empty cargo? 194 * 14 02 03 95 81 47 10 01 01 9A 00 01 01 9B 00 // pax fit? 195 * 14 02 03 9A 81 1A 00 01 01 95 00 00 00 95 00 // set 1C to 0 196 * 23 02 03 01 81 7D 01 20 FF \2u/ 1A 20 02 \2s 1A 00 01 01 9A 00 00 00 9A 00 // planespeed 1 - halve the running cost stored in 7D 01 and resave 197 * 23 02 03 05 81 7D 01 20 FF \2- 1C 20 FF \2s 1A 00 01 01 9A 00 00 00 9A 00 198 * 19 02 03 02 81 7D 01 20 FF \2u/ 1A 00 05 01 05 00 00 00 05 00 // planespeed 2 - .8 running cost stored in 7D 01 and resave 199 * 19 02 03 03 81 7D 01 20 FF \2u/ 1A 00 0A 01 05 00 00 00 05 00 // planespeed 3 - .9 running cost stored in 7D 01 and resave 200 * 23 02 03 9A 81 7F 03 00 FF 03 01 00 01 01 02 00 02 02 03 00 03 03 9A 00 // check the planespeed setting // End variable running costs ==========================================================================
NFO: Av8 vehicle hook
// RUNNING COSTS (subroutine 9A)============= 3715 * 11 02 03 21 81 7E 9A 00 FF 00 00 80 // gogo gadget subroutine // vv 3716 * 18 02 03 21 81 1A 20 \b33 \2s 1A 00 \b01 01 21 00 00 00 21 00 // store the running cost in reg 01 3717 * 14 02 03 21 81 10 00 FF 01 21 00 0E 0E 08 00 3718 * 14 02 03 08 81 0C 00 FF 01 21 00 36 36 08 00 // cb36