Curved tracks

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Bad_Brett
Transport Coordinator
Transport Coordinator
Posts: 355
Joined: 01 Feb 2007 17:59
Location: Stockholm, Sweden

Curved tracks

Post by Bad_Brett »

As you may, or may not know, I've been trying to do a work-around to get curved railway tracks (It's a really dirty solution by using overlapping tiles).

Image

Anyway, I've been doing a lot of programming in other languages lately and I realise that it must be possible to write an algoritm that solves the problem instead. Something like:
trans1.png
trans1.png (3.36 KiB) Viewed 7956 times
Of course, this will estimately require 3-4 times more sprites, but it shouldn't be too hard to write an algoritm like this, right?

Secondly, I want to make longer engines using a different method. Previously, the engines were either long and stiff or simply divided into two sprites. I wonder if it's possible to create a NewGRF using 2-3 sprites, where the one in the middle overlaps the first and the last:
trans2.png
trans2.png (18.35 KiB) Viewed 7956 times
Of course, this will look a bit weird in motion, but I think it may turn out better than the usual methods.
Michi_cc
OpenTTD Developer
OpenTTD Developer
Posts: 619
Joined: 14 Jun 2004 23:27
Location: Berlin, Germany
Contact:

Re: Curved tracks

Post by Michi_cc »

Bad_Brett wrote:Of course, this will estimately require 3-4 times more sprites, but it shouldn't be too hard to write an algoritm like this, right?
Using the adjacent track bits for selecting sprites isn't hard, but I think you underestimate the needed sprites "a bit" :) If you want to provide a full set of sprites (i.e. not including only curves but all junctions as well), even the single straight diagonal X track is already needed in 49 variants. And that's only a single track.

-- Michael Lutz
Bad_Brett
Transport Coordinator
Transport Coordinator
Posts: 355
Joined: 01 Feb 2007 17:59
Location: Stockholm, Sweden

Re: Curved tracks

Post by Bad_Brett »

Michi_cc wrote:
Bad_Brett wrote:Of course, this will estimately require 3-4 times more sprites, but it shouldn't be too hard to write an algoritm like this, right?
Using the adjacent track bits for selecting sprites isn't hard, but I think you underestimate the needed sprites "a bit" :) If you want to provide a full set of sprites (i.e. not including only curves but all junctions as well), even the single straight diagonal X track is already needed in 49 variants. And that's only a single track.

-- Michael Lutz
Only 49? It thought it would be 81, considering each track ending would have three different designs (3^4). Though much of this just would be copy-paste, it doesn't seem to be an optimal solution. I was thinking of using overlays.
trans3.jpg
trans3.jpg (23.44 KiB) Viewed 7941 times
Actually, the current game works pretty much like this already:
trans4.png
trans4.png (4.33 KiB) Viewed 7941 times
If I recall correctly, a track can be placed in six different ways. Each track has two endings. Each ending needs three sprites. This would equal 6*2*3 = 36 new sprites. If you exlude sharp turns, it would only require 2*2*3 + 4*2*2 = 28 new sprites. Of course, the elevated sprites would require 6 sprites each (=24 additional sprites).

Graphically, this would lead to endless possibilities. And if a certain curve doens't exist, the game simply ignores the algorithm, so existing tile sets could still look as they do today.

I know this would be a big project, but it would drastically increase the moddability.
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: Curved tracks

Post by Eddi »

i have previously drawn up a design-document which decisions a newgrf would have to make, assuming each half-rail gets drawn individually. from there it's "just" a combinatorial explosion to draw the combined rail bits. openttd would only have to provide VarAction2 variables for the adjacent track bits, everything else could be done in NewGRF.

the combination of the sprites can be done in the Makefile for the GRF (i think OpenGFX+ does that for wagon+cargo sprites), not much copy-pasting needed.
Bad_Brett wrote:Secondly, I want to make longer engines using a different method. Previously, the engines were either long and stiff or simply divided into two sprites. I wonder if it's possible to create a NewGRF using 2-3 sprites, where the one in the middle overlaps the first and the last:
trans2.png
Of course, this will look a bit weird in motion, but I think it may turn out better than the usual methods.
this has two problems, first is, at TTD-Scale, a turning bogey would be really hard to see, and second, if two vehicles overlap, you have no chance of defining which vehicle will be drawn first, so you will get graphical glitches which you cannot solve.

my current solution is to just offer more turning states:
https://dev.openttdcoop.org/attachments ... t_1922.png

