Cargo weight revamping

A private forum for those folks working on patches for RRT3.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

Yeah could do, but historically most of it was hauled in reefers in the US. Tankers were used in the UK, but they were tiny little things about the size of a go kart.

Anyway I just played around with the files a bit, and now have Toys debugged so it changes when it's supposed to. Have also figured out what I did wrong with the dodgy profile icons, so they're sorted too. So that's two cargoes (Tires and Toys) using boxcars but calling different files for them, and working without glitches.

Rubber is still stuck on the A era cars for some weird reason. Still have no idea why, but I figure if Tires and Toys work there's no reason why Rubber shouldn't, so it must be something really dumb that I'm still missing. Should be able to get it sooner or later. *!*!*!
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

:mrgreen: Just took a look at the rubber files while on my lunch break, and found something really dumb that I'd missed. Will fix it tonight and give it a test run. Back to planting trees now. (0!!0)
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

I was knackered last night after all that digging, so watched a movie instead. I did do a bit more basic setting up of a pile of files though, and also managed to learn something new about the file structure.

I should have noticed this before, but bytes 252-255 inclusive are only relevant if you are calling the profile icon from one of the CarSideView files. I won't be doing that for the revamped cargoes anyway, so can just set those bytes to all zeroes to make the files less confusing. Same goes for any custom locomotives, including the default 1.06 locos.
ID_for_CarSideView.png
I've also come up with an easy system for doing the custom ID's for the actual cars, which are bytes 8-11 inclusive. Since these have to be in hex anyway, and since the scale goes up to a very large number anyway (at least 65,536 even if only two bytes are used) after thinking on it some more I figured it would be most sensible to make the hex easy and not worry about the decimal values. Again, this same idea can also be used to give unique ID's to custom locos.
ID_for_actual_car.png
The scale is going to be done like this, which will provide space for up to 16 eras for each car if anyone ever wants to go that nuts. The handy thing about it is that with up to 9 eras the ID's are really easy on the brain, since they just use standard decimal increments on the first byte. So the first era will always be *0, and if there are 7 eras for that cargo the last will always be *6, with the second byte ranging from 01 to 03 depending on the alphabetical order of the cargo.

Code: Select all

    Cargo name          .car ID     Hex (A era to last era)     .cct ID     Base price (.cty)
