BK Enhanced Tunnel Set v1.2 (9-April-2011) [update]

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

User avatar
Ben_K
Tycoon
Tycoon
Posts: 1166
Joined: 01 Jun 2006 15:15
Location: Sydney, AUS

Post by Ben_K »

Knedle, I guess you mean on the area opposite to the tunnel entrance. I see what you mean, a nice idea however, what about when you build a track across and also 2 45 degree angles? I think it will be a bit crowded on the tile then. I'll have a play about and see if something works.

As for the grass in urban areas. I know as Ive thought this myself. Personally, I would like to be able to plant trees on it. That would be a nice way of sorting it... no way of doing it as far as Im aware though (At the moment, at least).
User avatar
WWTBAM
Moderator
Moderator
Posts: 3689
Joined: 02 Apr 2005 07:01
Location: Sydney NSW Antipodea
Contact:

Post by WWTBAM »

How about a small cottage that could be seen as a cottage and then when rail is built on it, it could be seen as a railway building. That could even make some form of ballast possible to believe as it could be imagined to be something when the building is just a cottage.
Formerly known as r0b0t_b0y2003, robotboy, roboboy and beclawat. The best place to get the most recent nightly builds of TTDPatch is: http://roboboy.users.tt-forums.net/TTDPatch/nightlies/
User avatar
Raichase
Moderizzle
Moderizzle
Posts: 11509
Joined: 15 Dec 2002 00:58
Location: Sydney, Australia. Usually at work in the underground railway station...
Contact:

Post by Raichase »

robotboy wrote:a railway building.
That would be too hard to do right, as the diagonals leave the tile from the centre, and the straight track leaves from centres of tiles too. With all possibilities to account for, when there is no track on it, it would still be mostly grass.
Posted by Raichase. Visit my Flickr! Gallery, Blog (get a feed of everyone at once at Planet TT-Forums).
Raichase - Perfect timing, all the time: [13:37] * Now talking in #tycoon
ImageImage
Official TT-Dave Worley Fan Club
Official TT-Andel-in-a-pink-hat Fan Club
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

[additional tunnel graphics]

All these reflections are just moot, because tunnel replacement can only be done by action0A, ATM. I.e., no dependencies on town zones, year in game, electrified track, ..., whatsoever.

On a different note, I noticed from the screenshots that the "enhancedtunnels" feature is still prone to clipping errors, a bug that was already in existence when I tried to figure out something for Oskar almost a year ago?

Personally, I don´t use "enhancetunnels", mainly because of the special mechanism how additional track is placed on top of the tunnel (w/o ballast) which doesn´t look too good, especially on snow, IMO.

I should, however, add my ancient stuff to the DBXL, the same way like it was done with gates, preferably with the aforementioned flaws removed.

Oskar? 8)

regards
Michael
Image
User avatar
Ben_K
Tycoon
Tycoon
Posts: 1166
Joined: 01 Jun 2006 15:15
Location: Sydney, AUS

Post by Ben_K »

ermmm........ eh? :?
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Well, the clipping errors was quite less (only a bit problems with wires), but JGR changed the code to allow crossings on enhancetunnels, this could again screw up things. Ask JGR about it... As reference to look about clipping errors you need to use basetunnels as they are specially constructed to make less errors.

Guideline:
Action0 replacements should exactly use a full normal sprite size for the top part, and not only do a part as the TTD tunnels do.

PS: don't forget a grfcrawler entry...
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
Ameecher
Tycoon
Tycoon
Posts: 11919
Joined: 12 Aug 2006 15:39
Contact:

Post by Ameecher »

I don't quite follow this discussion, is this relevant to how I have coded the tunnels and if so how should I code them differently?

Also a GRFCrawler has been available ever since the .grf has been made publicly available and can be found here.
Image
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

Ameecher wrote:I don't quite follow this discussion, is this relevant to how I have coded the tunnels and if so how should I code them differently?
Yes and no. 8)

You used action0A (simple sprite replacement) which doesn´t give you the possibilities a full-fledged action0/1/2/3 system for tunnels would have offered. But because ATM we don´t have such a system, you couldn´t have them coded differently.

