New map features

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

User avatar
Quast65
Tycoon
Tycoon
Posts: 2663
Joined: 09 Oct 2011 13:51
Location: The Netherlands

Re: New map features

Post by Quast65 »

Firstly: :bow: :bow: :bow: :bow: :bow: :bow: :bow: :bow: :bow: :bow: :bow:

*wipes drool of keyboard...

Now back to business:
So, if I understand correctly, the possibility of bridges being built over custom station tiles depends on the Z-extent of the boundingbox of the station?
If so, what is the max hight of that Z-extent?

Reason I ask is because I am going to do a major overhaul of the boundingboxes of the Dutch Station Addition Set, as I have made some mistakes with those. :oops:
Then I can take in account what tiles I would allow a bridge over and what tiles not.
Projects: http://www.tt-forums.net/viewtopic.php?f=26&t=57266
Screenshots: http://www.tt-forums.net/viewtopic.php?f=47&t=56959
Scenario of The Netherlands: viewtopic.php?f=60&t=87604

Winner of the following screenshot competitions:
sep 2012, jan 2013, apr 2013, aug 2013, mar 2014, mar 2016, oct 2020
All my work is released under GPL-license (either V2 or V3), if not clearly stated otherwise.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

Quast65 wrote:So, if I understand correctly, the possibility of bridges being built over custom station tiles depends on the Z-extent of the boundingbox of the station?
If so, what is the max hight of that Z-extent?
I found the Z-extent reference in Stations Action0 Property 09 Sprite Layout.
This does not mean that Cirdan would use this in his code.
I suggest experimenting with your station tiles to see how this affects your bounding boxes. Whether or not Cirdan references it, it wouldn't hurt to have it anyways. Probably use the same values as are used for bridges over newobjects.
Last edited by wallyweb on 28 Feb 2016 12:25, edited 1 time in total.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: New map features

Post by HackaLittleBit »

wallyweb wrote:
HackaLittleBit wrote:The patch is just for Cirdan to see what I did.
That explains it then. I'll wait while you and Cirdan work your magic.
Magic? Not from me.
Cirdan, yes. and many others.
Testing is the most important now.
Quast65 wrote: Reason I ask is because I am going to do a major overhaul of the boundingboxes of the Dutch Station Addition Set, as I have made some mistakes with those. :oops:
Then I can take in account what tiles I would allow a bridge over and what tiles not.
Well I just did some further testing and building bridges over stations or building stations under bridges, is only possible if you keep track of the bounding box of the graphics.
See pic.
Attachments
glitsch.png
glitsch.png (50.44 KiB) Viewed 2686 times
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

Just to clarify, bridges do not detect z-extent of another sprite, be it station, object or whatever.
I do not know if bridges can be made to do this. It would be convenient if they could.
For objects, it is a property of the object as to whether a bridge over it is allowed.
If allowed by the object, then it is a property of the object as to the minimum height of the bridge over it.
Cirdan seems to have ported these object properties to RV stations, but they are internally coded and are not accessible via GRF Specification.
They are not (yet) ported to rail stations. HackaLittleBit has worked up some suggestions.
Did I miss anything?
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

wallyweb wrote:By the way, if one counts the slope above sea level, a bridge over docks is actually a minimum two levels high. :wink:
Yes, it is one level high on the "slope" part and two levels high on the "water" part. On the other hand, for dock buoys, it is just one level high. (I do not quite like having a bridge right over a buoy, as the buoy is then completely hidden, but the possibility is there if you want it.)

