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

feat(map): system danger level display #9236

Merged
merged 14 commits into from
Oct 22, 2023
Merged

feat(map): system danger level display #9236

merged 14 commits into from
Oct 22, 2023

Conversation

flowers9
Copy link
Contributor

@flowers9 flowers9 commented Aug 28, 2023

Feature: This PR implements the feature request detailed and discussed in PR #3572 (orphaned)

Feature Details

The map has a new display mode to show the relative danger levels of system, which is based on the average fleet strength of random pirate spawn in 60 frames combined with the average strength of pirate raid fleets that may be spawned. The scale is logarithmic and based on random spawn in displayed systems (so High will always be displayed for the system with the highest spawn, Minimal for the lowest). Raid fleet strengths add to the level, so a tasty fleet may push many systems into the High category.

Systems with no pirate chance show as None.

The Map detail panel has a new icon next to the system name that can be clicked to show the system danger levels. There's a new help for danger levels, too.

UI Screenshots

Just starting out:
Screenshot from 2023-08-30 12-04-59
Later in the game:
Screenshot from 2023-08-30 12-04-34
10% raid threat:
Screenshot from 2023-08-30 12-04-16
100% raid threat (do not try this in human space!):
Screenshot from 2023-08-30 12-00-46
Help screen:
Screenshot from 2023-08-29 12-38-25
Icon when not active:
Screenshot from 2023-08-28 10-42-43

Artwork Checklist

Additional Comments

The threat levels don't take into account the player fleet (except for raid spawn calculations). However, since the scale is based on the displayed systems, as the player explores the threat levels will change and, I think, tend to align with the player's experiences. That is, systems that seemed very dangerous start to become routine over time, and while the map doesn't explicitly model this, finding more dangerous systems will scale down the displayed threat of older systems that used to be high on the list.

I went with a blue/light blue/orange/red color scheme because just using orange/red didn't show enough variation.

@TomGoodIdea
Copy link
Member

Systems with no pirate chance show as uninhabited.

I think a separate category would do better than marking both really uninhabited systems and those with no enemies as uninhabited.

The Map detail panel has a new icon next to the system name that can be clicked to show the system danger levels. There's a new help for danger levels, too.

How about displaying danger category as a separate line? Current placement of the icon doesn't really show it leads to another map type.

@flowers9
Copy link
Contributor Author

Well, the thing is, uninhabited systems can have positive danger levels, so they're often not marked as Uninhabited on the map. I think it's less confusing to shift Uninhabited to mean "no pirates" than have it be "no pirates, and also no people", while we have another color that means "no pirates, but people", and no color that means "no people".

No offense to whoever designed the map details panel, but nothing on that panel shows that it leads to another map type. It's not 'til you start clicking around (or read the help, maybe) that you realize that there are many different map types. And the help for the danger levels explicitly says what to click on.

Also, I'm not sure what I'd put on the line, to be honest. The numbers that drive the colors probably won't mean much to the player.

@Hurleveur
Copy link
Member

Hurleveur commented Aug 29, 2023

Just update the legend to make it "Safe" and maybe make it green or smth?

@flowers9
Copy link
Contributor Author

Looks reasonable?

Screenshot from 2023-08-29 08-52-53

@bene-dictator bene-dictator added the enhancement A suggestion for new content or functionality that requires code changes label Aug 30, 2023
source/MapPanel.cpp Outdated Show resolved Hide resolved
source/MapPanel.cpp Outdated Show resolved Hide resolved
@quyykk quyykk requested a review from Amazinite August 31, 2023 09:24
@mOctave
Copy link
Contributor

mOctave commented Sep 4, 2023

I think this is a really neat feature, but there's a couple of things here that I'm not sure I like.

Firstly, I feel quite strongly that the current icon that leads to the danger map is confusing, overcrowds that part of the screen, and doesn't fit well with the rest of the map screen UI. Another line under the government that reads something like "Secure"/"Safe"/"Moderate"/"Risky"/"Dangerous" would make more sense.

Additionally, giving the player information about all piracy threats in the galaxy seems (gasp!) unrealistic. The way in which it would be revealed in vanilla makes sense, since local maps and manual exploration only reveal a small portion of the map at a time. However, danger levels can suddenly change very drastically, and having the player be immediately made aware of the threats across the galaxy could potentially give away parts of the plot. This is also a problem with the existing maps, so it isn't too big of a deal, but I still feel like it's something to take into account.