If, OTOH, we had such a system, not only the clipping problems would be far more less obvious, but everything mentioned in the posts before would be feasible (tunnel graphics depending on game-related variables).

regards
Michael
Image
User avatar
Ameecher
Tycoon
Tycoon
Posts: 11919
Joined: 12 Aug 2006 15:39
Contact:

Post by Ameecher »

Thank you for clarifying that for me Michael, I've got to learn to do NFO to get these to appear in other climates before I even consider other Actions 8)
Image
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

michael blunck wrote:
Ameecher wrote:I don't quite follow this discussion, is this relevant to how I have coded the tunnels and if so how should I code them differently?
Yes and no. 8)

You used action0A (simple sprite replacement) which doesn´t give you the possibilities a full-fledged action0/1/2/3 system for tunnels would have offered. But because ATM we don´t have such a system, you couldn´t have them coded differently.

If, OTOH, we had such a system, not only the clipping problems would be far more less obvious, but everything mentioned in the posts before would be feasible (tunnel graphics depending on game-related variables).

regards
Michael
Wrong, an Action321 support doesn't auto fix clipping errors - Bridges have as well clipping errors since TT and an Action321 will not magical fix sorting problems you have with all Structures and Sprites in TTD. * Sorting 2D Sprites without deep information isn't possible to sort correct in a 3D world...

Maybe I say it different, the top part of an tunnel you have replaced with an Action A should be the same pixel size as a sloped ground tile. The ground tile of the tunnel should be the same size as a the top tile sprite or smaller. This should avoid most clipping errors, as now sorting happens from bottom to top regardless on what part a train is on the tile...

Or try to simple load my base tunnels and enable/disable it to see if your own tunnel has more clipping errors then my base tunnels.

-edit-
changed groundtile to the top tile sprite

-edit2-
Nitpicker's corner.

Even with an Action321 system you still need to glue a lot sprites for enhancetunnels together. The ground sprite, catenary pole for tunnel entrance, a tunnel top sprite, route sprite (this can be added to the tunnel top sprite with Action321 maybe) The catenary pole, the catenary helper sprite. The wire. Ohh, we didn't have yet some rolling stock. Add them as well...

Even if you get this all work, this won't fix issues that a big engine will be seen outside the tile sometimes.
Last edited by eis_os on 28 May 2007 15:09, edited 1 time in total.
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

[clipping, enhancedtunnels]
eis_os wrote:Wrong, an Action321 support doesn't auto fix clipping errors [...]
Yes, you´re right and I was talking incomprehensibly.

What I meant is that we don´t have any influence on clipping when only using action0A, because then we have to rely on the "pre-defined" clipping data for that original sprite we´re exchanging.

OTOH, if we had a proper action0/1/2/3 system (i.e. such that we have for stations) we could explicitly pass correct x/y/z dimensions to the sorter. O/c this doesn´t mean that there will be no clipping errors at all (the current, already improved sorter is still buggy) but we´d have a far better chance to experiment to avoid clipping errors, like I already did when designing stations.

With regards to enhancedtunnels, I´m not sure whether your advice would help because the clipping error I was refering to seems to show only when building a slope sprite adjacent to an enhanced tunnel entry. Check the screenshots in this thread and you´ll see what I mean.

regards
Michael
Attachments
clipping.png
clipping.png (13.62 KiB) Viewed 5350 times
Last edited by michael blunck on 28 May 2007 15:18, edited 1 time in total.
Image
User avatar
Ameecher
Tycoon
Tycoon
Posts: 11919
Joined: 12 Aug 2006 15:39
Contact:

Post by Ameecher »

michael blunck wrote:[clipping, enhancedtunnels]

With regards to enhancedtunnels, I´m not sure whether your advice would help because the clipping error I was refering to seems to show only when building a slope sprite adjacent to an enhanced tunnel entry. Check the screenshots in this thread and you´ll see what I mean.
I think that is actually due to me not aligning the sprites properly and that they should be realigned which will probably happen when the other climates are supported.
Image
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

[on clipping]
Ameecher wrote: I think that is actually due to me not aligning the sprites properly [...]
No, not at all. I had the same problems in my late experiments with enhancedtunnels, see the detail from Rob´s screenshot attached to my previous post.

regards
Michael
Image
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

