Object on Object

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
luxtram
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 10 May 2016 19:09

Object on Object

Post by luxtram »

I am continuing the discussion started under graphic development viewtopic.php?p=1176269#p1176269.

How feasible would it be to include a possibility for objects to accept other objects, including standard game objects like roads, on top of them with defined height (must be a multiple of actual height differences between levels) while allowing other objects, but especially roads, below them?

Main use case I have in mind is possibility to create an elevated transit system on top of existing roads, but this idea could work for other concepts like viaducts, metro etc.
ElevatedTransit.png
ElevatedTransit.png (68.06 KiB) Viewed 1970 times
Other similar concept I have in mind is stacking objects to combine them. For example I start with the back of the fence sprite, then add tree and then front of the fence.
California City Sets viewtopic.php?t=76786
1000 building set viewtopic.php?t=75250
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Object on Object

Post by Alberth »

Depending on how much effort you're willing to spend, from not very to trivial feasible.

In the general case, you'll end up with layers of traffic above each other, eg a road layer and on top of that a track layer, etc.
In the current map array, there is room for 1 layer only. Sure you may have hills, but only one layer of traffic. Tunnels and bridges don't count, as they are fake.

If you introduce elevated tracks by means of a height offset 'hack', it won't be long until a non-suspecting player wants to cross under those tracks. I don't think you can explain why you can't do that, since the graphics fully suggest it's possible.


The only useful way out, in my view, is to introduce multi-level traffic in general. Change the map array such that you can have as many layers as you like. At that point, your idea is obsolete, as the current newgrf would be able to handle it. In addition, you can do a whole lot of other things as well, such as subway systems, or signals on tunnels and bridges, although I believe that should not be added, the game is more challenging if tunnels and bridges don't have signal capacity. It may be impossible to prevent that though :p
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
Kalen
Traffic Manager
Traffic Manager
Posts: 160
Joined: 07 Jun 2008 22:07
Location: Portugal

Re: Object on Object

Post by Kalen »

Alberth wrote:Tunnels and bridges don't count, as they are fake.
What about freeform bridges which can be placed the same way as one places, say, tram tracks on top of either clear ground or existing road/track? Is that even remotely a realistic possibility? That would at least give us curves, though it still wouldn't do anything about slopes.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Object on Object

Post by Alberth »

Kalen wrote:What about freeform bridges which can be placed the same way as one places, say, tram tracks on top of either clear ground or existing road/track? Is that even remotely a realistic possibility? That would at least give us curves, though it still wouldn't do anything about slopes.
Bridges don't exist, only the entry and exit tile exist. You find the exit from the entry by continuing to move in the same direction as the entry indicates, until you hit the exit tile. Add some magic to add graphics along that stretch of tiles, and everybody believes there is a bridge, while in reality there is only empty sky above ground tiles, and a flying train without wings. The transparent bridges setting shows pretty well what really exists :)


Making a turn or going up or down cannot be done, as you break the "continue moving in same direction until you hit the exit tile" code. Unless you know a simple recipe to find the other end from one side of course, but so far nobody came up with anything else, afaik.
Being a retired OpenTTD developer does not mean I know what I am doing.
luxtram
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 10 May 2016 19:09

Re: Object on Object

Post by luxtram »

Alberth wrote:Making a turn or going up or down cannot be done, as you break the "continue moving in same direction until you hit the exit tile" code. Unless you know a simple recipe to find the other end from one side of course, but so far nobody came up with anything else, afaik.
Which files are related to the bridge travel and travel on regular roads?
California City Sets viewtopic.php?t=76786
1000 building set viewtopic.php?t=75250
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Object on Object

Post by Alberth »

luxtram wrote:Which files are related to the bridge travel and travel on regular roads?
I have no idea, I cannot remember what's where in 300K lines of code especially if I never looked it up before. My usual strategy is to checkout a copy, and search for the point I am interested in.

I think the main entry point for you is from road vehicle, as that's the thing that is moving. That would suggest some roadveh_* file.
Being a retired OpenTTD developer does not mean I know what I am doing.
luxtram
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 10 May 2016 19:09

Re: Object on Object

Post by luxtram »

Alberth wrote:
luxtram wrote:Which files are related to the bridge travel and travel on regular roads?
I have no idea, I cannot remember what's where in 300K lines of code especially if I never looked it up before. My usual strategy is to checkout a copy, and search for the point I am interested in.

I think the main entry point for you is from road vehicle, as that's the thing that is moving. That would suggest some roadveh_* file.
Thanks! Found it. Most of the related code is in the roadveh_cmd.cpp and tunnelbridge_cmd.cpp. I'll have a look.
California City Sets viewtopic.php?t=76786
1000 building set viewtopic.php?t=75250
maquinista
Tycoon
Tycoon
Posts: 1828
Joined: 10 Jul 2006 00:43
Location: Spain

Re: Object on Object

Post by maquinista »

luxtram wrote:I am continuing the discussion started under graphic development viewtopic.php?p=1176269#p1176269.

How feasible would it be to include a possibility for objects to accept other objects, including standard game objects like roads, on top of them with defined height (must be a multiple of actual height differences between levels) while allowing other objects, but especially roads, below them?

Main use case I have in mind is possibility to create an elevated transit system on top of existing roads, but this idea could work for other concepts like viaducts, metro etc.

ElevatedTransit.png

Other similar concept I have in mind is stacking objects to combine them. For example I start with the back of the fence sprite, then add tree and then front of the fence.
Maybe you are suggesting a Locomotion style game:
viewtopic.php?f=30&t=75019
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
luxtram
Transport Coordinator
Transport Coordinator
Posts: 344
Joined: 10 May 2016 19:09

Re: Object on Object

Post by luxtram »

maquinista wrote:Maybe you are suggesting a Locomotion style game:
viewtopic.php?f=30&t=75019
Well, it would not say that. But it is matter of branding.

What I would in fact like to have are

a) more elevation options,
b.1) bridges that turn as viaducts
b.2) bridges that turn as overhead traffic,
c) bridges over houses,
d) subways.
California City Sets viewtopic.php?t=76786
1000 building set viewtopic.php?t=75250
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 22 guests