Finally, does this PR count all hostile fleets, just pirates, or just hostile pirates? If it doesn't count all hostile fleets, it should. If it does, then the description should probably change to reflect that.

@flowers9
Copy link
Contributor Author

flowers9 commented Sep 4, 2023

Two sources of "danger" are considered. One is

        // Check how dangerous this system is (credits worth of enemy ships jumping
        // in per frame).
        double Danger() const;

This goes through all fleets that can spawn at that system, and adds up the total strength/time increment for all hostile ones. Literally, it is how dangerous that system is in terms of hostile encounter strength over time. This is the danger used to determine the color scaling.

The second source of danger are raid fleets that can be spawned as a result of the attractiveness of the player's fleet. These fleets appear to only have a chance of spawning in a system during system entry, rather than per unit time, so I compare them with 60 frames worth of the above "system danger".

Other than scripted events (such as spawns from missions, or defense fleets), I think those are the only two sources of hostile ships, and they include all hostile ships, not just pirates. Thus, this PR is "system danger level", not "pirate danger level", as it's how dangerous the system is, not how likely pirates are to spawn. And the map key is named accordingly.

The icon used is a scaled version of the icon that is flashed when a hostile ship targets the player's ship(s), so it's a nice indication of exactly what type of information you're looking at (things that will make that icon appear on your screen ;). It's placed in the same spot relative to the system name as the arrows used to show what detail is currently being displayed (try clicking on the commodities for an example).

I could increase the height of the ui element the name & government are listed in (although it'd be a pain because of all the detail behind them). I'm not sure I agree with what to put there, though. Does "Secure" make sense for completely empty systems with no government presence, like Cardea? Safe seems pretty similar to Secure, and Moderate is kinda odd on its own, rather than in a map key.

As for giving the player more information, yeah, well, that's a judgement call. We give them lots of info it doesn't make a lot of sense to (like shop listings for hostile aliens they can't speak to). This one makes some sense, though, because it's something pilots would want to share with each other, and there seems to be something like the internet to send the information around (although maybe it's more like a bbs).

Copy link
Collaborator

@Amazinite Amazinite left a comment

Choose a reason for hiding this comment

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

Looks nice, but I'm not so sure on the use of the radar icon to swap to this map key. It feels a little out of place compared to other keys. My first thought is to add a "Danger level: [descriptor]" text to the UI somewhere, but there's no real space for it without updating map graphics. If we were to update the UI graphics, then I think that expanding the height of map systems.png to make room would be the best spot.
image

Perhaps we could get a bit crazier, though, and add the star(s) in the system to the planet card area, giving us room for more map keys than just this. That'd be way out of scope for this PR, though, and it's probably worth keeping the radar for now and then adding this idea later on.
image

The new help dialog needs to be added to the HELP command of MapDetailPanel::KeyDown.

For the radar icon: we use "gray" for the color instead of "grey".

source/MapPanel.cpp Outdated Show resolved Hide resolved
source/MapPanel.cpp Show resolved Hide resolved
@Amazinite
Copy link
Collaborator

Gonna need a high DPI PR for this one because of the added UI image. I'd consider an assets PR optional because it's such a simple color swap of an existing asset.

@flowers9
Copy link
Contributor Author

Done. In fact, it's a single command in gimp to do that.

@Saugia
Copy link
Collaborator

Saugia commented Oct 22, 2023

Make sure to link High DPI pull requests within main repo PR's so we know what's linked to what. (In this case, link (endless-sky/endless-sky-high-dpi#384) in this PR).

If a PR touches an image or artwork, make sure to use the artwork outline as well with the checks as follows in the PR description:

Artwork Checklist

  • [] I updated the copyright attributions, or decline to claim copyright of any assets produced or modified
  • [] I created a PR to the endless-sky-assets repo with the necessary image, blend, and texture assets:
  • [] I created a PR to the endless-sky-high-dpi repo with the @2x versions of these art assets:

(Though, as Amazinite has said, an asset PR here is unnecessary.)

@Amazinite Amazinite merged commit 947556d into endless-sky:master Oct 22, 2023
21 checks passed
@flowers9 flowers9 deleted the danger_color branch October 22, 2023 22:21
@CiarAons CiarAons mentioned this pull request Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A suggestion for new content or functionality that requires code changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants