Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Thu Nov 15, 2018 5:20 am

All times are UTC




Post new topic  Reply to topic  [ 17 posts ] 
Author Message
PostPosted: Mon Mar 27, 2017 7:58 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
Hey guys. I found this bug in graphic. I made new bus stop and rear sprite gives this bug. I know, that it is caused due long vehicle. But - is there any way how to fix it? On my new 32bpp vehicles I have invisible parts at front and rear part of the vehicle to avoid clashes. But the problem is still there. It looks like main part of the sprite has to be in" contact" with sprite - in this case sprite of bus stop - to bring vehicle above the bus stop sprite. And second part of the question - why this bug appear only at one side of bus stop? Thanks
Attachment:
bug.png [1.24 MiB]
Not downloaded yet

_________________
Image


Last edited by stefino_cz on Tue Apr 18, 2017 8:13 am, edited 1 time in total.

Top
   
PostPosted: Mon Mar 27, 2017 9:37 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
stefino_cz wrote:
It looks like main part of the sprite has to be in" contact" with sprite - in this case sprite of bus stop - to bring vehicle above the bus stop sprite. And second part of the question - why this bug appear only at one side of bus stop?

It happens, bacause OTTD is not real 3D game. The 3-rd dimension is created using sprite sorter, which determines the order of sprite drawing. Typically sprites are drawn from the farthest to the nearest.
In your two 'red' cases the bus is logically located on the further tile than the bus stop tile. It causes that the bus is drawn earlier than the bus stop.

_________________
Image


Top
   
PostPosted: Tue Mar 28, 2017 6:10 am 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 4677
Location: home
Lots of details about this in bug 119: https://bugs.openttd.org/task/119
Bottom line: It's not really fixable in the current implementation.

If you really want to fix it, I think your best shot may be with an opengl z-buffer (but no idea if it will fly), but using opengl has a s*** of problems on its own too.

_________________
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.


Top
   
PostPosted: Tue Mar 28, 2017 7:11 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
Okey :) Thanks for answers. And similar question - about tram troley. This is the same problem?
Attachment:
ottdd.jpg [598.54 KiB]
Not downloaded yet

_________________
Image


Top
   
PostPosted: Tue Mar 28, 2017 8:18 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
stefino_cz wrote:
about tram troley. This is the same problem?

Yes, it is.
Technically, you can fix some problems with described glitches by splitting long vehicle into two or more shorter vehicles with custom sprites. But it needs A LOT OF CODE to prevent other glitches, for example - when the vehicle turns.

_________________
Image


Top
   
PostPosted: Tue Mar 28, 2017 8:31 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
Yes, I understand :) I think, that it is OK and if I dont like "sprite-flashing" in case of street drawings on bus stop, I'll remove it :)

_________________
Image


Top
   
PostPosted: Tue Mar 28, 2017 3:12 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
One more question again. If I have articulated train of 3 parts for example, I define 3 parts and in the end I merge it together into one unit. But in purchase menu are these 3 parts and one final unit. How to show these 3 parts? My code here - I have long vehicles so need 2 invisible parts in front and rear part of the vehicle - due vehicle graphic clash.

Tatra T3 Single is finished without 2 invisible parts. Is here any way how to put them into exist code or I have to make new vehicle like Tatra T3 double?
Tatra T3 Double is finished but as I wrote - I have in purchase menu all 4 parts.
----------------------------------
// define the newgrf
grf {
grfid: "MI\02\02";
name: string(STR_GRF_NAME);
desc: string(STR_GRF_DESC);
version: 1;
min_compatible_version: 1;
}

template template_PLACEHOLDER () {
[0, 0, 64, 64, -32, -32]
[0, 0, 64, 64, -32, -32]
[0, 0, 64, 64, -32, -32]
[0, 0, 64, 64, -32, -32]
[0, 0, 64, 64, -32, -32]
[0, 0, 64, 64, -32, -32]
[0, 0, 64, 64, -32, -32]
[0, 0, 64, 64, -32, -32]
}

template template_tram_T3() {
//[left_x, upper_y, width, height, offset_x, offset_y]
[0, 0, 57, 114, -46, -49]
[70, 0, 140, 100, -90, -45]
[220, 0, 180, 65, -84, -43]
[405, 0, 139, 90, -65, -36]
[550, 0, 56, 111, -36, -49]
[625, 0, 139, 90, -92, -35]
[770, 0, 179, 64, -84, -37]
[960, 0, 140, 99, -67, -45]
}