-------------------------------------------------------------------------------------------------------

    Alcohol             160 - 166   A0 00 00 00 - A6 00 00 00   12          $100k (00 50 C3 47)
    Aluminum            176 - 179   B0 00 00 00 - B3 00 00 00    4          $ 85k (00 04 A6 47)
    Ammunition          192 - 197   C0 00 00 00 - C5 00 00 00   11          $160k (00 40 1C 48)
    Automobiles         208 - 211   D0 00 00 00 - D3 00 00 00   13          $200k (00 50 43 48)
    Bauxite             224 - 227   E0 00 00 00 - E3 00 00 00   14          $ 30k (00 60 EA 46)

    Caboose             240 - 246   F0 00 00 00 - F6 00 00 00   N/A         N/A
    Ceramics (1.06)     256 - 262   00 01 00 00 - 06 01 00 00   11 ?        $ 40k (00 40 1C 47)
    Cheese              272 - 276   10 01 00 00 - 14 01 00 00   12          $235k (00 7E 65 48)
    Chemicals           288 - 291   20 01 00 00 - 23 01 00 00    3          $ 30k (00 60 EA 46)
    Clothing            304 - 310   30 01 00 00 - 36 01 00 00   11          $ 95k (00 8C B9 47)
    Coal                320 - 326   40 01 00 00 - 46 01 00 00   14          $ 30k (00 60 EA 46)
    Coffee              336 - 342   50 01 00 00 - 56 01 00 00   11          $ 45k (00 C8 2F 47)
    Concrete (1.06)     352 - 357   60 01 00 00 - 65 01 00 00   15          $100k (00 50 C3 47)
    Corn                368 - 374   70 01 00 00 - 76 01 00 00   15          $ 25k (00 50 C3 46)
    Cotton              384 - 390   80 01 00 00 - 86 01 00 00   11          $ 30k (00 60 EA 46)
    Crystals (1.06)     400 - 406   90 01 00 00 - 96 01 00 00   14          $ 50k (00 50 43 47)

    Diesel              416 - 419   A0 01 00 00 - A3 01 00 00    3          $100k (00 50 C3 47)
    Dye (1.06)          432 - 438   B0 01 00 00 - B6 01 00 00    3          $ 30k (00 60 EA 46)

    Electronics (1.06)  448 - 451   C0 01 00 00 - C3 01 00 00   11          $230k (00 9C 60 48)

    Fertilizer          464 - 467   D0 01 00 00 - D3 01 00 00    3          $ 80k (00 40 9C 47)
    Furniture           480 - 484   E0 01 00 00 - E4 01 00 00   11          $220k (00 D8 56 48)

    Goods               496 - 502   F0 01 00 00 - F6 01 00 00   11          $170k (00 04 26 48)
    Grain               512 - 518   00 02 00 00 - 06 02 00 00   15          $ 30k (00 60 EA 46)

    Ingots (1.06)       528 - 534   10 02 00 00 - 16 02 00 00   11          $100k (00 50 C3 47)
    Iron                544 - 550   20 02 00 00 - 26 02 00 00   14          $ 30k (00 60 EA 46)

    Livestock           560 - 566   30 02 00 00 - 36 02 00 00   16          $ 90k (00 C8 AF 47)
    Logs                576 - 582   40 02 00 00 - 46 02 00 00    4          $ 30k (00 60 EA 46)
    Lumber              592 - 598   50 02 00 00 - 56 02 00 00    4          $ 85k (00 04 A6 47)

    Machinery (1.06)    608 - 614   60 02 00 00 - 66 02 00 00   11          $200k (00 50 43 48)
    Mail                624 - 630   70 02 00 00 - 76 02 00 00   10          $ 80k (00 40 9C 47)
    Meat                640 - 646   80 02 00 00 - 86 02 00 00   12          $195k (00 6E 3E 48)
    Medicine (1.06)     656 - 659   90 02 00 00 - 93 02 00 00   12          $150k (00 7C 12 48)
    Milk                672 - 678   A0 02 00 00 - A6 02 00 00   12          $110k (00 D8 D6 47)

    Oil                 688 - 692   B0 02 00 00 - B4 02 00 00    3          $ 40k (00 40 1C 47)
    Ore (1.06)          704 - 710   C0 02 00 00 - C6 02 00 00   14          $ 45k (00 C8 2F 47)

    Paper               720 - 726   D0 02 00 00 - D6 02 00 00   11          $ 85k (00 04 A6 47)
    Passengers          736 - 742   E0 02 00 00 - E6 02 00 00    8          $ 85k (00 04 A6 47)
    Plastic             752 - 753   F0 02 00 00 - F1 02 00 00   15          $ 85k (00 04 A6 47)
    Produce             768 - 774   00 03 00 00 - 06 03 00 00   12          $ 45k (00 C8 2F 47)
    Pulpwood            784 - 790   10 03 00 00 - 16 03 00 00    4          $ 30k (00 60 EA 46)

    Rice                800 - 806   20 03 00 00 - 26 03 00 00   15          $ 30k (00 60 EA 46)
    Rock (1.06)         816 - 822   30 03 00 00 - 36 03 00 00   14          $ 20k (00 40 9C 46)
    Rubber              832 - 835   40 03 00 00 - 43 03 00 00   11          $ 30k (00 60 EA 46)

    Steel               848 - 853   50 03 00 00 - 55 03 00 00    4          $ 85k (00 04 A6 47)
    Sugar               864 - 870   60 03 00 00 - 66 03 00 00   15          $ 35k (00 B8 08 47)

    Tires               880 - 883   70 03 00 00 - 73 03 00 00   11          $ 85k (00 04 A6 47)
    Toys                896 - 900   80 03 00 00 - 84 03 00 00   11          $175k (00 E6 2A 48)
    Troops              912 - 918   90 03 00 00 - 96 03 00 00    9          $ 50k (00 50 43 47)

    Uranium             928 - 929   A0 03 00 00 - A1 03 00 00    4          $200k (00 50 43 48)

    Waste               944         B0 03 00 00                 15          $ 40k (00 40 1C 47)
    Weapons             960 - 965   C0 03 00 00 - C5 03 00 00    4          $235k (00 7E 65 48)
    Wool                976 - 982   D0 03 00 00 - D6 03 00 00   11          $ 30k (00 60 EA 46)
This is probably very boring for anyone who won't be playing with RT3 coding, but I like having clear and consistent consistent standards for stuff I'm working on. Ir's just less strain on the brain overall. !*th_up*!
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

Apologies for the lack of progress on this. Other things have been taking up my time. However a documentary last night, on the evolution of the railway system in the UK, got me all enthusiastic about trains again so I'm thinking I should do another coding binge.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

