Australian AuzTrains and NSWTrains

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
JohnFranklin523
Traffic Manager
Traffic Manager
Posts: 173
Joined: 15 Mar 2022 13:01
Location: Shandong, China (may go to UK for further study)
Contact:

Re: Australian AuzTrains and NSWTrains

Post by JohnFranklin523 »

GarryG wrote: 13 Dec 2023 05:58
The running cost factor of YZ25G should be explained.
Does this increase the cost to run this vehicle?
Depends. As the formula shows, this vehicle at full speed, without a restaurant car costs more than stationary, with a restaurant car. The "average cost" might be about 4 times the cost basis. However, it would be balanced when lowering the running cost base by 2 (that is, quartering all the running costs of trains and wagons). I don't use any divisions or fractions in running_cost_factor sections to "reduce" costs because NML cannot handle those. Only addition and multiplication are safe.
Leaping Liu Never Dies
跨越不死,曙光永生
The founder of China Set; the operator of JFServer.
My GRFs besides China Set
My Scenarios and Heightmaps
User avatar
JohnFranklin523
Traffic Manager
Traffic Manager
Posts: 173
Joined: 15 Mar 2022 13:01
Location: Shandong, China (may go to UK for further study)
Contact:

Re: Australian AuzTrains and NSWTrains

Post by JohnFranklin523 »

Hi Garry,

I have made some readable comments for my "functions" part of codes for you.

First of all, "Bitmask Sheet" for all these functions:

Code: Select all

/*

BITMASK SHEET
The sheet was defined by John Franklin.

bitmask(0): reserved
bitmask(1): restaurant car
bitmask(2): air conditioner
bitmask(3): conductor car
bitmask(4): brake van

For example, 
bitmask_vehicle_info:           bitmask(1, 3);
May be used for a restaurant + conductor combined car.

*/

// Electric Engines MUST BE ELECTRIFIED to supply electricity
switch (FEAT_TRAINS, SELF, airconditioner, vehicle_is_powered) {
    1: return bitmask(2);
    return 0;
}
Next, "Running Cost Factor":

Code: Select all

// Running cost factor depending on speed (NOTICE: NML only recognises m/s in these switch blocks)

// Max Speed < 75 km/h (Slow early trains)
switch (FEAT_TRAINS, SELF, runningcost60, current_speed) {
  0: return 1;      // Stationary,  basis * 1
  1..3: return 2;   // < 10 km/h,   basis * 2
  4..6: return 3;   // 10-20 km/h,  basis * 3
  7..10: return 4;  // 20-40 km/h,  basis * 4
  return 5;         // > 40 km/h,   basis * 5
}

// Max Speed 75-110 km/h (Not so slow, but still not fast)
switch (FEAT_TRAINS, SELF, runningcost80, current_speed) {
  0: return 1;      // Stationary,  basis * 1
  1..5: return 2;   // < 20 km/h,   basis * 2
  6..12: return 3;  // 20-45 km/h,  basis * 3
  13..20: return 4; // 45-75 km/h,  basis * 4
  return 5;         // > 75 km/h,   basis * 5
}

// Max Speed 110-145 km/h (Regularly fast in Australia)
switch (FEAT_TRAINS, SELF, runningcost120, current_speed) {
  0: return 1;      // Stationary,  basis * 1
  1..8: return 2;   // < 30 km/h,   basis * 2
  9..19: return 3;  // 30-70 km/h,  basis * 3
  20..30: return 4; // 70-110 km/h, basis * 4
  return 5;         // > 110 km/h,  basis * 5
}

// Max Speed 145-180 km/h (Very fast in Australia)
switch (FEAT_TRAINS, SELF, runningcost160, current_speed) {
  0: return 1;      // Stationary,  basis * 1
  1..12: return 2;  // < 45 km/h,   basis * 2
  13..26: return 3; // 45-95 km/h,  basis * 3
  27..40: return 4; // 95-145 km/h, basis * 4
  return 5;         // > 145 km/h,  basis * 5
}

// Max Speed 180-220 km/h (Fastest trains in Australia)
switch (FEAT_TRAINS, SELF, runningcost200, current_speed) {
  0: return 1;      // Stationary,  basis * 1
  1..15: return 2;  // < 55 km/h,   basis * 2
  16..32: return 3; // 55-115 km/h, basis * 3
  33..50: return 4; //115-180 km/h, basis * 4
  return 5;         // > 180 km/h,  basis * 5
}