each of the 4 TTD-direction gets two intermediate turning views, one for turning left and one for turning right. you can add some visual turning state of the wheel bogies, if you find you have enough pixels.
Image
User avatar
Chris
Tycoon
Tycoon
Posts: 1985
Joined: 05 Oct 2009 16:36
Location: Leeds, UK

Re: Curved tracks

Post by Chris »

Bad_Brett wrote:As you may, or may not know, I've been trying to do a work-around to get curved railway tracks (It's a really dirty solution by using overlapping tiles).
Why do we need curved tracks? It would completely change the feel of OpenTTD and it would no longer be a clone of TTD. If you want better/more realistic graphics then play Cities in Motion, Locomotion or other.
Screenshots

Formerly Class 165
broodje
Director
Director
Posts: 615
Joined: 13 Jul 2003 12:47
Location: Alphen aan den Rijn
Contact:

Re: Curved tracks

Post by broodje »

You can argue against any development that way. If you want to play ttd you should play ttd, not OpenTTD...
User avatar
Chris
Tycoon
Tycoon
Posts: 1985
Joined: 05 Oct 2009 16:36
Location: Leeds, UK

Re: Curved tracks

Post by Chris »

broodje wrote:You can argue against any development that way. If you want to play ttd you should play ttd, not OpenTTD...
Obviously you can, but such a major change in the graphics of including 'proper' curves changes the 'feel' of the game. At the moment, even with all of the features added since TTO anybody can still see that it is essentially the same game, whereas with the inclusion of curvy tracks etc., the look of the game is changed dramatically (for little gameplay value).
Screenshots

Formerly Class 165
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Curved tracks

Post by FooBar »

I think this can be implemented in a way that it's optional. If it ever gets implemented.

I see the benefit of this for 32bpp extra zoom sprites. It just looks better without changing gameplay in any way. For 8bpp sprites it's probably not worth the effort, unless someone somehow invents 8bpp extra zoom sprites :)
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Curved tracks

Post by planetmaker »

FooBar wrote:unless someone somehow invents 8bpp extra zoom sprites :)
If we get extra zoom sprites, we should get it for 8bpp and 32bpp alike.
Bad_Brett
Transport Coordinator
Transport Coordinator
Posts: 355
Joined: 01 Feb 2007 17:59
Location: Stockholm, Sweden

Re: Curved tracks

Post by Bad_Brett »

Eddi wrote:i have previously drawn up a design-document
my current solution is to just offer more turning states:
Woooaaah! I know I requested this some time ago, so I had stopped hoping. This changes everything. Can you imagine this solution + extra zoom levels + curved tracks? It would look incredible! I'm amazed.
Class 165 wrote: Why do we need curved tracks? It would completely change the feel of OpenTTD and it would no longer be a clone of TTD. If you want better/more realistic graphics then play Cities in Motion, Locomotion or other.
I really don't get this. The reason I spend countless hours working on my OpenTTD mod is because I love the game. I have no interest in Locomotion. I'm not trying to change the core game. I'm just trying to be creative.
User avatar
kamnet
Moderator
Moderator
Posts: 8582
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Curved tracks

Post by kamnet »

Class 165 wrote:
Bad_Brett wrote:As you may, or may not know, I've been trying to do a work-around to get curved railway tracks (It's a really dirty solution by using overlapping tiles).
Why do we need curved tracks? It would completely change the feel of OpenTTD and it would no longer be a clone of TTD. If you want better/more realistic graphics then play Cities in Motion, Locomotion or other.
There's a lot of things that OpenTTD now does which has completely changed the "feel" of TTD, and for the better. If this can continue that trend of making the game better, then I am for it. You're seriously going to gripe about trains making a curved 45-degree turn instead of a sharp 45-degree turn? I suppose you also argue about whether or not engines should display animated smoke or which way the sun shines on a particular set of vehicles?
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Re: Curved tracks

Post by peter1138 »

FooBar wrote:I see the benefit of this for 32bpp extra zoom sprites. It just looks better without changing gameplay in any way. For 8bpp sprites it's probably not worth the effort, unless someone somehow invents 8bpp extra zoom sprites :)
Yeah, sure... http://fuzzle.org/~petern/ottd/8bpp-ez.png
He's like, some kind of OpenTTD developer.
TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Curved tracks

Post by TadeuszD »