No, you can't sort against the physical law as well, a tunnel entrance in TTD is to low to fit an engine into it. So proper XYZ coordinates won't help much. Btw. Why do you think internal enhance tunnels don't use proper 3D coordinates?

http://svn.ttdpatch.net/trac/browser/tr ... g.asm#L173

So in 3D Space this would mean a plane on top of a tunnel with the height of one TTD unit. (Means a top part for TTD looks 3D like this: 16x16, at altitude 7 and is one unit in height.)

There are still problems in the catenary code as the code is quite bad in guessing the right placement so it does a lot clip problems. If you use more DB Steam engines without catenary it looks quite nice :)

It's true, with an Action321 support you could make more smooth transitions between buildonslopes and other nice stuff like double entrances.
Still some stuff will sort wrong still, actually if something gets redrawn, the TTD screen gets only partial redrawn and this can result in problems like this. Only parts get sorted. Buildonslopes have their 3D Problems anyway. The only thing you can do, create clever sprites. You could as well make a screenshot with basetunnels...
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

eis_os wrote:[...] a tunnel entrance in TTD is to low to fit an engine into it. So proper XYZ coordinates won't help much.
Well, I´m not talking about clipping errors with regards to height. But let´s see ...
You could as well make a screenshot with basetunnels...
I´ve tried the same with your .grf and indeed it doesn´t display that particular clipping error. By inspecting the sprites of your .grf (hehe 8) ) I noticed a detail which you mentioned here:
the top part of an tunnel you have replaced with an Action A should be the same pixel size as a sloped ground tile. The ground tile of the tunnel should be the same size as a the top tile sprite or smaller.
See attachment 1.

I´ve been always using the "cut-down version" with my own tunnel entries and it displays that particular clipping error. Yours does not, although the cut-down version´s "ground tile" is indeed "smaller" than the top tile?

However, it seems to be important that the top tile spans a whole sloped tile, not part of it. Could you please explain how this influences the sorter?


BTW, there seems to be still another small misalignment in your basetunnels .grf, see attachment 2.

regards
Michael
Attachments
SCR526.png
SCR526.png (3.44 KiB) Viewed 5311 times
basetun.png
basetun.png (2.34 KiB) Viewed 5308 times
Image
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Yes, I try to do the best to explain it.

Warning: 3D/2D TTD theory follows.

TTD Draws tiles by two passes. One thing is the Ground Sprite Drawing. (A reason I make a difference in sprite terms) When TTD needs to redraw tiles, it draws the ground sprite. It has no 3D Bounding box, it has only an XYZ and is drawn from top right to bottom left for each tile you see. * There is no sorting done. So all stuff that is outside a tile will get sooner or later overdrawn and you see clip problems. As this drawing has no 3D Box it doesn't get redrawn when say, the nearby tile gets redrawn. A Ground Sprite can't have 3D Structures on it. They won't work, there is no sorting. You can't predict in what order parts (Groundsprites) get redrawn.


Back to tunnels, we need to draw an engine maybe.

Now the Helper and Top Sprite is drawn. When this top sprite is now smaller then the Ground Sprite we have a special case, the Ground Sprite needs to be redrawn and the engine, but the top sprite is not needed as the sorter thinks, hey, thats smaller and outside the redraw box, I don't need to draw that smaller sprite. Result you can see the engine or other parts you shouldn't see. (The nearby tile slope graphics) You get distortion. = Bad. ( A reason I injected the helper sprite is to fool the sprite sorter to have the right z so we can actually draw a vehicle and rail on top, without worrying about the top part size to much.)

Now if you have an engine on top of the top sprite running you get a special case again:

The top sprite needs to be redrawn or not. (As the 3D Bounding box of the engine may not be 100% correct, as well the engine/wagon doesn't need to trigger a full redraw).
Again the result is flickering, as the engine is outside of the smaller sprite, it may even happen that it sometimes overwrites the top engine with the top sprite, or the wire code will result in a (partial-)redrawn and triggers this. All these cases are problematical because TTD redraws screen parts in 2D Space so you see your stuff cut in 2D Space. (Otherwise you would again need a full redrawn) It simply may think it doesn't need to draw some sprites.

This is different to the cuts in 3D Space, this happens on tile borders, a wagon/engine is still on a tile but already on the other with a part. (Think about Ships) If now only the other tile gets redrawn, it will get cut along a tile border but your engine doesn't get redrawn, it's not on that redrawn tile actually!)

