Timberwolf's UK.... trains?

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

Electricfox
Engineer
Engineer
Posts: 28
Joined: 19 Jun 2006 18:13

Re: Timberwolf's UK.... trains?

Post by Electricfox »

Oooh, very Art Deco, I like it!
PEPSprinterPacer
Engineer
Engineer
Posts: 79
Joined: 20 Jul 2020 13:43
Location: Nether you mind

Re: Timberwolf's UK.... trains?

Post by PEPSprinterPacer »

Ooooh!

(142nd post, *screeching in background*
Only ever been on a 185 and 144 023!
User avatar
Darthrafael
Engineer
Engineer
Posts: 106
Joined: 03 Aug 2011 14:10
Location: Yes

Re: Timberwolf's UK.... trains?

Post by Darthrafael »

So uh, it seems that the FFA container wagon looks a bit... interesting when not fully loaded. I don't think containers work like this?
The same thing happens to the FSA and the KTA wagons.
Container.PNG
Container.PNG (15.62 KiB) Viewed 1532 times
Hi~
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

Ooh, interesting. Looks like the object composition isn't working properly and putting part of the third container on the output object.

Edit: rather more interesting, in fact. It looks like the front, middle and rear sections aren't in agreement over which cargo sprite to show, so you're seeing the "full" sprite on the front and middle, but the "half-full" sprite on the rear (and getting the container cut off at the transition point). This will require some delving into the switch logic to figure out what's happening - I have a theory it may be due to the capacities of each section not updating evenly.

So... this is down to how long vehicles are implemented. The FFA container wagons aren't one vehicle, they're in fact 3 articulated sections - front, middle and rear. In turns and on hills only the middle has a sprite, but on straight rails each section has its own sprite. The reason for this is to avoid glitches on tunnel entrances or crossing slope foundations. Normally this works fine, but when you have a partial load OpenTTD selects the load sprite based on how much cargo is in each part of the vehicle. If the cargo isn't a multiple of 3 it's possible for the front and sometimes middle to have a different load graphic to the rear.

I think this may be possible to work around with a bit of switch trickery, if I can get the total cargo in vehicle and use it to emulate the built-in spriteset functionality.
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

And now fixed. v1.1.2 is up on BaNaNaS, also allows auto-refit for the first time.

As to that fix... ever get the feeling OpenTTD is telling you that you shouldn't be doing what you're doing? I get that a lot with the over-length vehicles :). In order to make all sections of the vehicle load consistently, I have to use a switch based on the cargo to emulate spritegroups. But on top of that, the variables for cargo_countand cargo_capacity refer to the current section of the articulated vehicle, not the whole thing. If I use those I just recreate the same problem I had before with uneven loads.

Luckily, there's variable 61 on hand which can be used to get values from other vehicles in a chain. So I use that to make the front and rear sections of the articulated vehicle base their sprites on the cargo capacity of the middle vehicle:

Code: Select all

// Cargo switch for front flat&straight
switch(FEAT_TRAINS, SELF, switch_cargo_{{.}}_sections_front, [
        STORE_TEMP(1, 0x10F), // use variable of next vehicle
        (var[0x61, 0, 0x0000FFF, 0xBC] * 4) / cargo_capacity
    ])
{
    1..2: return spriteset_{{.}}_half_sections_front;
    3..4: return spriteset_{{.}}_full_sections_front;
    return spritegroup_{{.}}_none_sections_front;
}

// Cargo switch for rear flat&straight
switch(FEAT_TRAINS, SELF, switch_cargo_{{.}}_sections_rear,  [
        STORE_TEMP(-1, 0x10F), // use variable of previous vehicle
        (var[0x61, 0, 0x0000FFF, 0xBC] * 4) / cargo_capacity
    ])
{
    1..2: return spriteset_{{.}}_half_sections_rear;
    3..4: return spriteset_{{.}}_full_sections_rear;
    return spritegroup_{{.}}_none_sections_rear;
}
(This is not pure NML, it's what I use in my templating system... {{.}} gets replaced with a name when the file is generated. This is also why I use a spritegroup for _none, to keep the templating simple)

Variable 0xBC is the cargo count of the current vehicle, and because cargo capacities are the same for all sections of the articulated unit I can just use the local variable for that. So far this calculation matches the spritegroups used for the middle section, and in all my tests has given consistent results so vehicles don't suddenly increase or decrease the amount of visible cargo going into a corner or hill (where a single sprite is used). And so another glitch in the abomination that is a 12/8 or 14/8 length vehicle is fixed... although keep your eye out for any other situations where the cargo load of the middle section is inconsistent with the front/rear.
User avatar
TrainLover
Engineer
Engineer
Posts: 108
Joined: 01 Jul 2015 15:03

Re: Timberwolf's UK.... trains?

Post by TrainLover »

They look a lot more like Locomotion models than OpenTTD/TTD sprites
Developer of North American Passenger Liveries: viewtopic.php?f=26&t=87228
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

Gradual station progress - I've mocked up the 2-tile Art Deco building as two single tile buildings for now, but I'm happy enough with the artwork to start coding multi-tile stations.

Image

(A couple of liberties may have been taken with the prototype to make it fit in two tiles...)

The Locomotion resemblance is semi-deliberate. I dislike an enormous list of things about Locomotion: the brown buildings on a brown landscape, the million clicks to build a tiny length of track, somehow making TTD's original mechanics for reliability and vehicle replacement even more tedious, the lack of epic scale... but the detail in the trains and the naturalistic way they take corners and hills really appeals to me. I wanted a combination of that model railway appeal of creating some trains and watching them go about their business, but with the playability and the scope for complex networks of OpenTTD.
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

Small bump with some characteristically slow progress - I've been working on more 1x1 building tiles to give a bit of variety between towns. Here's the latest additions; you could play a game of "guess the British station" with this set (although quite a mean one, as some are heavily adapted from the real-life prototype to fit in an OpenTTD layout)

Image

Image

Image
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

I feel a little bad about bumping this without any intermediate replies... but it's been a while since the last progress update, so I should add a screenshot showing some of the popular requested features in-game:

Image

There are some definite SR vibes creeping in around the edges. Not sure whether that's the prevalence of art deco and Streamline Moderne designs tickling my fancy, or 8 years of a previous life commuting the suburban SWML lodged in the subconscious. I'll know it's the latter if I ever start adding the Elf Storage Units or Crackhouse Spongebob as decorative objects.

Oh, and it's hardly new technology but we have automatic buffer stops.

Image

State of the art for 2012!
User avatar
Limyx826
Engineer
Engineer
Posts: 13
Joined: 19 May 2019 15:42
Location: Somewhere in UTC+8
Contact:

Re: Timberwolf's UK.... trains?

Post by Limyx826 »

Is the new stuffs separate NewGRF or included in the trains NewGRF?
I am Limyx826.
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

It's a separate stations GRF, containing the station tiles and waypoints.
Electricfox
Engineer
Engineer
Posts: 28
Joined: 19 Jun 2006 18:13

Re: Timberwolf's UK.... trains?

Post by Electricfox »

It's looking good Timberwolf, I look forward to giving it a bash. :D
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

Not too much looking forward needed :)