// Max Speed > 220 km/h (Currently non-existent in Australia)
switch (FEAT_TRAINS, SELF, runningcost250, current_speed) {
  0: return 1;      // Stationary,  basis * 1
  1..18: return 2;  // < 65 km/h,   basis * 2
  19..39: return 3; // 65-140 km/h, basis * 3
  40..60: return 4; //140-220 km/h, basis * 4
  return 5;         // > 220 km/h,  basis * 5
}

// Now using the composed function to call different functions depending on the maximum speed of a specific train
switch (FEAT_TRAINS, SELF, runningcostfactor, max_speed) {
  0..20: runningcost60;                   // < 75 km/h
  21..30: runningcost80;          	      // 75-110 km/h
  31..40: runningcost120; 		       	    // 110-145 km/h
  41..50: runningcost160;                 // 145-180 km/h
  51..60: runningcost200;                 // 180-220 km/h
  runningcost250;                         // > 220 km/h (currently non-existent in Australia)
}

// Another running cost factor depending on the existence of restaurant car, which halves the runing costs of passenger cars.
switch (FEAT_TRAINS, PARENT, cafecostfactor, hasbit(bitmask_consist_info, 1)) {
    1: return 1;
    return 2;
}

// Running cost factor of AC Generator Cars (and also locomotives able to supply electricity for cars) varies according to the number of cars with need of air condition (including some passenger cars and a few refrigerator wagons)
// The costs are not coded into AC Generator Cars, but into cars with need of AC.
switch (FEAT_TRAINS, PARENT, accostfactor, hasbit(bitmask_consist_info, 2)) {
    1: return 2;
    return 0;
}
Then, "Cargo Age Period":

Code: Select all

// Cargo age period factor depending on Restaurant Car: attaching restaurant car increases cargo age period of medium and long range passenger cars (i.e. not commuter cars) by 1/4
switch (FEAT_TRAINS, PARENT, cafedecayfactor, hasbit(bitmask_consist_info, 1)) {
    1: return 5;
    return 4;
}

// Cargo age period factor depending on Air Conditioner: (SUIT THE CONDITION IN AUSTRALIA) using air conditioner increases cargo age period of passenger cars by 1/4
switch (FEAT_TRAINS, PARENT, acdecayfactor, hasbit(bitmask_consist_info, 2)) {
    1: return 5;
    return 4;
}
And an example for you to understand:

Code: Select all

/*

For example:

graphics {
  running_cost_factor: 6 * runningcostfactor() * cafecostfactor() + accostfactor();
                       ^   ^^^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^^     ^^^^^^^^^^^^
                     basis   current speed       restaurant car     air condition
  
  purchase_running_cost_factor: 20 * 4;

  bitmask_vehicle_info: bitmask(2);
                        ^^^^^^^^^^
                      air conditioner

  cargo_age_period: 10 * cafedecayfactor() * acdecayfactor() << param_cargo_decay;
                    ^^   ^^^^^^^^^^^^^^^     ^^^^^^^^^^^^^      ^^^^^^^^^^^^^^^^^
                  basis   restaurant car     air condition    parameters, see below
}

Can simulate a 2nd-class passenger coach.

NOTICE: THESE CAN ONLY BE CODED INTO graphics{} BLOCKS SINCE ONLY IN THIS TYPE OF BLOCKS CAN NML HANDLE SWITCH BLOCKS.
        IF CODED INTO property{} BLOCKS, NML WILL REPORT ERROR AND FAIL.
        
        For running_cost_factor line, it is advised to add "purchase_running_cost_factor" line and type a value of (basis * 4), since the average running cost factor is estimated to be four times basis.

        For electric engines and EMUs, it is better to use the aforementioned "airconditioner" to simulate electric engines MUST BE ELECTRIFIED to supply electricity, unless there is a big battery inside.

        For cargo_age_period line, 10 is a good basis for an 2nd coach. 3rd could be 8, 1st could be 12-15, and sleepers could be 20.
        "param_cargo_decay" is a new parameter to double or quadruple cargo_age_period to better play on large maps. Default is 0, which just does nothing. 1 means double, and 2 means quadruple.
        In fact, given some small positive integers M and N, "M << N" generally means "M times 2 to the power N" (M * 2^N), given that the result is less than 65535.
        
        When the basis is set to 10 (2nd coach), the cargo_age_period would be 160 without air conditioner and restaurant, 200 with either air conditioner or restaurant, and 250 with both.
        Comparison: the default cargo_age_period value for all vehicles is 185.
        And uncomfortable 3rd coach would be 128, 160, 200, accordingly.
        Luxury 1st coach, if basis set to 12, would be 192, 240, 288, accordingly.
        Sleepers would be 320, 400, 500, accordingly, which could be rather comfort.
        These values could be doubled or quadrupled by the new parameter.

*/
Attachments
functions.pnml
The function file modified for AuzTrains.
(6.95 KiB) Downloaded 114 times
Leaping Liu Never Dies
跨越不死,曙光永生
The founder of China Set; the operator of JFServer.
My GRFs besides China Set
My Scenarios and Heightmaps
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