Ok, so I dragged this out again and had another crack at those rubber cars. Still no joy. No idea what is wrong with them. I've double and triple checked everything I can think of, and they're still stuck on the A era model.

At this stage I think the only thing to do is push on with some more cargoes and see what happens.

RT3 coding. Meh. :roll: *!*!*!
User avatar
RulerofRails
CEO
Posts: 2063
Joined: Sun Dec 08, 2013 1:26 am

Re: Cargo weight revamping: express/freight differences Unread post

Not understanding the coding the way you do, but wondering if there is some way past the problem. Are you trying to use previously un-used .cct "numbers"? Could it be that some numbers will work and others will not? Can I help with testing that? The numbers that Poptop decided to use seem almost a bit random if you ask me.

Not quite sure if I follow this:
Gumboots wrote:I can keep using this system and just assign cargoes to whatever generic car I like, and change weights and dates to suit myself (including adding in extra eras). That will work just fine. The catch is that it requires all cargoes assigned to a specific generic car to share the same weights and start/stop dates, since those are controlled by the .car file for that generic car.
I took a very quick look at some box cars in TM and they seem to use different start/stop dates as well as different weights. What I see is multiple .car files with differing stats all for the same generic car number. I haven't checked how this is handled in-game, so can't say it works without a hitch.

PS. If you aren't already using it, the 1.06 cheat code to time-travel helps a lot when testing these type of changes with time.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

RulerofRails wrote:Not understanding the coding the way you do, but wondering if there is some way past the problem.
I've been wondering that myself. ^**lylgh

Are you trying to use previously un-used .cct "numbers"? Could it be that some numbers will work and others will not? Can I help with testing that? The numbers that Poptop decided to use seem almost a bit random if you ask me.
I have a suspicion that the .cct numbers are something else that is deprecated in the RT3 coding. For example, I tried changing the number for the rubber cars from 11 to 46 and back to 11. AFAICT it made no difference at all. So originally I thought each car would need its own individual number, but I'm now thinking it doesn't matter.

Not quite sure if I follow this:
Gumboots wrote:I can keep using this system and just assign cargoes to whatever generic car I like, and change weights and dates to suit myself (including adding in extra eras). That will work just fine. The catch is that it requires all cargoes assigned to a specific generic car to share the same weights and start/stop dates, since those are controlled by the .car file for that generic car.
I took a very quick look at some box cars in TM and they seem to use different start/stop dates as well as different weights. What I see is multiple .car files with differing stats all for the same generic car number. I haven't checked how this is handled in-game, so can't say it works without a hitch.
Yep I'm now thinking I was wrong in that quote. The thing about RT3 coding is that it doesn't always seem to behave consistently.

To give an example, when I was playing with locomotive and cargo car modelling I noticed that the coding for trucks can do wild things. If you attach them at the origin (0,0,0) they always behave, but the trucks for some default locos are attached at the centre of the truck (which is way off the origin for the model as a whole). They behave just fine. However, sometimes if I tried to attach a truck somewhere (ie: not at the origin) it'd shunt the location of the truck's mesh way out. There's no obvious reason why it behaves in some cases but not in others.

So this rubber car business is like that. I've gone over the files umpteen times. There is no obvious reason why the rubber cars don't work properly while the tires and toys cargoes (which also call box cars) do work. It's bizarre. Anyway, if you want to take a look at things I'll bundle them up for you. More eyes on the code can't hurt. I'll also take a look at the insides of TM's cargo cars, now that you've pointed those out.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

Oh and I should probably start thinking how much I can simplify the whole system, given the amount of tedious coding and testing it all requires.

Really all I want is:

1/ Better separation between express and freight (which is already done)

2/ Lighter car weights for the faster rotting cargoes

3/ Preferably (although not essential) some staggering of freight weight changes, so you'd get at least some of them changing during a standard scenario length.

That last one effectively means some changing every 10 to 15 years. Or roughly, two groups of freight, with each group changing every 25 years, and the two groups staggered by a decade or so. Which is what I was going for anyway, but there may be a simpler way of getting it.
User avatar
RulerofRails
CEO
Posts: 2063
Joined: Sun Dec 08, 2013 1:26 am

Re: Cargo weight revamping: express/freight differences Unread post

Sure, post up the Rubber files. I'll definitely give them a look.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

Haven't given up on this. Just got sidetracked into that Garratt (needed to do something fun).

Anyway had some more thoughts. What I'm wondering now is how much weight difference is needed between express and freight to make express workable without making express locos the best freight locos. Default RT3 cars have express at 2/3 the weight of freight, and we know that's not enough. OTOH going to 1/6 for the heavier freights and 1/3 for the lightest freights, which is what I did with this scale when working it out, may be more than is needed.

The thing about taking the ratio higher than needed is that it'll tend to preclude hauling any freight at all with an express loco, and sometimes you might want to haul one or two cars. Express locos did this in real life for fast-rotting and high-priced cargoes (milk, etc). So now I'm thinking maybe I should wind things back a bit. It might be workable with express being 1/4 the weight of heavy freights and 1/2 the weight of the lightest.

So taking the basic 7 eras from 1830 onwards, it could start with 1 ton express, 2 ton milk, and 4 ton iron/grain/whatever. Car weights are done as floats so it should handle fractions of a ton. If it will, we could just have a 50% increase in car weights with each change of era, instead of the default's 100% half as often.

That would make the last era have 45.6 ton heavy freights and 22.8 ton lightest freights, which is workable for fuel and reliability, and 11.4 ton express cars. Might be worth trying.
User avatar
RulerofRails
CEO
Posts: 2063
Joined: Sun Dec 08, 2013 1:26 am

Re: Cargo weight revamping: express/freight differences Unread post

Don't have time to get right into it today, but it might work. IIRC, I checked and the game can handle decimals for car weights.

Things to check might be:
Does the pulling power that will enable express the ability to climb make it a decent hauler for mixed freight on the flat runs?
How does this work into the Fuel cost settings compared to mixed engines? Do we have room in the scale to make mixed engines reliably cheaper to run?

Other thing is that I think that reducing the step will mean that the split between the classes only becomes significant later in the game. Made-up figures, but an example: 1890 instead of 1860.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

RulerofRails wrote:Don't have time to get right into it today, but it might work. IIRC, I checked and the game can handle decimals for car weights.

Things to check might be:
Does the pulling power that will enable express the ability to climb make it a decent hauler for mixed freight on the flat runs?
Probably yes for hauling power, but OTOH the higher fuel cost would make it less economic to run, since the express loco would be tuned to have a reasonable fuel cost with the lighter express consist. So on balance a freight loco should still be a better bet for freight.
How does this work into the Fuel cost settings compared to mixed engines? Do we have room in the scale to make mixed engines reliably cheaper to run?
Not sure, but possibly. What I'm thinking is that the basic integer scale can be fine tuned via locomotive weight. So in effect we can have fractional fuel ratings by cunning use of loco weight. In fact I think that is the only reasonable and practical use of the loco weight setting. There's no useful other reason for having it.
Other thing is that I think that reducing the step will mean that the split between the classes only becomes significant later in the game. Made-up figures, but an example: 1890 instead of 1860.
Yup, quite likely. Not sure yet.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

I'm thinking I should revise my approach to this so that we can actually get something going for testing. I have limited time available for coding, and even less enthusiasm for pigging around in hex editors with cargoes that don't want to behave. Really all I want to do is make nifty locomotives, and have a solid basis for assigning stats and using them in the game.

So with that in mind, I think I should run fairly quick tests to see which cargoes will behave with custom cars and which ones won't. Any that won't can be left in default cars. I should also have a serious think about how many types of custom cars are actually required, and attempt to minimise those. It should still be possible to end up with something better than default, without driving myself mental and taking forever.

Did think of something while idly pondering this stuff. If mixed traffic and freight locos are set to haul heavier loads cheaper, and then will run even cheaper again with lighter loads, it's probably not really going to make sense to haul mail with express locos unless pax and troops are in short supply. It'll probably be better to use a mixed or freight loco to haul mail, with the cheaper haulage cost balancing out the higher loss to rot time. Come to think of it, this may even apply to troops. The only cargo that benefits from pax appeal is pax, and since cargoes are loaded before pax appeal is taken into account (ie: loaded according to base price) then using an "any express" consist is likely to result in lower overall profit.

This is where the game really, really, needs a "haul anything but" option. The lack of that is a major bummer for strategy. The other possibility, if it can be done, would be to jig around with settings for troops and mail and see if there's any way those can be made to take pax appeal into account. If the pax appeal boost could be applied uniformly to all express cargoes, then suddenly all express consists would make more sense.

Has anyone ever found where in the game files the pax appeal stuff is applied to pax revenue?
User avatar
RulerofRails
CEO
Posts: 2063
Joined: Sun Dec 08, 2013 1:26 am

Re: Cargo weight revamping: express/freight differences Unread post