By the way, I have just realised that I forgot to allow bridges over normal buoys. Expect it to happen in next version, or when I finally merge this.
HackaLittleBit wrote:I have a solution for you if you don't mind.
Use the function 'CanStationTileHavePylons'.(maybe rename it in IsRooflessStationTile)
Thanks for the suggestion—I will take a look at it.
wallyweb wrote:By the way, I was about to suggest to Cirdan to allow bridges of between height levels two and three until I saw your screenshot of the arched roof and I realized that bridge pillars would be a problem graphically. Your suggestion to restrict the bridge to only over low platforms would be ideal. Hopefully you and Cirdan can make it work. :)
Good point. I had thought of allowing bridges over rail stations if they were high enough, but the pillars would certainly be an issue.
Quast65 wrote:So, if I understand correctly, the possibility of bridges being built over custom station tiles depends on the Z-extent of the boundingbox of the station?
If so, what is the max hight of that Z-extent?
Well, currently you cannot build bridges over any rail station tile—the code just does not handle this. I did have in mind to allow it in the future depending on the height of the sprites, but wallyweb has raised a very good point here: even if the bridge surface stays clear above the building, there may be glitches with the pillars. So we need something better. HackaLittleBit's suggestion of using CanStationTileHavePylons looks good for a start, but may be overly restrictive: As the NewGRF author, you may decide to explicitly allow bridges over some of your station tiles, perhaps because they are a solid building and it makes sense to have the pillars rest on its roof.
wallyweb wrote:Did I miss anything?
No, as far as I can tell. Your post pretty much summarises the current situation.

I see several steps that can be taken forward: First, we can allow bridges over the standard non-roof rail station tiles, and disallow them over anything else. Second, we can allow bridges over any rail station tile that can have pylons, as per HackaLittleBit's suggestion, and see how it goes. Last, we can introduce a new property for NewGRFs authors to decide whether to allow bridges or not.

There are two very good things about all this: we are only dealing with graphical issues and the savegame format is not changed. This means that, whatever we do, we can always roll back to a previous state and nobody will lose their games.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

cirdan wrote:Last, we can introduce a new property for NewGRFs authors to decide whether to allow bridges or not.
Roads are not a feature (yet) with respect to NewGRF Specifications. How about switches in the Settings window?
"Allow bridges over RV depots, stations and stops" - Default = No
"Allow bridges over rail depots, station platforms and waypoints" - Default = No
"Allow bridges over ship depots, docks, docking buoys and navigation buoys" - Default = No
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: New map features

Post by HackaLittleBit »