JohnFranklin523 wrote: 13 Dec 2023 09:09 I have made some readable comments for my "functions" part of codes for you.
Thank you kindly shall give them a try tomorrow.

Cheers
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

JohnFranklin523 wrote: 13 Dec 2023 09:09 I have made some readable comments for my "functions" part of codes for you.
I did a practice with the ABS Dining car from the AuzTrainsNSWGR set as there is less vehicles in this set so could be a good testing ground.

And all seems to work. :D

Code: Select all

item (FEAT_TRAINS, item_coach_ABS) {
  property {
    name: string(STR_NAME_coach_ABS);
    climates_available: bitmask(CLIMATE_TEMPERATE, CLIMATE_ARCTIC, CLIMATE_TROPICAL, CLIMATE_TOYLAND);
    introduction_date: date(1949,9,1);
    model_life: VEHICLE_NEVER_EXPIRES;
    vehicle_life: 50;
    reliability_decay: 10;
    cost_factor: 5;
    length: 8;
    power: int (0 * 0.9865);
    weight: 41 ton;
    speed: 105 km/h;
    sprite_id: SPRITE_ID_NEW_TRAIN;
    misc_flags: bitmask(TRAIN_FLAG_2CC, TRAIN_FLAG_MU, TRAIN_FLAG_AUTOREFIT);
 
    running_cost_base: RUNNING_COST_ROADVEH;
    bitmask_vehicle_info: 0;
    cargo_allow_refit: [PASS, TOUR];
    default_cargo_type: PASS;
    cargo_capacity: 20;
    loading_speed:                  6 << param_loading_speed;
    cargo_age_period:               370 << param_cargo_decay;

  }
  graphics {
    default: coach_ABS_sprites;
    purchase: coach_ABS_cc_v1_purchase_sprites;
   // running_cost_factor: coach_ABS_running_cost_factor;
    articulated_part: articulated_part_dummy7;
    cargo_age_period:               (20 * acdecayfactor() * cafedecayfactor()) << param_cargo_decay;
    cost_factor:                    13;
    running_cost_factor:            11 * runningcostfactor() * cafecostfactor() + accostfactor();
    purchase_running_cost_factor:   44;
    purchase_cargo_capacity:        66/3;
 
  }
}

if (enable_long_names) { item (FEAT_TRAINS, coach_ABS) { property { name: string(STR_LONGNAME_coach_ABS); } } }
In your
BITMASK SHEET
The sheet was defined by John Franklin.

bitmask(0): reserved
bitmask(1): restaurant car
bitmask(2): air conditioner
bitmask(3): conductor car
bitmask(4): brake van

You have those above.

How would I go about changing them to:
bitmask(0): Sleeper
bitmask(1): restaurant car
bitmask(2): First Class
bitmask(3): Composite (half carriage has 1st class and other half has 2nd class)
bitmask(4): brake van (carriages has a small guards compartment at one end for parcels and luggage)

Cheers pal
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
JohnFranklin523
Traffic Manager
Traffic Manager
Posts: 173
Joined: 15 Mar 2022 13:01
Location: Shandong, China (may go to UK for further study)
Contact:

Re: Australian AuzTrains and NSWTrains

