32 bpp Vehicles / Company colours?
Moderator: Graphics Moderators
32 bpp Vehicles / Company colours?
I'm working on my new grf of industries and as I have new cargo types i think create some vehicles, but unlike Real Cars that are more oriented to eye-candy or traffic I want these vehicles to be more playable with which something necessary is that they can change color based on the colors of different companies/players.
In 8 bpp it´s just a palette colour but i need for 32 bpp, it´s some kind or mask o what? exist any NML example?
Thanks in advance.
In 8 bpp it´s just a palette colour but i need for 32 bpp, it´s some kind or mask o what? exist any NML example?
Thanks in advance.
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Re: 32 bpp Vehicles / Company colours?
Yes, you just need an 8bpp mask with the company colour(s). The format for encoding in NML is here. If the mask image is the same size and layout as the base sprite image, you just need to provide the filename - simples.
Re: 32 bpp Vehicles / Company colours?
Thank you very much for reply, so I would have to do 32 mask graphics per vehicle? I mean 16 for the unloaded truck and 16 for the loaded truck. (16 company colours)
And of course multiplying that for each truck/cargo is insane!
I'm starting to change my mind about company colors.
And of course multiplying that for each truck/cargo is insane!
I'm starting to change my mind about company colors.
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Re: 32 bpp Vehicles / Company colours?
No. One mask with the same "magic" palette colours as normal 8bpp sprites - blue for first cc, green for second.
Re: 32 bpp Vehicles / Company colours?
Some Progress but one Bug,
EDIT: Nevermind, I solved, it was a mask.png error, i replaced the red background for blue.
The masked vehicle areas changes color ok but the rest of the vehicle (unmasked parts) are animated / alternates between black and red colors when moving on the road.
EDIT: Nevermind, I solved, it was a mask.png error, i replaced the red background for blue.
The masked vehicle areas changes color ok but the rest of the vehicle (unmasked parts) are animated / alternates between black and red colors when moving on the road.
Code: Select all
/* Sprite template for a realtruck full*/
template tmpl_realtruck_full(x) {
[18, 8, 48, 70, -26, -40, NOANIM]
[82, 8, 81, 60, -58, -21, NOANIM]
[178, 8, 103, 48, -56, -27, NOANIM]
[290, 8, 79, 63, -27, -25, NOANIM]
[386, 8, 48, 75, -27, -48, NOANIM]
[445, 8, 80, 63, -54, -23, NOANIM]
[532, 8, 94, 48, -50, -26, NOANIM]
[635, 8, 80, 60, -27, -26, NOANIM]
}
template tmpl_32_realtruck_full(x) {
[0, 0, 48, 93, -24, -46, NOANIM]
[51, 0, 116, 93, -67, -36, NOANIM]
[171, 0, 127, 93, -67, -43, NOANIM]
[303, 0, 116, 93, -47, -38, NOANIM]
[423, 0, 48, 93, -23, -43, NOANIM]
[474, 0, 116, 93, -69, -35, NOANIM]
[594, 0, 131, 93, -65, -57, NOANIM]
[728, 0, 116, 93, -46, -39, NOANIM]
}
template tmpl_32_realtruck_full_MASK(x) {
[0, 0, 48, 93, -24, -46, NOANIM, mask]
[51, 0, 116, 93, -67, -36, NOANIM, mask]
[171, 0, 127, 93, -67, -43, NOANIM, mask]
[303, 0, 116, 93, -47, -38, NOANIM, mask]
[423, 0, 48, 93, -23, -43, NOANIM, mask]
[474, 0, 116, 93, -69, -35, NOANIM, mask]
[594, 0, 131, 93, -65, -57, NOANIM, mask]
[728, 0, 116, 93, -46, -39, NOANIM, mask]
}
/* Sprite template for a realtruck empty*/
template tmpl_realtruck_empty(x) {
[18, 8, 48, 70, -26, -40, NOANIM]
[82, 8, 81, 60, -58, -21, NOANIM]
[178, 8, 103, 48, -56, -27, NOANIM]
[290, 8, 79, 63, -27, -25, NOANIM]
[386, 8, 48, 75, -27, -48, NOANIM]
[445, 8, 80, 63, -54, -23, NOANIM]
[532, 8, 94, 48, -50, -26, NOANIM]
[635, 8, 80, 60, -27, -26, NOANIM]
}
template tmpl_32_realtruck_empty(x) {
[0, 96, 48, 93, -24, -46, NOANIM]
[51, 96, 116, 93, -67, -36, NOANIM]
[171, 96, 127, 93, -67, -43, NOANIM]
[303, 96, 116, 93, -47, -38, NOANIM]
[423, 96, 48, 93, -23, -43, NOANIM]
[474, 96, 116, 93, -69, -35, NOANIM]
[594, 96, 131, 93, -65, -57, NOANIM]
[728, 96, 116, 93, -46, -39, NOANIM]
}
template tmpl_32_realtruck_empty_MASK(x) {
[0, 96, 48, 93, -24, -46, NOANIM, mask]
[51, 96, 116, 93, -67, -36, NOANIM, mask]
[171, 96, 127, 93, -67, -43, NOANIM, mask]
[303, 96, 116, 93, -47, -38, NOANIM, mask]
[423, 96, 48, 93, -23, -43, NOANIM, mask]
[474, 96, 116, 93, -69, -35, NOANIM, mask]
[594, 96, 131, 93, -65, -57, NOANIM, mask]
[728, 96, 116, 93, -46, -39, NOANIM, mask]
}
spriteset(realtruck_empty, "gfx/realtruck.png") { tmpl_realtruck_empty(0) }
alternative_sprites(realtruck_empty, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/realtruck_32.png","gfx/real_trucks_mask.png")
{ tmpl_32_realtruck_empty(0) }
spriteset(realtruck_full, "gfx/realtruck.png") { tmpl_realtruck_full(0) }
alternative_sprites(realtruck_full, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/realtruck_32.png","gfx/real_trucks_mask.png")
{ tmpl_32_realtruck_full(0) }
spritegroup realtruck {
loaded: [realtruck_empty,realtruck_full];
loading: [realtruck_empty,realtruck_full];
}
/* Purchase Menu Image */
spriteset(spriteset_realtruck_purchase, "gfx/realtruck.png") {[0,0,1,1,0,0]}
alternative_sprites(spriteset_realtruck_purchase, ZOOM_LEVEL_IN_2X, BIT_DEPTH_32BPP, "gfx/realtruck_32.png","gfx/real_trucks_mask.png") {[594,0,131,93,-65,-55]}
/* Properties */
/* Define the road vehicle */
item(FEAT_ROADVEHS, flatbed_realtruck_1) {
property {
/* Properties common to all vehicle types */
name: string(STR_NAME_realtruck_1);
climates_available: ALL_CLIMATES;
road_type: ROAD;
introduction_date: date(1980,01,01);
model_life: VEHICLE_NEVER_EXPIRES;
/* retire_early not set, use default retirement behaviour */
vehicle_life: 255;
reliability_decay: 20;
non_refittable_cargo_classes: bitmask(CC_PIECE_GOODS);
default_cargo_type: STEL;
cargo_allow_refit: [];
cargo_disallow_refit: []; // we allow other cargoes, if class matches
loading_speed: 8;
cost_factor: 30;
running_cost_factor: 20;
/* cargo_age_period is left at default */
/* RV-specific properties */
sprite_id: SPRITE_ID_NEW_ROADVEH;
speed: 90 km/h;
misc_flags: bitmask(ROADVEH_FLAG_NO_BREAKDOWN_SMOKE);
refit_cost: 0; // Refitting is free
/* callback_flags are not set, no need to manually enable callbacks */
running_cost_base: RUNNING_COST_NONE;
power: 163 hp;
weight: 2 ton;
/* TE and air drag coefficient is left at default */
cargo_capacity: 5;
sound_effect: SOUND_BUS_START_PULL_AWAY;
/* Visual effect is left at default (no effect) */
}
graphics {
default: realtruck;
purchase: spriteset_realtruck_purchase;
}
}
Last edited by temporal8 on 26 Jun 2022 17:46, edited 1 time in total.
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Re: 32 bpp Vehicles / Company colours?
Fixed Mask:
The only thing I noticed is that the light company colors appear burnt. Is this due to the blue tone or because of the original yellow base?
The only thing I noticed is that the light company colors appear burnt. Is this due to the blue tone or because of the original yellow base?
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Re: 32 bpp Vehicles / Company colours?
Because of this.
As you can see in Pikka's example, use grey tones in the "original" drawing for the parts that you want to mask.
That way the colors stay what they have to be.
Edit:
Also dont forget to use different tones of the CC-blue and CC-green (lighter/darker tones of those colors), for the shading-effect.
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.
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.
Re: 32 bpp Vehicles / Company colours?
Thanks a lot pal.
Real Projects 32bpp releases:
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
Real Semi Trucks 32bpp: viewtopic.php?t=90996
Real Houses Eyecandy Objects 32bp: viewtopic.php?t=90767
Real Ships 32bpp: viewtopic.php?t=90733
Real Industries 32bpp: viewtopic.php?t=90183
Real Houses Townset 32bp: viewtopic.php?p=1254605
Real Stations 32bpp: viewtopic.php?p=1255635
Real Cars 32bpp: viewtopic.php?p=1249244
Real Vehicles 32bpp: viewtopic.php?p=1253581
Real Bus 32bpp: viewtopic.php?p=1249245
Real Trucks 32bpp: viewtopic.php?p=1254468
Real Parks 32bpp: viewtopic.php?p=1250255
Argentina World Cup 2022 Champions Bus 32bpp viewtopic.php?p=1257026
- stefino_cz
- Transport Coordinator
- Posts: 268
- Joined: 02 Jul 2015 08:05
- Location: Czech Republic
- Contact:
Re: 32 bpp Vehicles / Company colours?
Hi, I'm using this topic for a similar question, but not for company colors but for "refit" colors. Somebody wrote me that it is possible to code this refit without a special cargo label. Now, we use our own cargo label for it and it is a problem in a case the player has full cargo labels. Then this refit doesn't work. We use NML for coding. Thanks
-
- Engineer
- Posts: 117
- Joined: 04 Apr 2022 12:44
- Location: The openttd discord server
Re: 32 bpp Vehicles / Company colours?
You should be able to use the label for passengers if you set the capacity to zero with the cargo_capacity callbackstefino_cz wrote: ↑14 Apr 2023 07:28 Hi, I'm using this topic for a similar question, but not for company colors but for "refit" colors. Somebody wrote me that it is possible to code this refit without a special cargo label. Now, we use our own cargo label for it and it is a problem in a case the player has full cargo labels. Then this refit doesn't work. We use NML for coding. Thanks
Who is online
Users browsing this forum: No registered users and 4 guests