//Invisible_1


spriteset(spriteset_invisible_1, "gfx/PLACEHOLDER.png") {
template_PLACEHOLDER()
}


item (FEAT_ROADVEHS, item_invisible_1) {
property {
name: string(STR_NAME_INVISIBLE_1); //název z .lng
introduction_date: date(1700,1,1);
model_life: VEHICLE_NEVER_EXPIRES;
retire_early: 0;
vehicle_life: 100;
loading_speed: 100;
cost_factor: 0;
running_cost_factor: 112;
speed: 300 km/h;
power: 966 hp;
weight: 0 ton;
length: 3;
cargo_capacity: 0;
tractive_effort_coefficient: 0.5;
air_drag_coefficient: 0;
//sound_effect: no sound
//visual_effect: use default (none)

//callback_flags: no need to set this
reliability_decay: 20;
climates_available: ALL_CLIMATES;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
sprite_id: SPRITE_ID_NEW_ROADVEH; //use custom sprites
misc_flags: bitmask(ROADVEH_FLAG_TRAM); //make this a tram
refit_cost: 0; //refits are free
running_cost_base: RUNNING_COST_ROADVEH;
}

graphics {
default: spriteset_invisible_1; // default graphic
}


}

//Invisible_2


spriteset(spriteset_invisible_2, "gfx/PLACEHOLDER.png") {
template_PLACEHOLDER()
}


item (FEAT_ROADVEHS, item_invisible_2) {
property {
name: string(STR_NAME_INVISIBLE_2); //název z .lng
introduction_date: date(1700,1,1);
model_life: VEHICLE_NEVER_EXPIRES;
retire_early: 0;
vehicle_life: 100;
loading_speed: 100;
cost_factor: 0;
running_cost_factor: 112;
speed: 300 km/h;
power: 966 hp;
weight: 0 ton;
length: 4;
cargo_capacity: 0;
tractive_effort_coefficient: 0.5;
air_drag_coefficient: 0;
//sound_effect: no sound
//visual_effect: use default (none)

//callback_flags: no need to set this
reliability_decay: 20;
climates_available: ALL_CLIMATES;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
sprite_id: SPRITE_ID_NEW_ROADVEH; //use custom sprites
misc_flags: bitmask(ROADVEH_FLAG_TRAM); //make this a tram
refit_cost: 0; //refits are free
running_cost_base: RUNNING_COST_ROADVEH;
}

graphics {
default: spriteset_invisible_2; // default graphic
}


}


//TATRA T3 Single


spriteset(spriteset_tatra_t3_default, "gfx/PLACEHOLDER.png") {
template_PLACEHOLDER()
}
alternative_sprites(spriteset_tatra_t3_default, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/tramset.png") {
template_tram_T3()
}

item (FEAT_ROADVEHS, item_tram_tatra_t3) {
property {
name: string(STR_NAME_TATRA_T3); //název z .lng
introduction_date: date(1962,1,1);
model_life: VEHICLE_NEVER_EXPIRES;
retire_early: 0;
vehicle_life: 25;
loading_speed: 25;
cost_factor: 224;
running_cost_factor: 112;
speed: 65 km/h;
power: 966 hp;
weight: 16 ton;
length: 8;
cargo_capacity: 60;
tractive_effort_coefficient: 0.5;
air_drag_coefficient: 0;
//sound_effect: no sound
//visual_effect: use default (none)

//callback_flags: no need to set this
reliability_decay: 20;
climates_available: ALL_CLIMATES;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
sprite_id: SPRITE_ID_NEW_ROADVEH; //use custom sprites
misc_flags: bitmask(ROADVEH_FLAG_TRAM); //make this a tram
refit_cost: 0; //refits are free
running_cost_base: RUNNING_COST_ROADVEH;
}

graphics {
default: spriteset_tatra_t3_default; // default graphic
}


}




//TATRA T3 Double


//set number of articulated parts
switch (FEAT_ROADVEHS, SELF, switch_articulated_t3, extra_callback_info1) {
1: return item_tram_tatra_t3;
2: return item_invisible_2;
3: return item_invisible_1;
4: return item_tram_tatra_t3;
5: return item_invisible_2;
return CB_RESULT_NO_MORE_ARTICULATED_PARTS; //stop adding vehicle parts
}