Post by JohnFranklin523 »

GarryG wrote: 13 Dec 2023 22:00 How would I go about changing them to:
bitmask(0): Sleeper
bitmask(1): restaurant car
bitmask(2): First Class
bitmask(3): Composite (half carriage has 1st class and other half has 2nd class)
bitmask(4): brake van (carriages has a small guards compartment at one end for parcels and luggage)
Bitmask is not used this way. I assign every function (restaurant, air conditioner, ...) to a bitmask since these functions cannot be understood by OpenTTD directly. By assigning a unique bitmask and checking the bitmask of a whole vehicle, OpenTTD can simulate these functions.

Bitmask is not somehow "category" since OpenTTD cannot recognise any such category stuff. Its mechanics are "if any part of a train has some bitmask on a certain bit (that is, "x" in bitmask(x)), then the train may have some function according to the bit where the bitmask is located."
Leaping Liu Never Dies
跨越不死,曙光永生
The founder of China Set; the operator of JFServer.
My GRFs besides China Set
My Scenarios and Heightmaps
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

Been experimenting with the codes in the Chinese Set and copying some over in to my AuzTrainsNSWGR set.

KD25G (25m Improved Air Conditioner Generator Car) .. I copied some of info from this to my PHS Power car.
XL25G (25m Improved Luggage Car) .. copy to my Baggage cars.
YW25T (25m Accelerated Hard Sleeper Passenger Coach) .. copied to the TAM and MAL sleeping cars.

Copied code associated with these commands:

Code: Select all

// Cargo
        loading_speed: 
        cargo_age_period:

// Stats
        running_cost_factor:

graphics {   
       cargo_age_period:  
        cost_factor:  
        running_cost_factor: 
        purchase_running_cost_factor: 
        purchase_cargo_capacity:
Had no trouble converting the nml to a grf. So looks like I on the right track. :D

Code: Select all

Looking in the .lng file from Chinese set and wonder about 2 lines.
STR_CAFE_EFFECT                     :{BLACK}Cafe Effect: {GOLD}Attaching Restaurant Car Halves Running Costs of Non-Commuter Passenger Cars except Restaurant Cars, and Increases Cargo Age Period by 1/4
STR_AIR_CONDITIONER_EFFECT          :{BLACK}Air Conditioner Effect: {GOLD}Attaching Air Conditioner Generator Car Increases Cargo Age Period of Passenger Cars Hauled by Locomotives without Electricity Supply
Could not find how these are used. Could make buying a trains interesting. Air-conditioned carriages must have a PHS (power car) in the consist. And the affect if include a buffet or dining/cafeteria car.

Shall continue fiddling with it and see what happens.

Cheers pal
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
JohnFranklin523
Traffic Manager
Traffic Manager
Posts: 173
Joined: 15 Mar 2022 13:01
Location: Shandong, China (may go to UK for further study)
Contact:

Re: Australian AuzTrains and NSWTrains

Post by JohnFranklin523 »

GarryG wrote: 14 Dec 2023 06:28

Code: Select all

Looking in the .lng file from Chinese set and wonder about 2 lines.
STR_CAFE_EFFECT                     :{BLACK}Cafe Effect: {GOLD}Attaching Restaurant Car Halves Running Costs of Non-Commuter Passenger Cars except Restaurant Cars, and Increases Cargo Age Period by 1/4
STR_AIR_CONDITIONER_EFFECT          :{BLACK}Air Conditioner Effect: {GOLD}Attaching Air Conditioner Generator Car Increases Cargo Age Period of Passenger Cars Hauled by Locomotives without Electricity Supply
Could not find how these are used. Could make buying a trains interesting. Air-conditioned carriages must have a PHS (power car) in the consist. And the affect if include a buffet or dining/cafeteria car.
These strings are used in additional text. I think you have done some additional text before to describe your trains. And you can also use switch blocks in the "additional_text" part. For example, RZ25G in China Set:

Code: Select all

switch (FEAT_TRAINS, SELF, switch_rz25g_additional_text, param_cargo_decay) {
    1: return string(STR_DESC_2, string(STR_25G_LIVERY_AVAILABILITY), string(STR_DECAY_384_480));
    2: return string(STR_DESC_2, string(STR_25G_LIVERY_AVAILABILITY), string(STR_DECAY_768_960));
    return string(STR_DESC_2, string(STR_25G_LIVERY_AVAILABILITY), string(STR_DECAY_192_240));
}
And anywhere after the switch block:

Code: Select all

item (FEAT_TRAINS, rz25g) { // Vehicle ID already defined before, so no need to type Vehicle ID here
    property {
        ...
    }
    graphics {
        ...
        additional_text: switch_rz25g_additional_text;
    }
}
Leaping Liu Never Dies
跨越不死,曙光永生
The founder of China Set; the operator of JFServer.
My GRFs besides China Set
My Scenarios and Heightmaps
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

Found errors in my coding .. I didn't notice it before in the DOS window

Code: Select all

←[K←[93m nmlc warning: "AuzTrainsNSWGR.nml", line 5318: Block 'LLV_running_cost_
factor' is not referenced, ignoring.←[0m
←[K←[93m nmlc warning: "AuzTrainsNSWGR.nml", line 5317: Block 'LLV_running_cost_
factor0' is not referenced, ignoring.←[0m
←[K←[93m nmlc warning: "AuzTrainsNSWGR.nml", line 5316: Block 'LLV_running_cost_
factor1' is not referenced, ignoring.←[0m
←[K←[93m nmlc warning: "AuzTrainsNSWGR.nml", line 5315: Block 'LLV_running_cost_
factor2' is not referenced, ignoring.←[0m
←[K←[93m nmlc warning: "AuzTrainsNSWGR.nml", line 5314: Block 'LLV_running_cost_
service' is not referenced, ignoring.←[0m
←[K←[93m nmlc warning: "AuzTrainsNSWGR.nml", line 5314: Block 'LLV_running_cost_
stop' is not referenced, ignoring.←[0m
Getting this with all those I copied the codes to. My fault as pushing myself to try these ideas when getting tied. :oops:

I have a break from it for the day and try again tomorrow.

Cheers pal
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
JohnFranklin523
Traffic Manager
Traffic Manager
Posts: 173
Joined: 15 Mar 2022 13:01
Location: Shandong, China (may go to UK for further study)
Contact:

Re: Australian AuzTrains and NSWTrains

Post by JohnFranklin523 »

GarryG wrote: 14 Dec 2023 07:33
Getting this with all those I copied the codes to. My fault as pushing myself to try these ideas when getting tied. :oops:

I have a break from it for the day and try again tomorrow.
Hello. Could you send me the source file in PM? Maybe I can solve it.

Thank you. And after that, have a good rest. You have already learned and done so much.
Leaping Liu Never Dies
跨越不死,曙光永生
The founder of China Set; the operator of JFServer.
My GRFs besides China Set
My Scenarios and Heightmaps
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

Plans for the Train Sets.


Ragin1_ has done some more Victoria Railways EMUs so hope to code them in before the end of the year in to a set we are calling AuzTrainsVictoria.

Seeing a few new container trains. These containers carry grain.
Image of one of those trains.
Grain Trains.png
Grain Trains.png (570.88 KiB) Viewed 7888 times
[/url]
I seen images of grain trains with red containers and also white so plane to do all 3.
We also have a garbage train with containers full of garbage.
Garbage.png
Garbage.png (238.11 KiB) Viewed 7888 times
[/url]
These are my next project to add to AuzTrainsNSW

Still adding ideas provided by "JohnFranklin523"

Cheers
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

AuzTrainsNSW
Adding some Container Wagons

Made 3 container wagons for carrying Grain cargos and 3 for carrying Garbage, Waste, scrap metals.

In this image the top train has the Garbage, Waste and Scrap containers. In Australia they have a container train for garbage, so I also made a few others for scrap meta, recyclables and Waste.
The next 3 are different coloured containers that carry grain crops. What photos I have seen of these trains they either all white, all blue or all red. Not seen any mixed loads yet.
All these will also carry Goods for those who like to mixed the types of wagons on their trains.
Grain Trains.png
Grain Trains.png (22.78 KiB) Viewed 7594 times
Another idea I having and yet to code and see if it will work is container wagons that can hold 3 small containers or 1 large and 1 small.
The wagons on the left are the longer wagons for the extra container. The ones on the right are the normal wagons that carry 2 small or 1 large.
Got this idea watch container trains I seen which have a mixed load of different container wagon lengths.
Containers Wagons.png
Containers Wagons.png (4.09 KiB) Viewed 7594 times
Not sure when these will be available for upload. Probably not be till next year. As finding a few errors in other freight wagons I did in the past.

Some wagons I don't think is needed for instance the WH and WHX grain wagons and BD and BDX Open Wagons. The X indicates that the bogies can be changed for other railway gauges. They used to travel on N.S.W. standard gauge and also the Victorian broad gauge lines. So looking at removing the wagons with the X in the code.

Hope every one enjoys the coming of the New Year.

Cheers
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

AuzTrainsNSWV38
Subject: Alterations made to previous version.

Been working on the Auz Trains NSW set past few days. Previous post will show you some changes.

Changes made this morning:
* Added a Refrigerated Container set .. there are 12 different containers from 10 different Companies.
* The selected the different companies from containers I have see on trains here in Australia.
* When purchase it will randomly select a container.
* You can either accept the random containers or can choose what company you want by
* * Refit Train to carry a different cargo.
* * select the cargo you want.
* * Then choose what company you want.
* * The companies are: Lindsay, Linfox, MSC, Rand, F.C.L., Toll, SCF, AusTrans, Breeze, P&O Nedlloyd.
* * The is room to add a few more we find a company that operates in Australia that I have missed.
Refrigerated Containers.png
Refrigerated Containers.png (23.92 KiB) Viewed 7455 times
* Fixed graphics for the TLV and KLY Louvre Vans.
* Finally remembered to finish the JLY Louvre Van.
* Like to do something similar to what I did to the refrigerated containers.
** Instead of having the 3 Louvre Vans separately .. combine them into one so when purchase will randomly select the van and then if want all the same type go to refit and choose the wagon you want.
*** I like to do this with some other freight wagons as well, such as the all louvre vans, refrigerator vans, some grain and hopper wagons, liquid tankers.
*** In other words freight wagons that look the same when empty and loaded.
Lourved Vans.png
Lourved Vans.png (24.53 KiB) Viewed 7455 times
I have not made the longer wagons yet. :roll:

If you like to try what I did the past few days here the game file.

Comments appreciated.
Attachments
AuzTrainsNSWV38.grf
(9.27 MiB) Downloaded 86 times
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

Here what I did today in AuzTrainsNSW.
Testing a idea I have.
I removed the KLY, TLV and the JLY louvred Vans and combined them into just one set called "LouvreVansLarge".
In this set it randomly choose between TLV, HLV, KLY (3 different colours), JLY (3 different colours), and 2 from the SCT Trains PBSY with 1 door and PBGY 2 doors.
You can then decide if want a variety of vans or you can make up a train of just the one type.
Lourved Vans2.png
Lourved Vans2.png (23.81 KiB) Viewed 7323 times
Top image has the SCT vans and a SSR 45 class which I did today.
2nd row has TLVs and a candy colour 80 class that I did today.
3rd row has grey JLYs.. Can also choose blue and a reddish colours.
bottom row various types.

Big question is .. do I just add the Louvre Vans Large and delete the others.

OR

Still add the Louvre Vans Large and still keep the others.

My bed time so wish all a good night.

EDIT:

Added 3 more graphics for the C Class Diesel and for a extra 82 class.
Th C Class has 3 SSR company colours including the new Yellow colour.
Did not realize till today I had not coded in the 82 class with the yellow ends.
Loco Updates.png
Loco Updates.png (13.34 KiB) Viewed 7225 times
Also did not realize that the graphics for BDL and BDY are the same. So see if I can change one of them a wee bit.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3431
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Australian AuzTrains and NSWTrains

Post by Emperor Jake »

I think you should consider coding different liveries as variants. It's a much simpler way of allowing the player to choose between variations of the same or similar vehicles. It could be applied to both locomotive liveries and the freight vans.

I see you've already coded livery refits though, this is fine too and much better than it was before :)

It would look like this in the purchase menu (this is JP+ Engines)
Image

It's simple to code too, you just code them as separate vehicles and add a

Code: Select all

variant_group
property which contains the ID of the main vehicle in the group.

At the very least it could be applied to variants of the same vehicle such as the reversed Garratt or the dual-header 48 (which itself isn't necessary because you can just ctrl-flip locomotives) :wink:
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

Emperor Jake wrote: 04 Jan 2024 06:26 I think you should consider coding different liveries as variants. It's a much simpler way of allowing the player to choose between variations of the same or similar vehicles. It could be applied to both locomotive liveries and the freight vans.
Your idea looks a lot better then buying the item and having to go to refit to choose what you want.

This is the code for a 44 class loco which has 6 different vasriants. What will I need to change to do what your mentioned.

Code: Select all

/************************************
  44 Class Diesel Locomotives
*************************************/

/*
* PURCHASE
*/

spriteset(spriteset_diesel_44Class_purchase, "gfx/Diesel/44Class.png") {
 template_purchaseE(1, 352)
}

/*
* VEHICLE
*/

spriteset(spriteset_diesel_44Class_Tuscan, "gfx/Diesel/44Class.png") {
 template_2cc_88(1, 1)
}
spriteset(spriteset_diesel_44Class_FreightCorp, "gfx/Diesel/44Class.png") {
 template_2cc_88(1, 32)
}
spriteset(spriteset_diesel_44Class_candy, "gfx/Diesel/44Class.png") {
 template_2cc_88(1, 64)
}
spriteset(spriteset_diesel_44Class_Reverse, "gfx/Diesel/44Class.png") {
 template_2cc_88(1, 96)
}
spriteset(spriteset_diesel_44Class_RedTerror, "gfx/Diesel/44Class.png") {
 template_2cc_88(1, 128)
}
spriteset(spriteset_diesel_44Class_RailFirst, "gfx/Diesel/44Class.png") {
 template_2cc_88(1, 160)
}

/*
* LIVERY SELECTION
*/

random_switch(FEAT_TRAINS, SELF, switch_diesel_44Class_random) {
  1: spriteset_diesel_44Class_FreightCorp;
    1: spriteset_diesel_44Class_candy;
    1: spriteset_diesel_44Class_Reverse;
    1: spriteset_diesel_44Class_RedTerror;
    1: spriteset_diesel_44Class_Tuscan;
    1: spriteset_diesel_44Class_RailFirst;

}

switch(FEAT_TRAINS, SELF, switch_diesel_44Class_livery, cargo_subtype) {
  1: spriteset_diesel_44Class_FreightCorp;
    2: spriteset_diesel_44Class_candy;
    3: spriteset_diesel_44Class_Reverse;
    4: spriteset_diesel_44Class_RedTerror;
    5: spriteset_diesel_44Class_Tuscan;
    6: spriteset_diesel_44Class_RailFirst;
     switch_diesel_44Class_random;
}

// CARGO SUBTYPE CALLBACK
switch(FEAT_TRAINS, SELF, switch_diesel_44Class_subtype_text, cargo_subtype) {
    0: return string(str_cargo_subtype_random);
    1: return string(str_cargo_subtype_FreightCorp);
    2: return string(str_cargo_subtype_candy);
    3: return string(str_cargo_subtype_Reverse);
    4: return string(str_cargo_subtype_RedTerror);
    5: return string(str_cargo_subtype_Tuscan);
    6: return string(str_cargo_subtype_RailFirst);
    return CB_RESULT_NO_TEXT;
}

/*
* ITEM
*/

item(FEAT_TRAINS, item_diesel_44Class) {
    property {
        name: string(str_diesel_44Class);

        introduction_date: date(1957,7,8);
        model_life: VEHICLE_NEVER_EXPIRES;
        vehicle_life: 60;
        loading_speed: 5;
        cost_factor: 21;
        running_cost_factor: 20;
        speed: 114 km/h;
        power: 1800 hp;
        cargo_capacity: 1;
        weight: 112 ton;
        tractive_effort_coefficient: 0.19;
        air_drag_coefficient: 0;

        reliability_decay: 20;
        cargo_allow_refit: [PASS];
	misc_flags: bitmask(TRAIN_FLAG_FLIP);
        refit_cost: 0;
        track_type: RAIL;
  ai_special_flag: 0;
        running_cost_base: RUNNING_COST_DIESEL;
        engine_class: ENGINE_CLASS_DIESEL;
        visual_effect_and_powered: visual_effect_and_powered(VISUAL_EFFECT_DIESEL, 0, DISABLE_WAGON_POWER);

        climates_available: ALL_CLIMATES;
        sprite_id: SPRITE_ID_NEW_TRAIN;
        dual_headed: 0;
        length: 8;
        extra_power_per_wagon: 0;
        bitmask_vehicle_info: 0;
 }
    graphics {
        purchase: spriteset_diesel_44Class_purchase;
        cargo_subtype_text: switch_diesel_44Class_subtype_text;
        additional_text: return string(str_purchase_svc_axl, string(str_purchase_svc_pf));
        cargo_capacity: return 0;
        switch_diesel_44Class_livery;
    }
}
I hoping by coding as much as I can like this it could reduce the menu size and make easier to find things. Be nice if can just have a heading for say open wagons. And just click on the + to show all those that are available.

Cheers pal.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3431
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Australian AuzTrains and NSWTrains

Post by Emperor Jake »

All you would need to do is go back to your old way of coding different liveries as separate engines. The only difference is adding an extra line like

Code: Select all

variant_group: item_diesel_44Class
to the sub-variants. The main loco doesn't need any extra code, so you could very easily add it to some existing engines.

Of course, you can also combine the livery refits method with the variants method, which is what I've done, but it depends on your design choices :)

In the case of freight wagons, the main variant could be a randomised wagon, but each individual type would be selectable when you expand the menu.
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

Thanks Emperor Jake .. I will have a experiment with that over the weekend and see how it works and see what way might be better.

Not be tonight as been out train chasing all day and I plan sot hit the sack very soon. :D

Cheers pal
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

variant_group:
Hi Emperor Jake, I tried to get that code to work with no luck.
Keep getting this type of message.

Code: Select all

←[K←[91m nmlc ERROR: "AuzTrainsNSWTestV38.nml", line 62046: Unknown property name: variant_group←[0m
I even visited https://github.com/EmperorJake/JPengines
see how you coded.

The part I see different to you is how we using trains IDs.

In mine they listed like this:

Code: Select all

//Diesel, available ID range: 5000-5999 (hex 0x1388..0x176F)
item(FEAT_TRAINS, item_diesel_40Class, 5504) {}
item(FEAT_TRAINS, item_diesel_41Class, 5505) {}
item(FEAT_TRAINS, item_diesel_42Class, 5506) {}
item(FEAT_TRAINS, item_diesel_43Class, 5507) {}
item(FEAT_TRAINS, item_diesel_49Class, 5508) {}
But in jplw.nml they are lised like this.

Code: Select all

//diesels
1203, 1205, 1207, 1209, 1210, 20, 1211, 1212, 1215, 25, 1220, 1221, 71, 63, 1063, 1963, 1964, 111,
So maybe I need to re-code for instance my diesels should just be;
5504, 5505, 5506, 5507, 5508, and so on like it jplw.nml.

Just maybe the problem could be I still NML 5.3. I never worried about update to NML 6 as the version I using does what I need so never seen any reason to upgrade.

Cheers pal
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
GarryG
Tycoon
Tycoon
Posts: 5952
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Australian AuzTrains and NSWTrains

Post by GarryG »

AuzTrainsNSW
Bogie Open Wagons.

Improving the graphics to BDL, BDY and CDY open wagons.
Open Wagons.png
Open Wagons.png (15.38 KiB) Viewed 6868 times
After uploading the image I notice a graphics error with the grey CDY.
Hope to fix tomorrow.
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3431
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Australian AuzTrains and NSWTrains

Post by Emperor Jake »

GarryG wrote: 06 Jan 2024 05:02
variant_group:
Hi Emperor Jake, I tried to get that code to work with no luck.
Keep getting this type of message.

Code: Select all

←[K←[91m nmlc ERROR: "AuzTrainsNSWTestV38.nml", line 62046: Unknown property name: variant_group←[0m

Just maybe the problem could be I still NML 5.3. I never worried about update to NML 6 as the version I using does what I need so never seen any reason to upgrade.

Cheers pal
You're right, the version of NML you're using is too old to support variants. It's a relatively new feature.

You don't need to use IDs the way I did though, the way I demonstrated should work just fine :wink:
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 7 guests