Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit colors that match the player color #429

Closed
lmoureaux opened this issue Apr 13, 2021 · 1 comment
Closed

Unit colors that match the player color #429

lmoureaux opened this issue Apr 13, 2021 · 1 comment
Labels
enhancement New feature or request gui This issue requires changes to the user interface

Comments

@lmoureaux
Copy link
Contributor

It would be nice if we could replace some color in unit sprites by the player color. This would make opposing armies more distinct from each other, adding graphical depth to the game. Same for city colors.

I'm not sure how this is usually done to allow shading etc, so some research will be needed.

@lmoureaux lmoureaux added the enhancement New feature or request label Apr 13, 2021
@jwrober jwrober added the gui This issue requires changes to the user interface label Jan 23, 2022
@jwrober jwrober added this to the v3.0-beta.2 milestone Jan 25, 2022
@jwrober jwrober removed this from the v3.0-beta.2 milestone Mar 16, 2022
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Jul 8, 2022
We need a method to make sprites depend on the player color (see longturn#429). After
some research, it seems that a standard technique involves shifting pixels in
the image that have a specific hue. This is a quite simple method with very few
free parameters; one could imagine changing the saturation and lightness as
well to create "darker" or "more gray" nations.

Create a class that encapsulates all of this so it's easy to change later. It
generates colorized sprites on the fly (might create flicker as this is an
expensive operation...) and caches them for later use. The sprites are only
meant to be freed at tileset unload, so there is no way to clear the cache.

See longturn#429.
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Jul 8, 2022
Allow tilesets to specify a new configuration key, "replaced_hue", that
specifies the HSL hue that will be replaced by the hue of the player color in
unit sprites. A single hue is used for the whole tileset to facilitate the
implementation. The feature is disabled by default for backward compatibility
and none of the shipped tilesets uses it.

Closes longturn#429.
@lmoureaux
Copy link
Contributor Author

Demo of the WIP implementation in #1095
image

lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Jul 9, 2022
We need a method to make sprites depend on the player color (see longturn#429). After
some research, it seems that a standard technique involves shifting pixels in
the image that have a specific hue. This is a quite simple method with very few
free parameters; one could imagine changing the saturation and lightness as
well to create "darker" or "more gray" nations.

Create a class that encapsulates all of this so it's easy to change later. It
generates colorized sprites on the fly (might create flicker as this is an
expensive operation...) and caches them for later use. The sprites are only
meant to be freed at tileset unload, so there is no way to clear the cache.

See longturn#429.
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Jul 9, 2022
Allow tilesets to specify a new configuration key, "replaced_hue", that
specifies the HSL hue that will be replaced by the hue of the player color in
unit sprites. A single hue is used for the whole tileset to facilitate the
implementation. The feature is disabled by default for backward compatibility
and none of the shipped tilesets uses it.

Closes longturn#429.
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Jul 9, 2022
lmoureaux added a commit that referenced this issue Jul 9, 2022
We need a method to make sprites depend on the player color (see #429). After
some research, it seems that a standard technique involves shifting pixels in
the image that have a specific hue. This is a quite simple method with very few
free parameters; one could imagine changing the saturation and lightness as
well to create "darker" or "more gray" nations.

Create a class that encapsulates all of this so it's easy to change later. It
generates colorized sprites on the fly (might create flicker as this is an
expensive operation...) and caches them for later use. The sprites are only
meant to be freed at tileset unload, so there is no way to clear the cache.

See #429.
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Jul 9, 2022
lmoureaux added a commit to lmoureaux/freeciv21 that referenced this issue Jul 9, 2022
lmoureaux added a commit that referenced this issue Jul 9, 2022
As already done for units.
See #429, #1095.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gui This issue requires changes to the user interface
Projects
None yet
Development

No branches or pull requests

2 participants