//set capacity of each part
switch (FEAT_ROADVEHS, SELF, switch_capacity_t3, position_in_consist ) {

2: return 0;
3: return 0;
5: return 0;
return 60; //default
}


item (FEAT_ROADVEHS, item_tram_tatra_t3_double) {
property {
name: string(STR_NAME_TATRA_T3_DOUBLE); //název z .lng
introduction_date: date(1962,1,1);
model_life: VEHICLE_NEVER_EXPIRES;
retire_early: 0;
vehicle_life: 25;
loading_speed: 25;
cost_factor: 224;
running_cost_factor: 112;
speed: 65 km/h;
power: 966 hp;
weight: 16 ton;
length: 3;
cargo_capacity: 120;
tractive_effort_coefficient: 0.5;
air_drag_coefficient: 0;
//sound_effect: no sound
//visual_effect: use default (none)

//callback_flags: no need to set this
reliability_decay: 20;
climates_available: ALL_CLIMATES;
refittable_cargo_classes: bitmask(CC_PASSENGERS);
sprite_id: SPRITE_ID_NEW_ROADVEH; //use custom sprites
misc_flags: bitmask(ROADVEH_FLAG_TRAM); //make this a tram
refit_cost: 0; //refits are free
running_cost_base: RUNNING_COST_ROADVEH;
}


graphics {
default: spriteset_invisible_1;
articulated_part: switch_articulated_t3;
cargo_capacity: switch_capacity_t3;
}


}

----------------------------------------------

_________________
Image


Top
   
PostPosted: Wed Mar 29, 2017 8:14 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
stefino_cz wrote:
One more question again. If I have articulated train of 3 parts for example, I define 3 parts and in the end I merge it together into one unit. But in purchase menu are these 3 parts and one final unit. How to show these 3 parts?

I'm using completely different style of programming. First of all, I'm using dedicated sprites for purchase menu. Something like this:
Code:
graphics {
    purchase:                   sset_my_vehicle_purchase_sprite;
    ...
    }

Next, almost all my vehicles are using single ID for all articulated parts. All differentiates (spritesets, length, capacity, etc.) are programmed in callbacks.
And the last thing. You are using 'fake' sprites instead of base 8bpp sprites for your vehicle. It is weird, because your set wil not work with OTTD configed to use only 8bpp blitter.

_________________
Image


Top
   
PostPosted: Thu Mar 30, 2017 8:34 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
:arrow: Yes yes, I'm going to add purchase sprite in my code :) What size of sprite do you use for purchase menu?
:arrow: Your program style looks more simple. Can you write code for one vehicle for better imagination? Here or PM? Thanks
:arrow: And about 8bpp - my opinion is to make only 32bit version, cause I used a lot of things what are unreal in 8bpp (transparency, shadows, coronas ahead of lights etc.) So yes - I know, that my sets will works only on 32bpp OTTD. This is my target and there is a lot of work for one man. I have no idea how hard is to make 8bpp from 32bpp, but I have "no time" to make sprites in zoom1, zoom2, zoom4 and in 8bpp and 32bpp :) Thats the reason, why I'm using placeholder in 8bpp and have only zoomx4 in 32bpp. It is the best way how to reach my goal, because redraw all the OTTDs world is a long-term work :)

Attachment:
Mratanava Transport, 19. kvě 2000.png [1.95 MiB]
Not downloaded yet

_________________
Image


Top
   
PostPosted: Thu Mar 30, 2017 1:10 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
stefino_cz wrote:
What size of sprite do you use for purchase menu?

I'm using 50x12px sprites. But you can use bigger pictures. OTTD automatically resize the grid in purchase window to the largest sprite. IIRC, purchase menu sprite should be standard 8bpp picture.

Quote:
Can you write code for one vehicle for better imagination? Here or PM?

You can check my source files for Polish PKP trainset. Good example is this wagon:
https://dev.openttdcoop.org/projects/pk ... /bipa.pnml
Here you find sprites:
https://dev.openttdcoop.org/projects/pk ... x/bipa.png
It is long, articulated vehicle with refit option to 2, 3 or 4 parts. Road vehicles should work with the same ideas.

_________________
Image


Top
   
PostPosted: Tue Apr 18, 2017 8:21 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
Thanks :)

I found another graphic problem. I made a smoke, but in some cases there is a problem with "animation" . This problem is only at 2 od 3 chimneys (industries) of all FIRS's graphics but it is there. This smokes are split into two parts - one part is static and second part is moving ok. But as you can see in the picture, near this bugged smoke are 2 more smokes and they are ok. THe second thing what I know is that if I move with screen or zoom out - size of the static area will be smaller and I get 2/3 of smoke what is OK instead of 1/3 like in the picture. At next chimney the static area is only at last 1/4 of the sprite size so the bugs are not same (all bugged smokes have different size of the static part). Have anybody any idea where the problem is? Thanks :)
Attachment:
smoke.jpg [748.25 KiB]
Not downloaded yet

_________________
Image


Top
   
PostPosted: Tue Apr 18, 2017 11:05 am 
Offline
OpenTTD Developer
OpenTTD Developer

Joined: Sun Sep 09, 2007 5:03 am
Posts: 4677
Location: home
It seems to me that your "not ok" part is outside the foot-print of the industry, and as such not updated at the same time as the industry.

Edit: "outside" in the purely vertical sense (that is, the columns of smoke pixels are not above a tile of the industry), without taking depth into account; openttd doesn't have depth in graphics.

_________________
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.


Top
   
PostPosted: Tue Apr 18, 2017 11:24 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
Mmm, I understand. But look at this two pictures? One is OK and second has split graphic and in this case is that part not static but deleted. I only move a view a little bit down.
Attachment:
1.jpg [671.39 KiB]
Not downloaded yet

Attachment:
2.jpg [675.63 KiB]
Not downloaded yet


And a video of this problem to better understanding
https://youtu.be/4nWsVkGwytw

_________________
Image


Top
   
PostPosted: Wed Apr 19, 2017 9:04 am 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Nov 07, 2011 7:32 pm
Posts: 330
Location: PL
stefino_cz wrote:
But look at this two pictures? One is OK and second has split graphic and in this case is that part not static but deleted.

These glitches occurs, because OTTD does not refresh whole scene at every frame. OTTD optimizes this process and refreshes "dirty blocks" only. "Dirty block" are registered only when ground/industry/house tile changes the state.
In your case, the smoke extends beyond the "dirty block", which is triggered by corresponding industry tile. In the effect, the right part of smoke is repainted correctly, but left part of smoke is repainted randomly, only when other tiles need refresh. If other tiles doesn't need refresh (i.e. static ground tiles), left part of smoke will not be refreshed too.

Edit:
You can analyze "dirty blocks" by enabling developer option ("newgrf_developer_tools = true" in your openttd.cfg file) and by setting "Toggle colouring of dirty blocks" in Info menu.

_________________
Image


Top
   
PostPosted: Wed Apr 19, 2017 8:30 pm 
Offline
Tycoon
Tycoon

Joined: Wed Apr 27, 2005 7:09 am
Posts: 5237
You can set the "tile refresh offset" by action0D, writing vars 93 .. 96.

regards
Michael

_________________
Image


Top
   
PostPosted: Wed Apr 19, 2017 8:54 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Sat Mar 31, 2007 2:23 pm
Posts: 4707
Location: Lost in Music
FIRS has some pretty frequent bugs with smoke pausing, as above. :twisted: Causes for this are likely one or both of
(1) inappropriate extents set on the sprites (fixed for some cases, but not released as of April 2017).
(2) smoke not marked dirty because it extends beyond the animated tile boundary (historically fixed in some cases by animating all tiles, or by moving the smoke position)

The case in the screenshots above is somewhat complicated because I use baseset smoke sprites in FIRS. For the smoke sprites shown, the original baseset and opengfx baseset have them going to the right (wind from SW). The 32bpp sprites are going to the left (wind from SE). This may be moving the smoke sprites outside the industry tile boundary. :| There is nothing useful I can further say about that today.

_________________
FIRS Industry Replacement Set (Released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (Finished)
Squid Ate FISH (ships) (Released) | CHIPS Has Improved Players' Stations (Finished)
Iron Horse (trains, released) | Termite (tracks for Iron Horse, released) | Busy Bee (game script, released)

Road Hog (road vehicles, released)


Top
   
PostPosted: Tue Apr 25, 2017 10:57 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
Thanks a lot of these answers :)

_________________
Image


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 17 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.