Good to see that you are also aware about the possibility for freight/mixed class hauling express at low cost. I was thinking similarly when I was graphing the "Mixed class hauling Express cars" in the Fuel Cost Progression thread. :-)

I don't remember either of us doing a specific test on how Mail or Troops behave like we did with Passengers. Probably the Passenger Appeal Rating application is coded in the exe file. When I get a couple spare hours I will at least jig with their rot values and prices to see if those are responsive.

I think that the normal player will leave his trains at the "Any Express" or any "Any Freight" settings. This is good for our plans as far as I for-see.

I think Mail and Troops will be good to fill Express trains because it's not common to have 7 or 8 cars of Passengers available. But, if you are tight enough for revenue to notice that your Express trains aren't able to handle all the express available so are skipping some Passenger pickups, setup your Mixed/Freights to take a load or two of Mail by using a custom consist. (1x Mail, 7x Any Freight). This works perfectly in 1.06 too because even with ship-at-a-loss capability it's still impossible to pick-up express that isn't profitable. Troops aren't really a big factor except on a few maps, and wouldn't hurt to be managed similarly if needed.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

Rot times and base prices won't have anything to do with pax appeal. I've looked through the whole .exe and can't find anything about pax appeal, although obviously it has to be in there somewhere (probably in the obfuscated sections).

What will have to happen is that the cheaper fuel cost of freight locos hauling express will have to be offset by the reduced passenger appeal, so that the freight locos still make less net profit from express. So for example, if the fuel cost of a freight loco hauling express is $50k/year less than the fuel cost of an express loco hauling express, than the passenger appeal of the express loco would have to result in an average of at least $50k more than the freight loco. Probably more like $70k or $80k to keep things in line.

I had a thought while searching through the file. It's probably possible to fix the graphics degradation with each game map save. It's obviously a lossy algorithm of the type that is used by .jpg. I found a lot of references to .jpg in the .exe, and offhand I can't think of anywhere the game uses .jpg. All skins are .dds and all screenshots are .tga, and the game map imports are .bmp. So, why does the .exe need a pile of code to deal with jpg?

Another point is the limit of skins to 1024x1024. It's probably possible to increase that limit.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

Come to think of it, whatever we do it can't be worse than the default setup anyway, because at the moment all the so-called express locos are already useless. So even a non-perfect solution should be better than useless. (0!!0)
User avatar
Wolverine@MSU
CEO
Posts: 1166
Joined: Fri Nov 10, 2006 2:14 pm
Location: East Lansing, MI

Re: Cargo weight revamping: express/freight differences Unread post

Gumboots wrote:So even a non-perfect solution should be better than useless. (0!!0)
Sounds like what some Democrats are saying ^**lylgh

(I know that statement is probably in violation of Forum rules, but I couldn't let the opportunity pass)
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

Moving right along... :mrgreen:

Had an idea. Maybe I should get really lazy and just use the existing WP&P custom car files for testing. I know those all work. :-P

This should give enough scope for trying out the general plan here (lighter express, and variable freight weights, with extra eras) while keeping the amount of work required to the minimum. They'd need some minor editing, but that's not a big deal. If the concept turns out to be a really good one, extra shenanigans can be added later.

WP&P's existing range includes separate cars for bauxite, corn, furniture, grain, coal, produce, goods, pulpwood and troops. The rest just run on default RT3 cars, but introducing extra eras for those shouldn't be hard (would just use existing models and skins) and editing the weights is easy.

If I go with this method, I should be able to knock it all over this month with minimal stress. That means we can actually start using it. (0!!0)

(I want to be able to actually use it, because not knowing what stats they'll need is a bummer for loco modelling)
User avatar
RulerofRails
CEO
Posts: 2063
Joined: Sun Dec 08, 2013 1:26 am

Re: Cargo weight revamping: express/freight differences Unread post

Sounds good. For testing, the more corners we can cut irreproachably the better.
User avatar
Gumboots
CEO
Posts: 4817
Joined: Mon Aug 13, 2012 4:32 am
Location: Australia

Re: Cargo weight revamping: express/freight differences Unread post

By the way, for easy testing of extra eras, without going into extra modelling at this stage, I think something like this is the way to go. Might even simplify the text to "A-3", "B-5", "C-7", etc and make it a bit bigger. I can apply something simple like this to A and B skins for any car without it being too much work. Probably wouldn't have to worry about the lower level skins, since a quick zoom would tell you what era you were in anyway.
Livestock_cars_test.jpg
Post Reply