To give its country of inspiration something to help get through another lockdown, Timberwolf's Stations is now available on BaNaNaS. It's a little on the minimal side but there's enough there to be playable and build some interesting station layouts.

Let me know about any bugs and the inevitable obvious goofs, station or signal boxes that are a must for the next release, and of course... have fun!

Image
User avatar
Darthrafael
Engineer
Engineer
Posts: 106
Joined: 03 Aug 2011 14:10
Location: Yes

Re: Timberwolf's UK.... trains?

Post by Darthrafael »

I really like the look of the stations! Though there are some pieces I personally think are missing. Specifically, single-side footbridges and single-side buffers stops. They currently only exist as... double platforms(?), (I really don't know what the proper term for them is) which makes making a two-track station with single-side platforms not be able to have a way to get from one platform to the other...

Beyond that, though, the tiles so far look really good!
Hi~
Electricfox
Engineer
Engineer
Posts: 28
Joined: 19 Jun 2006 18:13

Re: Timberwolf's UK.... trains?

Post by Electricfox »

Fantastic stuff Timberwolf, absolutely fantastic, I shall enjoy upgrading my stations. I do love that you've given us wooden platforms as well, that's a very nice touch.
I can only offer a couple of suggestions, Darthrafael has already covered the footbridge for the single sided platforms, but I might also suggest subway entrances, they're handy for stations with through lines, and one other idea for the waypoint markers (love the Southern type 13 box btw) is a speed limit sign, could be in two flavours, the old yellow numbers and the new red circles. That way if someone wants to put down a waypoint marker for an inner line in a four track setup then they won't have a signal box in the middle of the mainline.
Otherwise, brilliant stuff! Loving it. :D

EDIT: Oh, just one last thing...would it be possible to do a two track station shed roof? Would go nicely alongside the single track one that's already there, perhaps in varying forms such as single sided platform half-arch (to match up with the other half on the other side, allowing single sided platforms with an overall roof) and also perhaps with buffer stops underneath as well for terminus stations.
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

Thanks :)

I'll have a think about some of those tiles, the sprite scheme for platforms could do with some tweaking so it's possible to create more variations without bloating the filesize.
Electricfox
Engineer
Engineer
Posts: 28
Joined: 19 Jun 2006 18:13

Re: Timberwolf's UK.... trains?

Post by Electricfox »

Timberwolf wrote: 12 Nov 2020 21:57 Thanks :)

I'll have a think about some of those tiles, the sprite scheme for platforms could do with some tweaking so it's possible to create more variations without bloating the filesize.
That's good to hear, I mean the file size isn't too bad at the moment so I think you've got a fair bit of leg room to play with there.
Timberwolf
Traffic Manager
Traffic Manager
Posts: 189
Joined: 22 May 2006 18:25
Location: London-ish.
Contact:

Re: Timberwolf's UK.... trains?

Post by Timberwolf »

I completed my major sprite rejig. Previously each different type of platform object had its own individual SetIDs (as per Action 1), this made it very difficult if not impossible to share elements across multiple types of station tile. This is the main reason for the slightly weird menu scheme where the double, island and outer platforms are organised by object type rather than all being together, so the sprites can be reused.

Now almost everything in a single class is defined in a single large Action 1 creating dozens of views for each load state, meaning any layout can pick and choose tiles from the whole list for that type of platform. The main benefit is I'll be able to create 2-platform setups where the island platforms have a special large object like a billboard or planter, while the outer platforms for the same tile can be normal platforms.

As ever with my attempts at GRF coding, I don't know if it's the right way but it's a way. At least with the stations I feel less like I'm angering the great ancient ones than I do when I'm messing about with the extended-length vehicles :)

A mock up of the kind of thing I'd like to enable for 2-platform island and regular stations:

Image

I'm also thinking of using the new sprite layouts for creating a tile where one side is a platform and the other a ramp, to make it easier to integrate the buffer stops into a single-sided station (and other weird and wonderful stuff)
Electricfox
Engineer
Engineer
Posts: 28
Joined: 19 Jun 2006 18:13

Re: Timberwolf's UK.... trains?

Post by Electricfox »

That is certainly looking the business!
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 10 guests