kamnet wrote:There's a lot of things that OpenTTD now does which has completely changed the "feel" of TTD, and for the better.
The "better" is debatable... :roll:
In my opinion, the better way is improving OTTD performance and making it more playable (new means of transportation, largest maps, thousands vehicles on the map, hundreds NewGRFs to choice...).
The graphics in OTTD will be allways simplified and schematic, unless the game will be converted to using full 3D engine. But it would be no longer a clone of TTD... The semi-solutions, like 32bpp blitter, EZ and curved tracks only decreases OTTD performance, but don't add interesting new features, increased OTTD playability. :|
Last edited by TadeuszD on 13 Jan 2012 12:03, edited 1 time in total.
Image
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: Curved tracks

Post by AndersI »

But it might increase enjoy-ability - which is not a worthless goal...
User avatar
SwissFan91
Tycoon
Tycoon
Posts: 2395
Joined: 08 Feb 2009 18:36
Location: Alberta, Canada

Re: Curved tracks

Post by SwissFan91 »

I'd say go for it, Bad_Brett. People can complain about it changing OTTD until the cows come home, but I'm fairly confident that they won't be forced into using these curves. Yes, the screenshot in the first post looks nothing like OTTD, but I'm sure once you play it with the GUI and start sending trains around, you'll realise the amount of work done and the real potential of OTTD.

I'm sure nobody is suggesting make curved tracks a permanent fixture. It sounds a bit like saying, 4 or 5 years ago, 'Oh I don't like the idea of being able to build canals, it takes away from the feel of TTD'.
Total Alpine Replacement Set: Industry, Town, Objects
User avatar
Chris
Tycoon
Tycoon
Posts: 1985
Joined: 05 Oct 2009 16:36
Location: Leeds, UK

Re: Curved tracks

Post by Chris »

kamnet wrote:There's a lot of things that OpenTTD now does which has completely changed the "feel" of TTD, and for the better. If this can continue that trend of making the game better, then I am for it. You're seriously going to gripe about trains making a curved 45-degree turn instead of a sharp 45-degree turn? I suppose you also argue about whether or not engines should display animated smoke or which way the sun shines on a particular set of vehicles?
SwissFan91 wrote:I'd say go for it, Bad_Brett. People can complain about it changing OTTD until the cows come home, but I'm fairly confident that they won't be forced into using these curves. Yes, the screenshot in the first post looks nothing like OTTD, but I'm sure once you play it with the GUI and start sending trains around, you'll realise the amount of work done and the real potential of OTTD.

I'm sure nobody is suggesting make curved tracks a permanent fixture. It sounds a bit like saying, 4 or 5 years ago, 'Oh I don't like the idea of being able to build canals, it takes away from the feel of TTD'.
Things such as canals, trams, path signals, one way signals and smoke etc. are nice features which look nice and/or make the gameplay better, and also are still in the style of TTO - when you look at them you can say that they are from a TT based game, whereas things such as curved tracks and suchlike do not look or feel like they are part of any TT game, and so would make OTTD something else (which may of course be better in other people's opinions).

I would just like to clarify my position on this - in my opinion a curved track feature wouldn't fit with OpenTTD as the graphics of OTTD just aren't in that style. This doesn't mean that I am against the development of such a feature - obviously the game is open source and if someone, as does Bad_Brett, feels that curved tracks would make the game better and more enjoyable then its great :) . Its good that people are so creative and modify the game so much as without such people we wouldn't have OTTD (or TTDP) here today. I didn't mean to come across as grumpy :P , I guess the saying that if you don't have anything good to say then don't say anything is quite appropriate for me here.
Screenshots

Formerly Class 165
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Curved tracks

Post by FooBar »

I guess we better change the tram tracks then to not have curves... ;)
Spaz O Mataz
Engineer
Engineer
Posts: 52
Joined: 08 Mar 2004 21:14
Location: Sunderland UK

Re: Curved tracks

Post by Spaz O Mataz »

TadeuszD wrote:
kamnet wrote: The graphics in OTTD will be allways simplified and schematic, unless the game will be converted to using full 3D engine. But it would be no longer a clone of TTD...
I guess you never played Transport Tycoon on the Playstation.

TadeuszD
Transport Coordinator
Transport Coordinator
Posts: 329
Joined: 07 Nov 2011 19:32
Location: PL

Re: Curved tracks

Post by TadeuszD »

Spaz O Mataz wrote:I guess you never played Transport Tycoon on the Playstation.
I was thinking about something different, than simple transformation 2D sprites to 3D objects. :wink:
Image
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 21 guests