Back to my tile. Instead trying to try to draw 3D Structures on Ground Sprites (as we know that it will never work, as ground tiles are drawn before all other stuff) we use the top part. As TTD sorts from bottom to top you can overwrite with a top tile parts that should be generally on lower 3D z without problems, as a redraw will trigger them aswell.

Now you would surely say, why do I still draw outside the tile border in my ground sprite. As generally the Top Sprite gets drawn as well, overwriting my edge with the ground sprite shouldn't matter much and getting the offsets right is much easier. The bottom right corner on the top sprite is as well important.The 3D Box should never get outside the tile, if it would, you could get problems with the next tile and it's sorting, if my sprite is outside my 3D Box, it may or may not be drawn in the right order.

The biggest visual difference you see, or better say, not see anymore is the landscape marker, as landscape markers are drawn on top of Ground Sprites, you can't see it anymore because the tile sprite is mostly a top sprite.

Can you now explain why you get the problems with buildonslopes?
We know we have only Ground Sprites without sorting. So buildonslopes need to be actually normal sprites with 3D boxes. As we learned we can't overwrite 3D box based sprites with Ground Sprites, we need to draw it in our top sprite.

Conclusion:
Never try to overwrite normal sprites with Ground Sprites, it will simple not work. You need a 3D Box based sprite that will overdraw the other sprites because they are correctly drawn. Never try to guess when a Ground Sprite gets drawn, never try to draw outside the tile borders.

Conclusion2:
If you have an engine that will travel on sprite, make the sprite as big as your tile so you can be sure it gets redrawn right and fully.

Nitpicker's corner
* What you see means as well the redraw region.

If I say engine / wagon I mean generally all vehicles and moving objects. Objects may be an animated sprite too.

All this my best knowledge about 3D 2D concepts of TTD, some parts may be not true and sometimes you need to disobey the rules to get better results.

---
I never said basetunnels are perfect, these pixels annoy me since ages, I think it's more a sprite problem then a displacement problem...
michael blunck
Tycoon
Tycoon
Posts: 5948
Joined: 27 Apr 2005 07:09
Contact:

Post by michael blunck »

eis_os wrote:TTD Draws tiles by two passes. One thing is the Ground Sprite Drawing. [...]
Ah, stupid me! I wasn´t aware that, e.g., #2365 is a flat ground tile, although it looks like a 3D tile. :?

My only excuse being that it´s really long ago when I took a look into that .grf. Indeed, the tile in question had four pixels above the slope line and o/c the corresponding top sprite missed those pixels, hehe.

Shifting those pixels from the erroneous ground sprite into the top sprites did the trick.

Thanks for clarification, Oskar.

Now, that should give me some extra time to continue on riverbanks ... 8)


[edit]
I never said basetunnels are perfect, these pixels annoy me since ages, I think it's more a sprite problem then a displacement problem...
Yes, seems so. I´ve attached a sketch of that sprite, purple pixels are unnecessary, red ones are missing ...
[/edit]

regards
Michael
Attachments
basetunnels.png
basetunnels.png (1.37 KiB) Viewed 5199 times
Image
User avatar
Ben_K
Tycoon
Tycoon
Posts: 1166
Joined: 01 Jun 2006 15:15
Location: Sydney, AUS

Post by Ben_K »

eis_os wrote:Conclusion:
...never try to draw outside the tile borders.
Which will explain the clipping that Michael showed on the BKTunnel earlier. Think we can solve this (At least for now) by a re-crop and code. :)

Unless Im missing part of that? :?
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Simple put the stuff that is outside into the Top Sprite as well, this should solve your problems as I described...
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
Ben_K
Tycoon
Tycoon
Posts: 1166
Joined: 01 Jun 2006 15:15
Location: Sydney, AUS

Post by Ben_K »

Thats what I was going to try. Thanks for giving us the heads up! :D
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Amazon [Bot], Google [Bot], Google Adsense [Bot] and 19 guests