wallyweb wrote: Did I miss anything?
When you build a bridge it must be possible to investigate the height of the bounding box of the sprite below it.
Otherwise it would not be possible to draw them as in the foto of my previous post.(duno how it's done)
When you build something below a bridge you can also know if there is a bridge above (HasBridgeAbove proc).
Then you could search in two directions to find the start tile of the bridge.(to find out height).

@Cirdan

After some further investigations, here some more info.
In may be that m5 of the tile array is used to write the kind of platform that is used.
see tile_get_station_gfx procedure and newgrf_station.h line 150 statspec->tiles
Tile type Appearance
00..01 plain platform
02..03 platform with building
04..05 platform with roof, left side
06..07 platform with roof, right side

00 or 01 depending on direction platform etc.

I checked this and it works for standard graphics.

It would be nice if things were this simple.
0..1 in m5 bridge allowed one level above.(plain platform)
more than 1, bridge only 4 levels above allowed.(or not allowed to build bridge)


However I checked the things with Industrial Stations Renewal newgrf and found inconsistencies.
I do not know what kind of info is written to m5 by these newgrf's.
See also:Define custom layout (0E)
Neither was I able to find out till now.
I have to give up now, no more time. :-(

Regards
User avatar
kamnet
Moderator
Moderator
Posts: 8588
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: New map features

Post by kamnet »

Just my own two bits, I think it should be left up to the player whether or not bridges should appear over stations that have roofs, or even multiple levels.

Will it looks absolutely awful for any station with a roof that doesn't appear to support pillars? Absolutely. But think of the many NewGRF station sets which are no longer updated and will never be able to support this new flag. I think the user's convenience and personal choice should be paramount in such situations. Even if the author does implement such a flag, I think the user should decide if their style of play and design aesthetics should not be secondary to NewGRF authors whenever possible. I don't think it should be the default, but definitely make it an option for the player to determine.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: New map features

Post by HackaLittleBit »

kamnet wrote: Will it looks absolutely awful for any station with a roof that doesn't appear to support pillars? Absolutely. But think of the many NewGRF station sets which are no longer updated and will never be able to support this new flag. I think the user's convenience and personal choice should be paramount in such situations
Fair enough.
It is easy to change the station layout if a big station building is not in the right place.
An option to allow building through covered station tiles is not a bad solution.(disallowed by default)
So the height of the bridge can be only one tile in that situation.
The player is responsible for adjusting the station layout.
It is however impossible to choose a plain platform tile if no newgrf's are loaded.
By default a platform tile with building is chosen.(see MakeRailStation layout & ~1)
Makes me wonder why different parts of a default stations don't show up in that right selection screen.(Uniform behaviour)
That must have a reason.
Image
Attachments
s1.png
s1.png (125.2 KiB) Viewed 600 times
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

Caveat Emptor - Buyer beware:
Allow bridge building at any level.
It's an engineering issue. If the player feels that a bridge over a station will conflict with platform artifacts, then that player can always build a higher bridge or reroute the bridge to a more optimal location or change the platform. The question is should the game decide/control choice? Is the player to be denied having responsibility for making a good or bad choice? I wouldn't even be concerned about those tall cranes in ISR. I am sure players will make appropriate choices and Cirdan can keep his code simple. If players complain or file bug reports, they can be politely educated that it is up to them to work out a better engineering solution.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

HackaLittleBit wrote:And AI, multiplayer?
wallyweb wrote:"Allow bridges over RV depots, stations and stops" - Default = No
"Allow bridges over rail depots, station platforms and waypoints" - Default = No
"Allow bridges over ship depots, docks, docking buoys and navigation buoys" - Default = No
Is it possible for the AI to always have Default = No even if the player chooses Yes?
For multiplayer can these be set at the server?
I do not play with AI on and I do not play multiplayer, so I do not know the answers.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: New map features

Post by HackaLittleBit »

wallyweb wrote: I do not play with AI on and I do not play multiplayer, so I do not know the answers.
Neither do I, lol
Even my use of newgrf is limited nowadays.
User avatar
Streckenläufer
Engineer
Engineer
Posts: 57
Joined: 22 Jun 2012 14:45
Location: Berlin-Germany

Re: New map features

Post by Streckenläufer »

Where the trunk is the "bridge_cmd.cpp" to patch?
MfG Streckenläufer
OpenTTD V1.7.1, r27930 - Trafficlight - Bridge/tunnel Signals - Watertunnel - HousePlacing - SeaplaneAirport - Clipboard - Win7 64bit - MinGW/msys
!Sorry for my google English translator!
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

Streckenläufer wrote:Where the trunk is the "bridge_cmd.cpp" to patch?
As far as I know it is not in trunk.
It is in the source for Cirdan's branch and you can find it in the binary I compiled and posted above.
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

wallyweb wrote:
cirdan wrote:Last, we can introduce a new property for NewGRFs authors to decide whether to allow bridges or not.
Roads are not a feature (yet) with respect to NewGRF Specifications. How about switches in the Settings window?
"Allow bridges over RV depots, stations and stops" - Default = No
"Allow bridges over rail depots, station platforms and waypoints" - Default = No
"Allow bridges over ship depots, docks, docking buoys and navigation buoys" - Default = No
I am not keen on this kind of settings... The settings list is already way overcrowded. I would rather leave this to the discretion of the user: if they dislike bridges over stations, they are free not to build them.
HackaLittleBit wrote:After some further investigations, here some more info.
Yes, these are the standard rail station tiles for the default graphics, but NewGRFs can define their own in whatever way they want, so we cannot rely on any hardcoded value.
kamnet wrote:Just my own two bits, I think it should be left up to the player whether or not bridges should appear over stations that have roofs, or even multiple levels.

Will it looks absolutely awful for any station with a roof that doesn't appear to support pillars? Absolutely. But think of the many NewGRF station sets which are no longer updated and will never be able to support this new flag. I think the user's convenience and personal choice should be paramount in such situations. Even if the author does implement such a flag, I think the user should decide if their style of play and design aesthetics should not be secondary to NewGRF authors whenever possible. I don't think it should be the default, but definitely make it an option for the player to determine.
wallyweb wrote:Caveat Emptor - Buyer beware:
Allow bridge building at any level.
It's an engineering issue. If the player feels that a bridge over a station will conflict with platform artifacts, then that player can always build a higher bridge or reroute the bridge to a more optimal location or change the platform. The question is should the game decide/control choice? Is the player to be denied having responsibility for making a good or bad choice? I wouldn't even be concerned about those tall cranes in ISR. I am sure players will make appropriate choices and Cirdan can keep his code simple. If players complain or file bug reports, they can be politely educated that it is up to them to work out a better engineering solution.
I mostly agree with you here, but not completely: If building a bridge over certain tiles causes flickering or glitches, then it becomes an issue. For instance, it might happen that a two-level-high bridge over the standard roofed station tiles makes vehicles suddenly "cross" the roof when travelling (one frame they are behind, the next one they are in front), and that is not nice.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

cirdan wrote:I mostly agree with you here, but not completely: If building a bridge over certain tiles causes flickering or glitches, then it becomes an issue. For instance, it might happen that a two-level-high bridge over the standard roofed station tiles makes vehicles suddenly "cross" the roof when travelling (one frame they are behind, the next one they are in front), and that is not nice.
Would this occur if the bridge deck is above the highest part of the station roof? Or would it only occur if the bridge deck penetrates the station roof?
We have three considerations:
1. Default stations in the two base graphic sets (OpenGFX; TTDX)
2. Existing station GRFs
3. New station GRFs.
For #3, Action0 properties can be added (Allow bridge and Set bridge height). If an Action0 property is not specified in a GRF's code, it is ignored and the default is No so #1 and #2 would not be affected if these properties do not appear in their respective Action0s.
For #1 and #2, set a default two level bridge height, but then the question is how to detect a platform's height so that there is no bridging of taller (roofed) platforms.
Some additional Default station thoughts:
- The roof only appears when a minimum 2x2 station is built.
- A 1 tile long roofed platform can be overbuilt with a 1 tile long unroofed platform.
- Can a bridge force the replacement of a 1 tile long roofed platform with a 1 tile long unroofed platform?
User avatar
kamnet
Moderator
Moderator
Posts: 8588
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: New map features

Post by kamnet »

I agree that it isn't nice, but in a given situation it may be unavoidable given the choices the player makes. Which is why I suggested not making this the default, but informing the user of the issues and allowing them to choose to enable it anyhow. Flickering isn't going to crash somebody's game or make a save unplayable.
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

wallyweb wrote:Would this occur if the bridge deck is above the highest part of the station roof? Or would it only occur if the bridge deck penetrates the station roof?
As far as I can see, this particular issue could only happen if the bridge deck is below any part of the station. If it is above, then you may get ugliness with the pillars, but nothing else.
wallyweb wrote:We have three considerations:
1. Default stations in the two base graphic sets (OpenGFX; TTDX)
2. Existing station GRFs
3. New station GRFs.
For #3, Action0 properties can be added (Allow bridge and Set bridge height). If an Action0 property is not specified in a GRF's code, it is ignored and the default is No so #1 and #2 would not be affected if these properties do not appear in their respective Action0s.
For #1 and #2, set a default two level bridge height, but then the question is how to detect a platform's height so that there is no bridging of taller (roofed) platforms.
#1 is easy to deal with—there are only a few default station tiles, and their appearance is hardcoded, so we know what to allow and what not to. #2 is the real issue, and I am afraid that we will have to take a conservative approach and disallow bridges over any roofed tile, following HackaLittleBit's suggestion of using the pylon check for that. As for #3, I would rather have some additional testing before extending the NewGRF spec for this.
kamnet wrote:I agree that it isn't nice, but in a given situation it may be unavoidable given the choices the player makes. Which is why I suggested not making this the default, but informing the user of the issues and allowing them to choose to enable it anyhow. Flickering isn't going to crash somebody's game or make a save unplayable.
Alternatively, we can also tell users not to use a tall rail station tile under a bridge? It is not as if the particular station tile choice has any impact on gameplay, right? Is there any NewGRF out there that only offers roofed tiles?
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: New map features

Post by Eddi »

I would really like this to be done properly with a NewGRF property similar to bridge height for objects.

this means, any existing NewGRF stations would be excluded from having bridges over them. relying on the fallback graphics type is not reliable, and any hacks involving sprite height or stuff are nonsense.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 40 guests