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

use strictly background color for terrain #1674

Merged
merged 3 commits into from
Dec 12, 2023
Merged

Conversation

kostmo
Copy link
Member

@kostmo kostmo commented Dec 4, 2023

Towards #1662

Prerequisite for #1672

To allow a robot-occupied cell to take on the underlying terrain color as the background color of its cell, the terrain color must be representable strictly as a "background". However, currently, the dirt, stone, and grass terrains are represented by a half-shaded foreground glyph upon black background.

Currently the "Medium Shade" unicode character () is used to "blend" a somewhat bright color with a black background, resulting in a moderately dark color in the terminal for dirt, stone, and grass. However, these same dark colors are not reproducible in the 240-color scheme without this foreground+background blending trick; the closest approximations as a background-only or foreground-only color come out quite a bit lighter.

Visual comparison

Using:

scripts/play.sh -i creative --seed 2 --autoplay
Before After
Screenshot from 2023-12-03 23-33-15 Screenshot from 2023-12-03 23-32-36

Possible approaches

So, we need to decide whether to:

  1. Accept the new lighter colors
  2. Choose new, alternative terrain colors that may be darker given the 240-color palette
  3. Abandon support for 240 colors and assume "full" color terminals
  4. Abandon efforts to passthrough terrain color as background of robot cells

@kostmo kostmo marked this pull request as ready for review December 4, 2023 07:40
@kostmo kostmo requested a review from byorgey December 4, 2023 07:40
@byorgey
Copy link
Member

byorgey commented Dec 5, 2023

I don't think I like the new lighter colors, not just on aesthetic grounds but also functional grounds: if the goal is to pass through the background color behind entities and robots, having bright background colors is going to make it very difficult to see.

What would be the downside of abandoning 240-color support and assuming full color terminals?

@kostmo kostmo force-pushed the feature/terrain-as-background branch from 9af3d35 to 6402249 Compare December 9, 2023 01:59
@kostmo
Copy link
Member Author

kostmo commented Dec 9, 2023

What would be the downside of abandoning 240-color support and assuming full color terminals?

Actually, this was simpler than I thought. We had been using the rgbColor function; I just swapped it for linearColor. I reverse-engineered the precise full-color RGB triples for the half-shade darkened terrain using the Gimp color picker.

The new colors look like so:
Screenshot from 2023-12-08 17-58-44

As a bonus, the PNG renderer is now more color-accurate (compare to previous version):
out2

@byorgey
Copy link
Member

byorgey commented Dec 12, 2023

Ah, that looks very nice indeed!

Copy link
Member

@byorgey byorgey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

src/Swarm/App.hs Outdated Show resolved Hide resolved
src/Swarm/Game/Terrain.hs Outdated Show resolved Hide resolved
@kostmo kostmo added the merge me Trigger the merge process of the Pull request. label Dec 12, 2023
@mergify mergify bot merged commit 8e1fe17 into main Dec 12, 2023
9 checks passed
@kostmo kostmo deleted the feature/terrain-as-background branch January 5, 2024 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants