The International Simutrans Forum

Simutrans Extended => Simutrans-Extended development => Topic started by: jamespetts on April 04, 2011, 01:12:01 AM

Title: [Feature preview] Liveries
Post by: jamespetts on April 04, 2011, 01:12:01 AM
This week-end, I have been coding a feature for the next release of Simutrans-Experimental allowing pakset authors to specify more than one livery (or, indeed, appearance in other respects) for each vehicle (including for each freight image), and for those liveries to be able to be selected by the user. Liveries are organised into livery schemes, each of which may have multiple individual liveries at different times. Here is an early example:

( (

This shows a BR Class 50 in 1970, in its original plain blue livery. Notice the additional control in the line management window to select the livery. Now, with the wonders of the public player mode, we fast forward 10 years to 1980:

( (

After re-selecting the livery again, the locomotive is upgraded to BR Large Logo livery. The vehicles are not automatically upgraded in livery as soon as a new livery becomes available: this is deliberate, as, in reality, vehicles were usually not re-painted until they came in for maintenance. One can, however, manually set the livery to the latest type as described. When overhauls are incorporated into Simutrans-Experimental, these will be triggers for an automatic livery upgrade that will give players a visual representation that the vehicles have been in for overhaul.

Here is another example. Look at this diesel depot in 1965:

( (

The locomotive on the second to right is a class 47 in its 1960s green livery. Here is the same depot in 1969:

( (

The class 47 is now second from the right and is in its corporate blue livery (note the class 50 on the extreme right). The class 47 only has the one .dat file. I have not yet painted a blue version of the class 25 visible on the left.

The code for this, for those who want to compile it themselves and have a go, can be found on my Github repository here (

The sources for the version of Pak128.Britain-Ex with some items with multiple liveries (currently only the Class 47 and Class 50 pictured above, each with two liveries) and a livery scheme designated in the pakset's can be found on their own liveries branch of my Github repository, here (

Comments welcome!
Title: Re: [Feature preview] Liveries
Post by: Junna on April 04, 2011, 07:16:42 AM
Will there be alternative liveries for trains that in reality never carried them? Like blue-coloured 4-COR units or something, or various alternative schemes for later units, something along the lines of a BR Blue survival or an alternative continuation of the green colour scheme, or alternative Southern Railway colours for later BR units, you get the point, could that be done? It would be nice and also create the possibility of having various distinctive liveries between companies or services in the game as well.
Title: Re: [Feature preview] Liveries
Post by: The Hood on April 04, 2011, 07:39:28 AM
Fantastic - I've been wanting this for ages!

@Junna - you get as many liveries as someone has drawn...
Title: Re: [Feature preview] Liveries
Post by: jamespetts on April 04, 2011, 07:56:09 AM

as The Hood says, the code does not magically detect what was historically accurate and limit pakset authors to that - if somebody wanted to draw Stockton and Darlington railway carriages in fluorescent pink, the new code would accommodate it.

The Hood - glad that you approve! Incidentally, for anyone curious, here is an example of the syntax for this:

(In a .dat fle)
Code: [Select]
# Should be 1968, but otherwise big gap with no diesel locomotives, so must extend.






(In the pakset's
Code: [Select]
################################### Livery settings ##################################

# These settings define livery schemes for vehicles. Each scheme can have a number
# of liveries, each with their own introduction dates. When a livery scheme is applied,
# the livery of that scheme with the latest introduction date that is not in the
# future will be selected. The livery scheme's retirement date is the date after which
# that livery scheme can no longer be selected and applied. The retirement date is
# optional: with no retirement date specified, the livery does not retire.
# The following example defines two livery schemes (Yellow and Blue), each with two
# liveries (Bright-Yellow and Dark-Yellow and Navy-Blue and Royal-Blue respectively)
# with introduction dates. The default scheme will be the lowest number scheme available.

# livery_scheme[0] = Yellow
# retire_year[0] = 1990
# retire_month[0] = 4
# livery[0][0] = Bright-Yellow
# intro_year[0][0] = 1900
# intro_month[0][0] = 1
# livery[0][1] = Dark-Yellow
# intro_year[0][1] = 1950
# intro_month[0][1] = 5
# livery_scheme[1] = Blue
# livery[1][0] = Navy-Blue
# intro_year[1][0] = 1900
# intro_month[1][0] = 1
# livery[1][1] = Royal-Blue
# intro_year[1][1] = 1960
# intro_month[1][1] = 4

livery_scheme[0] = British-Railways
retire_year[0] = 1986
retire_month[0] = 6
livery[0][0] = BR-Early
intro_year[0][0] = 1948
intro_month[0][0] = 1
livery[0][1] = BR-Revised
intro_year[0][1] = 1956
intro_month[0][1] = 2
livery[0][2] = BR-Blue
intro_year[0][2] = 1966
intro_month[0][2] = 6
livery[0][3] = BR-Large-Logo
intro_year[0][3] = 1979
intro_month[0][3] = 6

(In the translation texts:)

Code: [Select]

#___________________________________Livery schemes___________________________________
#___________________________________Livery schemes___________________________________
British Rail(ways)
Title: Re: [Feature preview] Liveries
Post by: Junna on April 04, 2011, 08:20:01 AM

@Junna - you get as many liveries as someone has drawn...

Goes without saying...

I mean is it planned for it to be, officially, strictly historical or would alternative liveries and such be added to the pak or would those be un-official separate things?
Title: Re: [Feature preview] Liveries
Post by: jamespetts on April 04, 2011, 08:33:15 AM
Goes without saying...

I mean is it planned for it to be, officially, strictly historical or would alternative liveries and such be added to the pak or would those be un-official separate things?

Ahh, you mean for Pak128.Britain-Ex? I'm not sure what The Hood is planning to draw: I think that it is a matter that has yet to be decided. It may well be that liveries that vehicles might well have had but, by historical accident, did not have are included: possible candidates in that category are things like a Class 50 in InterCity livery, for example, or air-conditioned Mk. IIs in Network SouthEast livery, etc. I suspect that those will not be priorities, however, as there is a lot of work to do to produce even those liveries that did, in fact, appear.

Incidentally, the 4-Cors did appear in BR blue:

Title: Re: [Feature preview] Liveries
Post by: VS on April 04, 2011, 09:35:05 AM
James, how does this interact with cargo-specific images? Is it mutually exclusive?
Title: Re: [Feature preview] Liveries
Post by: jamespetts on April 04, 2011, 10:13:23 AM
James, how does this interact with cargo-specific images? Is it mutually exclusive?

No, one can have freight images for each livery in the following syntax:

Code: [Select]
Title: Re: [Feature preview] Liveries
Post by: VS on April 04, 2011, 11:57:23 AM
Perfect :)
Title: Re: [Feature preview] Liveries
Post by: The Hood on April 04, 2011, 12:43:32 PM
One question - I'm unsure of the difference between liveries and livery schemes - what is the rationale here?  I don't get the need for the second layer and all the stuff in the

Related to that, perhaps we could take the IC125s as an example:
- BR Blue/grey-> Intercity
Various Post privatisation:
-> Virgin -> CrossCountry
-> Great Western -> FGW
-> Midland Mainline (x2) -> EMT

How would you do all these?  My simple idea was just a choice of any (maybe within a given date range?)


I'd probably just do historical ones - certainly at first - although I may do some slightly fictitious ones later on.
Title: Re: [Feature preview] Liveries
Post by: jamespetts on April 04, 2011, 11:16:44 PM
The Hood,

ahh, the InterCity 125 is not the best example of livery schemes. The idea of a livery scheme is to define upgrade paths. So, for example, there would be an "InterCity" livery scheme, which would encompass both the InterCity Executive and the Intercity "Swallow" schemes. Which of those two is applied would depend on the time of purchase/overhaul (when implemented)/livery application.

Take a non-railway example: aircraft. Each aircraft could have a livery scheme of a particular airline, with the individual liveries representing the progress of that airline's livery over time; the original British Airways livery, then the version with the variously decorated tails, and finally the current version; similarly, the same aircraft could have a British Midland scheme, progressing from the older British Midland livery to the more recent "BMI Baby" branding, etc., and the aircraft with the British Airways scheme would upgrade to the later British Airways livery, whilst aircraft carrying the British Midland scheme would upgrade to the later British Midland liveries.

Returning to the railways, BR is an ideal candidate for livery schemes, as there were many different liveries in a linear progression from 1948 until the advent of sectorisation in 1986 (whereafter one could again choose between different schemes for the same vehicle). The post-privitisation liveries are more of a challenge: one might either do them by company (all of First Group's liveries, perhaps) or by franchise region (Great Western, Thameslink, Midland, etc.); which of the two is preferable I am not yet sure. As for earlier liveries, various pre-nationalisation companies went through a number of livery iterations: the Southern, for example, had two principal shades of green (the darker "olive" green in the Maunsell era and the lighter "Malachite" green in the Bulleid era), the GWR had lined and unlined variants of its liveries on both carriages and locomotives, and had a phase of a peculiar reddish brown all over instead of its characteristic chocolate and cream: the LB&SCR had at least two major livery iterations in its time (both of which are repreesnted in Pak128.Britain - the earlier ochre and the later colour that can perhaps best be described as aubergine), and so on.
Title: Re: [Feature preview] Liveries
Post by: The Hood on April 09, 2011, 12:48:21 PM
OK thanks for that explanation.  I'm still not 100% convinced this is the best approach, but if you have good reasons for keeping it the way you have done it then I'm happy just to have liveries added.  How is the livery currently implemented?  From your screenshots it looks like it may be on the line level so:
1) what happens if there are several different convoys on a line with different vehicles, each of which has different liveries? Let's be historically inaccurate for a moment as players may want to do this - e.g. two expresses on the same line, one is an LNER A4, the other is an LMS Coronation Scot.  Presumably the A4 would have an "LNER" livery scheme while the Coronation Scot would have "LMS" livery scheme?  How would this then work as the LNER scheme went through Silver -> Garter Blue -> BR Blue -> BR green while the LMS went through Blue -> Red -> Lined black -> BR Blue -> BR Green -> BR Red?  Surely it would be better to do liveries on a convoy level?
2) However if we do liveries at a convoy level then what happens if I have different coaches in my convoy which have different livery schemes?  How does that work with updating?  Should we do liveries at the vehicle level?  Although this seems maybe too much micromanagement...
3) How do livery schemes work if different classes using the same livery scheme use different liveries within the same scheme?  E.g. the IC125 would go through BR intercity, The class 58 would go down the railfreight route but 47s could be either, or NSE, Regional, Scotrail etc etc...  Doesn't this require a different livery scheme for each locomotive (which is a duplication to have it in two places) or a different livery scheme for each livery (a duplication of layers)
4) Your examples in the first post indicate only a couple of the liveries in a livery scheme being used in the loco dat.  What happens when liveries in a livery scheme are NOT defined in the dat for a loco?  How does the loco even know what livery scheme to apply when it has only the livery in its dat?

Finally - I'm not sure I'm that keen on doing different liveries for BR intercity executive and BR intercity swallow - or different linings on GWR choc & cream as these would not be particularly visible at the simutrans scale, would be lost on most people, and would be a very time consuming task to do these duplicates.  The first priority would be to do principal variants, or maybe on a class by class basis?

How set in stone is your implementation?  How easy would it be to change if we found it not very easy to use after a few examples had been done?
Title: Re: [Feature preview] Liveries
Post by: jamespetts on April 09, 2011, 01:43:08 PM
Welcome back from whereever it was that you went :-) I hope that you had a good holiday. The reason for implementing things in this way is to enable semi-automation of liveries so that liveries reflect parameters simulated in the game (the date and when the vehicle was last overhauled (when that is implemented)), and so as to reduce micromanagement. To answer your specific questions:

1. The cunning thing about the livery scheme system is that, if, on a manual application of a livery scheme to a line, there are vehicles in the line with no liveries matching that scheme, the current livery will remain unchanged. So, for manual applications, the player could simply select "LNER" then select "LMS" to update the liveries of all LNER and LMS vehicles in the line to the latest liveries of each type. I have not yet written the code for overhauls, so I have not decided how this situation will be handled when a vehicle is overhauled (and its livery updated to the latest in the line's scheme, if available). One possibility is that, if there is no livery at all of the current line's scheme, on overhaul, the vehicle would apply the latest livery of the scheme which the vehicle currently bears. That has not yet been finalised, however.

2. Liveries at convoy level are a possibility: I have not yet implemented this because the GUI end of things might be fiddly. The architecture is already there for this, however. Do you have any ideas as to where the livery control for convoys might go? Might it not be a bit too much micromanagement? I want liveries to be quite easy for players to understand, and, if there were line level and convoy level controls, players might be confused at the interaction between them. Vehicle level would certainly be excessive micromanagement.

3. There are three cases here (if I understand you correctly): (1) parallelism; (2) convergence; and (3) divergence. The first two are straightforward cases, the third is trickier. In (1), the same vehicle can have one or more livery schemes, each of which have a progression of liveries through all eras during which the vehicle is current. Once a scheme is selected for that vehicle, it will simply update according to its scheme when it overhauls and not use the liveries of the other scheme. Convergence occurs when a vehicle that in earlier times had multiple livery schemes has in later times only one scheme, and divergence is the opposite. Convergence and divergence is most noticeable in Pak128.Britain in relation to nationalisation/privatisation and corporate mergers (e.g. BOAC/BEA -> BA, etc.). Convergence is relatively straightforward, as the automatic updating of liveries I intend to work such that, if the vehicle's current livery scheme is obsolete (past its designated retirement date), but there is a current, non-obsolete scheme, then that current, non-obsolete scheme will be applied on overhaul. So, railway vehicles, for example, will automatically update from their pre-grouping liveries to their grouping liveries, and from their grouping liveries to their nationalisation liveries without difficulty. Similarly, BOAC and BEA livery aircraft will transition to BA liveries readily. The harder case is divergence, which is associated mainly with railway privatisation/sectorisation. In this case, the previous livery (BR) will become obsolete, and be replaced by a range of different liveries. The best that I have come up with for this is that, on overhaul, the first defined livery scheme in will have priority when multiple liveries are current and the vehicle is transitioning from an obsolete livery scheme to a current scheme on overhaul. If this turns out to be a livery other than the player desires, the player can simply update the scheme (for example, to change from Network SouthEast to InterCity) in the line's livery selector.

4. This is an easier issue: suppose that a livery scheme defined three liveries in sequence, A, B and C. Suppose further that a vehicle only had liveries A and C defined. On overhaul or the application of the scheme to the vehicle, livery B would simply be ignored: livery A would be applied if the game's date is before livery C's introduction date, and livery C would be applied if the date is after livery C's introduction date. This can be used creatively to define a considerable number of variants of liveries within one scheme which did not apply to all vehicles: one could, for example, use more specific scheme designations for BR liveries, such as "BR-Electric-Blue", "BR-Green", "BR-Carmine-Cream", etc., and apply those liveries only to the vehicles to which those liveries were applied in reality.

As to Executive/Swallow, I would have imagined that these would look somewhat different even at pak128 scale, as the cab ends are different both on the HST and the locomotives (large yellow ends for Executive) and the lower body colour is different on swallow (white) to Executive (beige). I am happy to do those variants if you would rather not: there are enough liveries to do that we probably both need to do a fair bit in any event. I have already been working on BR corporate liveries for the various .blend files that I have of diesel and electric locomotives, and have green/blue/large logo (as applicable) for the class 24, 25, 31, 47, 50 and 71. Because re-livering a vehicle is easy compared to many other tasks, it is something that I can do easily of an evening.

Some liveries are much harder than others: later post-privitisation liveries are particularly difficult, especially those with sweeping curves, such as South-West Trains, Southern and Midland, and those with fine detail, such as First Great Western (the most recent) or First Capital Connect. By contrast, grouping era and BR corporate era liveries are generally very easy, consisting generally of either solid colours or two colours in linear stripes. Perhaps we could divide the work between us?

As to the implementation - I hope that what I have will, more or less, be what makes it into a release version (with the addition of the overhauling code), but, if problems are found, I shall have to remedy them.

I hope that this answers your questions :-)
Title: Re: [Feature preview] Liveries
Post by: The Hood on April 09, 2011, 04:07:54 PM
Thanks - that answers most questions and on further reflection looks like a good way to do it.  As you say it covers most of the eventualities, except those cases where there were several concurrent liveries.  Your default idea sounds good to me - but I'd also suggest a convoy (or even vehicle) level override.  You could fit a livery control in the convoy window (which would be updated as per the existing method you describe, but could be changed by a player if they want to).  To do vehicle level liveries, I suggest putting it in the "details" window.  The logic is this: changing liveries on the line-level overwrites all vehicles in all convoys on that line; on the convoy-level overwrites all vehicles in that convoy, and on the vehicle level overwrites only that vehicle (at this level you'd be able to chose all liveries for that vehicle, not schemes).  Overhauls would be equivalent to convoy level I think, but that depends on how you implement overhauls.

As for who does what, I'll start a new topic in the pak128.Britain board about this.
Title: Re: [Feature preview] Liveries
Post by: jamespetts on June 23, 2011, 11:59:49 PM
This is now included in 9.9 (without the convoy level GUI for the time being).

Edit: Full documentation on how to implement this feature is now available here (