Concept

YASFUTSCTIWLTM Yet Another So Far Unfinished Train Set Concept That I Would Like To Make
is the ultimate answer to making a simple, fun, yet complex train set. Key features are:

0. Basic concepts

  • full name PART Assembled Road Trains
  • super simple/first-sight friendly - try to eliminate stupid and/or complex rules
  • ultimate amount of customizability and possible complexity for any level of advanced players
  • only 1 engine class with 11 individual engine models, each model has some part improved, some models also get better wagons
  • new vehicles from 1920 until 2100, one new model every 20 years
  • wagons are parts, all of them are universal
  • wagons automatically adjust capacity and loading speed
  • NO can_attach_wagon errors, everything can be hauled by anything (within PART, with parameter to override the attaching rules). Only one engine per train however (does not make sense, improve performance by parts, not by engines).
  • all wagons multiple loading stages and multiple random looks
  • all wagons use recolour masks and layers to combine into various cargoes by code -> easier extensibility for new industry set cargoes in the future
  • 5 railtypes which influence train performance, railtypes are actually roads/rails, train wheel adapt to railtype
  • recolourable passenger/mail wagons by CC (use CC on some non-recoloured layers)
  • default parameters work perfectly fine out of the box
  • parameter for starting & ending dates for customizability for short/normal/long playing

1. Booster wagons -- Parts

There are various types of wagons. Every wagon is universal (can carry any cargo) but each of them improves the performance of the whole train in some way, like:
  • Normal: 01 - Power Part - adds power
  • Normal: 02 - Speed Part - adds max speed
  • Normal: 03 - Tractive Effort Part - adds T.E.
  • Normal: 04 - Capacity Part - part with big capacity and higher loading speed to match
  • Normal: 05 - Loading speed Part - part which reduces loading stage count for the whole train - in depot, show load speed stage number over this part
  • WTF: 06 - Cost efficient Part - low cargo decay rate, super high running cost when waiting at signals, depots or stations
Unused ideas:
  • Easy: * - Bit of Everything Part* - adds small bonus to speed/power/T.E./loading speed. UPDATE: probably not useful, easy mode is probably not important. Can still implement.
    -* WTF: * - Refittable Part* - all cargoes have subrefits for any other part - allows for some weird stuff with refit, and/or automatically changing parts. UPDATE: Can't use cargo subrefit by orders since OpenTTD 1.2 ... refittable part not useful anymore
  • WTF: * Snakey Part* - majorly increases running cost when not on curves
  • WTF: * Dynamic Part* - adds bonus based on situation
  • Dynamic FREIGHT = when empty, increase max speed, but reduce power
  • Dynamic FREIGHT = when not empty, increase power, but reduce max speed
  • Dynamic EXPRESS = when empty, increase power, but reduce max speed
  • Dynamic EXPRESS = when not empty, increase max speed, but reduce power
  • if the reduction is less than engine’s base value, don’t reduce further … or never subtract
  • Normal: * Loading Speed Part* - improves loading speed of the whole train - ?
  • Normal: * Adaptive Part* - reduces negative effects of roads (only early game, later only if you want to keep various roads)
  • WTF: * Long train friendly Part* - gives some big bonus but removes tilt … add speed&power the longer the train is (for long trains because bonus grows but requires high CL)

2. Boost proximity

UPDATE: This feature is canceled, it's impossible to code.

To make the booster wagons even more interesting, it does matter how close to the engine the wagon is. That means you not only have to choose which boosts do you want, but what priority do you give to each of them, and sort them as you like.
A train can only have 1 engine, rest can’t connect. Improve performance of train by adding parts, not more engines. Also I can’t seem to think of a good mechanic how multiple engines in consist would work.
Dual headed trains show as single headed in the depot to make it clear that only the front part matters here.

3. Various railtypes

There are 5 railtype generations, unlocked over time. Vehicles get better performance on better railtypes. These performance bonuses are solved by switches in the vehicles, not by railtype speed limits for more flexibility and even less restrictions for the player.
The varying performance based on track type, coded by this method, also unlocks the awesome magic with conditional orders, checking for maximum speed. (like MEOW/PURR in NUTS, but this time in a much nicer/natural solution)

  • Dirt Road +10% Tractive Effort
  • Rail +10% Speed
  • Asphalt Road +20% Tractive Effort, +5% Speed
  • Electrified Rail +20% Speed
  • Modern Concrete Road +20% Tractive Effort, +15% Speed
  • Maglev +40% Speed
Other candidates:
  • WETrail
  • Monorail
  • SLUGrail

4. Visual Concept

General:

  • Massive modularity.
  • Engines change their graphics based on the parts that are connected
  • Layers to minimize amount of sprites.
  • Index recolouring to minimize amount of sprites.
  • Loading stages don’t change between generations of wagons, bigger wagons just unlock more stages.
  • Recognizable wagons for specific cargoes like in NUTS.
  • Company colours on train heads.
  • Skewed box visual concept from BRIX trains.
  • When wagons are loading, see the cargo inside. (possibly disabled by a parameter)

Engines:

Layers:
Layer 1 = T.E. - wheel + train base
Layer 2 = Speed - cabin
Layer 3 = Power - engine part

Drawing System:
Engines are 16/8 articulated from two 8/8 parts, just like many vehicles in NUTS.

To allow dual-heading, wagons with specific leading engines draw as the wagon behind it, and the last wagon draws as the rear head. (just like chameleon trains in NUTS)

Maybe some powerful steam trains get 24/8 articulated drawing, where the third unit is a wagon drawn as a tender.

Wagons (parts):

Layers:
Layer 1 = wheel + part identifier
Layer 2 = cargo wagon front part (draws over cargo)
Layer 3 = cargo
Layer 4 = cargo wagon rear part (draws under cargo)

5. Wagon colouring

  • at any point in the game, with any newgrf configuration, every wagon can be distinguished by colour, to see what type of cargo it can carry / is carrying
  • updated and upgraded to work with all up-to-date industry options (FIRSv3 etc)
    http://dev.openttdcoop.org/projects/nuts/wiki/GearCargoSystem
  • done by recolour masks for easy editability later when new cargoes are defined
  • one of the best features of NUTS

6. Passenger wagon sub-refit recolouring

  • since wagons do not have CC, this can be done by code to save many sprites.
  • engines would just lose CC if recoloured (not a big issue, the CC is just forced to the selected colour)
  • no recolouring for freight cargoes as they need colours to distinguish between cargo types
  • colour to indicate which booster type it is would remain
  • engines have to be able to carry cargo in order to get refit

Y. RANDOM NOTES

Secret slug
There could be secret combinations of units which would convert the whole train into a slug. One of the ideas is to have the most modern engine be able to attach the oldest engine to form a slug.
This can’t be achieved by autoreplace, which makes it a bit odd and not very usable in a normal game. The question is whether that is a problem.
Another option could be having specific wagon combinations as cheat codes to get slugs, for each train length there would be a code. This might make it a bit too likely to appear with just 6 part types, unless it starts appearing only with higher train lengths, at which point it would be impossible to use short slugs :(

Parameter for introduction_date:
[20:57] <frosch123> but "date(1900,0,0)+365*parameter" is just fine
Can also divide, subtract etc to make 2 parameters - start and finish, and have all vehicles auto-adjust to the range

item(booster_wagon ...)
{
}
// return power, as computed in TEMP(0)
switch (..., power_final, [ LOAD_TEMP(0) ] ) {
return
}
// check vehicle at position 1 from front, and add 400 if booster
switch (..., power_check_1, [
STORE_TEMP(2, 0x10F),
STORE_TEMP(LOAD_TEMP(0) + (var[0x61, 0, 0xFFFF, 0xC6] booster_wagon ? 400 : 0), 0)
] {
default: power_final
}
// check vehicle at position 1 from back, and add 400 if booster
switch (..., power_check_2, [
STORE_TEMP(position_in_consist_from_end - 1, 0x10F),
STORE_TEMP(LOAD_TEMP(0) + (var[0x61, 0, 0xFFFF, 0xC6] booster_wagon ? 400 : 0), 0)
] {
default: power_check_1
}
// check vehicle at position 2 from front, and add 100 if booster
switch (..., power_check_3, [
STORE_TEMP(2, 0x10F),
STORE_TEMP(LOAD_TEMP(0) + (var[0x61, 0, 0xFFFF, 0xC6] booster_wagon ? 100 : 0), 0)
] {
default: power_check_2
}
// check vehicle at position 2 from back, and add 100 if booster
switch (..., power_check_4, [
STORE_TEMP(position_in_consist_from_end - 2, 0x10F),
STORE_TEMP(LOAD_TEMP(0) + (var[0x61, 0, 0xFFFF, 0xC6] booster_wagon ? 100 : 0), 0)
] {
default: power_check_3
}
// basic power is 2000 + 200 per booster vehicle
switch (..., power_switch, [
STORE_TEMP(2000 + count_veh_id(booster_wagon) * 200, 0),
train_length
]) {
1..2: power_final; // no wagons, no bonus
3: power_check_1; // one wagon
4: power_check_2; // two wagons
5: power_check_3; // three wagons
default: power_check_4; // four or more wagons
}
item(engine ...)
{
power: power_switch;
}

High cost for waiting at signals:

switch (FEAT_TRAINS, SELF, unicorn_resting_cost2, [
var[0xB4, 0, 0xFFFF]
]) {
0: return 100; // cost when waiting for no reason
1..30: return 50; // cost when driving very slow/accelerating/beaking
default: return 0; // normal operation
}
switch (FEAT_TRAINS, SELF, unicorn_resting_cost, [
var[0x8A, 0, 0x0F] | (var[0xB2, 1, 0x01] << 4)
]) {
0x03: return 10; // cost when vehicle is loading/unloading
0x10..0x1F: return 10; // cost when vehicle is stopped
default: unicorn_resting_cost2;
}
item(...) {
...
graphics {
running_cost_factor: unicorn_resting_cost;
}
}

[09:08] <andythenorth> https://jqueryui.com/draggable/
[09:08] <andythenorth> combine with https://jqueryui.com/droppable/

[13:57] <frosch123> V453000: try something like (10+count_veh_id(veh_booster)) / (3+count_veh_id(veh_booster)

Wagons:
Use many loading stages, early wagons only use 1-3, later wagons use 1-5, wagons with boosted capacity can use 1-8 or something like that. Use the same cargo sprites for all wagons, just allow more loaded variations later.