X Tutup
Skip to content

feat: fix completion display of scan manager#5932

Merged
sturnclaw merged 7 commits intopioneerspacesim:masterfrom
mwerle:feat/scan_manager
Oct 24, 2024
Merged

feat: fix completion display of scan manager#5932
sturnclaw merged 7 commits intopioneerspacesim:masterfrom
mwerle:feat/scan_manager

Conversation

@mwerle
Copy link
Contributor

@mwerle mwerle commented Oct 7, 2024

Bug link(s)

Fixes #5930

Description

Background

The scan manager shows the completion percentage of the current scan target while performing a scan. This is confusing for players when performing orbital scan missions which require less than 100% of the planet to be scanned.

For example, the mission might request that 42% of the target planet needs to be scanned, but the completion percentage always goes from 0..100% - confusing the player when it goes past 42%.

For surface scan missions it was ok since the scan target is in kilometres, so having a 0..100% completion is understandable.

Changes this PR provides

This PR proposes to modify both displays to instead of showing a completion percentage, showing the actual amount of square kilometres scanned so far. In addition, a progress bar showing the completion percentage is shown for the currently active scan.

Additionally:

  • Fix for Scout missions completing at the first station the player docks at.
  • Improvements to the way Scout missions are displayed in the players' mission log.

Images

Details

Previously:

Orbit Scan Completion

Now:

image

@mwerle
Copy link
Contributor Author

mwerle commented Oct 7, 2024

As an aside, I'm not sure how the scan resolution is useful to the player. For my first scanning mission I assumed it was the target altitude - somewhat scary skimming the surface of Mercury at 73m while in orbit (3km/s)..

It would also be really useful if the orbit planner could show some details of the orbit, such as aphelion and perihelion distances. Or even full orbital parameters, which could then tie into advanced scanning missions requiring the player to get into a particular orbit similar to KSP satellite missions (although that might be a bit technical for most players.. as-is according to some comments it's already too difficult if the scanning isn't in one of the "low"/"medium"/"high" autopilot orbits...) That said, personally I'd love to see the orbit planner to be closer to the KSP one, and once a bunch of manoeuvre burns are defined the autopilot would simply execute those.

Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

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

I think your Previously and Now images are flipped.

This is a reasonable change, although the one impact this has is that it can be much more difficult to see if the orbital scan progress is going up on very large bodies with an e.g. 20% coverage scan contract.

As much as I personally think a 0...100% progress indicator is "clear", apparently it's unclear to users so I won't object.

As an aside, I'm not sure how the scan resolution is useful to the player.

I agree, though I was the one to originally implement it there's definitely some missing information for the player to be able to intuit "this affects how high I can fly". I don't have strong ideas for what to "do" with it at current though.

It would also be really useful if the orbit planner could[...]

These are all loosely planned. I have a WIP branch implementing an orbital situation display for the WorldView so you can see your current Ap/Pe, and adding full orbital details to the System View is definitely desired. We're currently tracking UI mockups in #5319 - the Transfer/Orbit Planner heading (and "Orbital map ideas" under the Other Mockups section) contain some ideas for how to present that information to the player.

Someone willing to deal with the mess that is the autopilot code and implement an AICmdExecuteManeuver() method would be a huge boon towards making that a reality - I tend to stay busy with the systemic side of things and haven't gotten enough time to tackle the math required.

@mwerle
Copy link
Contributor Author

mwerle commented Oct 8, 2024

I think your Previously and Now images are flipped.

Eh, I just copied the image links from the bug report instead of uploading the images again, and forgot that the first two images were to demonstrate the issue.. removed the incorrect image.

This is a reasonable change, although the one impact this has is that it can be much more difficult to see if the orbital scan progress is going up on very large bodies with an e.g. 20% coverage scan contract.

It took forever to go up a percentage point before as well.. but unless we increase the number of decimals I don't think there's any way to improve on this.

Also, given this is all floats there's some rounding issues - even with these changes, it can look as if the scan has completed, but it still has a little way to go.

For example:

Target: 0.43746  -> Display: 43.7%
Current: 0.43713 -> Display: 43.7%

One way to fix this would be to clamp the target distance/percentage to a single decimal point. Ideally I'd prefer to rework all of this to just use integers, but Lua is untyped (or rather, you can't specify a type, values have types as determined by Lua) as far as I've been able to work out.

As much as I personally think a 0...100% progress indicator is "clear", apparently it's unclear to users so I won't object.

It's clear enough for the surface scan, but it was (IMHO) very confusing for the orbit scan, and I had found an online discussion somewhere (despite lots of Googling and going back through browser history I was unable to find this again - there's a possibility I hallucinated it even though I am fairly certain I'm not an AI..) with a person raising exactly the same issue. I found it while trying to find an online guide on how to use the scanners..

The "MINIMUM ALTITUDE" was completely unclear to me.. I thought it meant I was still too high.

Perhaps instead of displaying the scanning status in the title, add additional icons to the scanner display? Altitude low/optimal/high/out-of-range? (With out-of-range used for both too low as well as too high).

Now that I've played with it more I've seen more information in-game such as the minimum altitude in the scanner description, so this may not be a big deal for most people, but I did struggle to intuit how to use the scanner.

As an aside, I'm not sure how the scan resolution is useful to the player.

I agree, though I was the one to originally implement it there's definitely some missing information for the player to be able to intuit "this affects how high I can fly". I don't have strong ideas for what to "do" with it at current though.

I think it would make it too simple to simply list minimum and maximum altitudes; it would be nice if there was a way for players to "learn" the optimal altitude for a scanner and the desired resolution. Or perhaps add the current resolution to the display and have it change based on the altitude, that way a player can home in on the optimal altitude.

Does the speed of scanning change based on altitude? Lower orbits are faster, but higher orbits can allow for a wider area to be scanned per orbit.. as well as being able to use higher time acceleration. But the debug display seems to indicate that the number of required orbits is fixed for a given body/scan resolution/completion percentage.

It would also be really useful if the orbit planner could[...]

These are all loosely planned.

Yayy :)

@mwerle
Copy link
Contributor Author

mwerle commented Oct 8, 2024

... re-reading (and a few coffees later), I now understand what you meant with it taking longer to show progress. Yes, that is a valid point.

Instead of showing a completion percentage as a number, how about having a bar fill up to show the completion? (This would require a bit more work).

Mockup:

Scan Progress Bar Mockup

@impaktor
Copy link
Member

impaktor commented Oct 8, 2024

I found it while trying to find an online guide on how to use the scanners

Ideally, the wiki should be the place. E.g. there's some on the FAQ or mission types page

It took forever to go up a percentage point before as well.. but unless we increase the number of decimals I don't think there's any way to improve on this.

From a game perspective, player would expect to see their action (flying within correct parameters) to have a visible effect in some way so they don't have to wonder if they're doing it right or not, so wold be nice if this was improved.

@mwerle
Copy link
Contributor Author

mwerle commented Oct 8, 2024

Got the progress bar working :

image

Yayy/nayy?

@mwerle mwerle force-pushed the feat/scan_manager branch from 967a8b5 to 077f307 Compare October 8, 2024 09:20
@impaktor
Copy link
Member

impaktor commented Oct 8, 2024

I guess it comes down to what the percentage should represent: surface scanned, or mission completion? What makes the player think the percentage would be anything other than total mission progress? Does the mission contractor say "scan X % of the planet"? I can't remember that (I think I wrote/edited those mission texts). If they did, I'd opt to change in that end.

Why is the Mars, Sol mission at 1384%?

@mwerle
Copy link
Contributor Author

mwerle commented Oct 8, 2024

I guess it comes down to what the percentage should represent: surface scanned, or mission completion? What makes the player think the percentage would be anything other than total mission progress? Does the mission contractor say "scan X % of the planet"? I can't remember that (I think I wrote/edited those mission texts). If they did, I'd opt to change in that end.

Yes, the mission-giver states that the mission requires, for example, "13.8%" of the target planet to be scanned. Which is also what the requirements show (bottom-left of the scan card).

Up to now, the completion indicator (top-right of the card) always went from 0..100% - which I found rather confusing when it went past the "13.8%" of the target.

Why is the Mars, Sol mission at 1384%?

Because I stuffed up creating a scan mission.. the debug screen was (I'm guessing) originally designed for surface scans, so it doesn't have a percentage slider, only a kilometers one, and 1km == 100%, not 1%..

@mwerle
Copy link
Contributor Author

mwerle commented Oct 8, 2024

Mission details screen:

Screenshot_20241007_210156

@Zireael07
Copy link

Another idea:

Yes, the mission-giver states that the mission requires, for example, "13.8%" of the target planet to be scanned. Which is also what the requirements show (bottom-left of the scan card).

Up to now, the completion indicator (top-right of the card) always went from 0..100% - which I found rather confusing when it went past the "13.8%" of the target.

Have a thick line across the progress bar at 13.8% and/or change the color of the bar after 13.8%? Show a big tick in the top right after 13.8%?

@mwerle
Copy link
Contributor Author

mwerle commented Oct 8, 2024

Another idea:

Yes, the mission-giver states that the mission requires, for example, "13.8%" of the target planet to be scanned. Which is also what the requirements show (bottom-left of the scan card).

Up to now, the completion indicator (top-right of the card) always went from 0..100% - which I found rather confusing when it went past the "13.8%" of the target.

So there's the initial issue I had which was that the progress percentage (top-right) went from 0..100%, even though the mission requires only 13.8%. I found this very confusing. Which is why I changed it so the percentage only goes from 0..13.8%.

@Web-eWorks then pointed out that this means that the percentage display potentially ticks up much slower than before, which is why I added the progress bar. The progress bar "displays" 0..100%, but does so graphically, so there is no confusion between percentages. So the progress bar will (should) tick up as quickly as the original display did.

Note that this all only affects the orbital scan missions.

The surface scan missions (which I hadn't done and which, I think, came first) require a set distance (area?) to be covered, so in this case, the original percentage display 0..100% was fine - there was nothing to confuse anybody as the target progress was in km, not in %.

Have a thick line across the progress bar at 13.8% and/or change the color of the bar after 13.8%? Show a big tick in the top right after 13.8%?

... why? the progress bar goes from 0..100% of the 13.8%. Adding the 13.8% to the progress bar would reintroduce the original confusion. Why would the mission not complete once 13.8% is reached and instead require to continue scanning all the way to 100%?

@Zireael07
Copy link

why? the progress bar goes from 0..100% of the 13.8%. Adding the 13.8% to the progress bar would reintroduce the original confusion. Why would the mission not complete once 13.8% is reached and instead require to continue scanning all the way to 100%?

It's totally not clear to the player (who doesn't know the code and the backstory) that it's 0-100 of 13.8%. Hence my idea to keep 0-100% of the planet surface (which is simple and intuitively understandable) and add a line or a tick at the place the mission requires

@mwerle
Copy link
Contributor Author

mwerle commented Oct 8, 2024

Ok, we may be talking at cross-purposes (it's never easy with text).

My idea is to remove any sort of confusion caused by displaying multiple percentages, one being the target scan percentage, and the other the mission progress percentage. Having the former display 13.8%, but the latter display 0..100% was (for me at least) very confusing the first time I tried an orbital scan mission. It was so confusing that I spent several hours digging into the code to try to understand it.

Now, having changed the progress percentage to count from 0..13.8 instead of 0..100, to make it match the target scan percentage, worked fine. The problem with this is that it counts up slower than before, and players might think nothing is actually happening and the mission isn't triggering or what have you.

So following on from my initial "fix" I now propose to add a mission progress bar WITHOUT display any sort of percentage to avoid the initial confusion in order to provide faster feedback to the player that something is happening and that the scan is progressing.


Hence my idea to keep 0-100% of the planet surface

This has got nothing to do with planet surface scans. I am talking about planet orbital scans.

Surface scans don't require a percentage completion, they require a distance completion.. and for those the 0..100% display made sense and is intuitive and there are no arguments or quibbles with that.


If people think the original display is clearer and more intuitive I will close this PR. I now understand how the scanning missions work. I still think it is incredibly unintuitive for first timers which is why I proposed these changes.

@mwerle
Copy link
Contributor Author

mwerle commented Oct 8, 2024

It's totally not clear to the player (who doesn't know the code and the backstory) that it's 0-100 of 13.8%. Hence my idea to keep 0-100% of the planet surface (which is simple and intuitively understandable) and add a line or a tick at the place the mission requires

If your proposal is for the progress bar to render 0..100, but to complete at 13.8 (sorry, that's not how I read it - english is not my first language), then we have the same problem as simply displaying 0..13.8 as a percentage in the top-right : nothing actually happens for ages since it will potentially take a long time for the first bit of progress to start displaying.


I guess instead of "Scan Progress" the progress bar could instead say "Mission Progress". Would that improve it?

Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

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

I am happy with the result of the scan progress bar. It is significantly more intuitive, and for those who want to compare apples to apples the actual scan card provides that data in an easy-to-read manner.

I do have a suggestion, in that you could include the percentage to scan completion on the progress bar as "Data Collected: 43.7%", as 0.01% is likely a smaller metric than the width of a pixel on the progress bar.

However, feel free to ignore this specific suggestion if it winds up devolving back into "which percentage do I care about anyways?"

Please address the getStyleColor() usage and optionally change the string used for the progress bar, and I consider this PR to be approved.

-- The style progress bar colour is yellow which is very jarring for this
-- display. So instead lets use the slider grab colour which should remain
-- suitable across any style changes in the future.
local progressBarColor = ui.getStyleColor("SliderGrabActive")
Copy link
Member

Choose a reason for hiding this comment

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

Note: this should use colors.SliderGrabActive or (for contrast, given this is displaying a white label overtop) colors.uiPrimary or colors.uiPrimaryLight. ui.getStyleColor() is an old hack from before we had a consistent UI style, and explicitly referencing the style color allows easier/better refactoring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 0174ee9

I chose colors.uiPrimaryLight just to give it a tiny bit of difference from the standard background. I do prefer the even lighter SliderGrabActive but it does reduce contrast, and ImGui currently does not have support for rendering progress bar text with inverted colors when being covered by the progress.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Incidentally, there's a new version of ImGui which fixes the alignment of the text in the progress bar.

The current version of ImGui places the text into the non-progress portion of the bar which makes the text move as the progress bar fills, which looks a bit weird. The new version has a fixed place for the text inside the progress bar.

What's the procedure for updating ImGui? (I'm guessing a fair bit of testing would be required..)

Copy link
Member

Choose a reason for hiding this comment

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

Hah... funny you ask. I've had "Update ImGui" on my TODO list for the last ~week. The short and snarky form of the procedure is "get @Web-eWorks to do it".

The actual procedure is a bit longer than that - we have several patches applied onto the base ImGui codebase, which we have stored in-tree as contrib/imgui/patches/*.patch. Those have to be evaluated, applied, and potentially rewritten. Then, after that's done, a pass on API breaking changes from the ImGui side has to be done, and the Lua API checked to see if it uses any of the now-deprecated functions from the ImGui API.

If Lua does use a now-removed API, all callsites have to be migrated to either a drop-in wrapper in data/pigui/libs/wrappers.lua or the replacement API.

Most of the testing required from an ImGui upgrade is handled by "does this compile" - ocornut is very good about documenting breaking changes and keeping APIs stable. The fun bit is exposing all of the new ImGui API functions to Lua in a way that makes sense - that is typically an iterative process that lasts until (and often past) the next ImGui upgrade.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oof; a bit more involved than I had anticipated.. them's the breaks when you maintain your own patches!

@Gliese852
Copy link
Contributor

Forgive me for interfering with my 5 cents, maybe it’s possible to convert “surface percentage” into other units, into square kilometers, for example?

@mwerle
Copy link
Contributor Author

mwerle commented Oct 9, 2024

Forgive me for interfering with my 5 cents, maybe it’s possible to convert “surface percentage” into other units, into square kilometers, for example?

There is no "surface percentage" anywhere.. the surface scans are in kilometers (I wasn't sure if they should be square kilometers..)

@Gliese852
Copy link
Contributor

Forgive me for interfering with my 5 cents, maybe it’s possible to convert “surface percentage” into other units, into square kilometers, for example?

There is no "surface percentage" anywhere.. the surface scans are in kilometers (I wasn't sure if they should be square kilometers..)

Hm, but what do you scan during an orbital scan? Orbit?

@mwerle
Copy link
Contributor Author

mwerle commented Oct 9, 2024

Hm, but what do you scan during an orbital scan? Orbit?

Ah.. I see what you mean. It's not what the game currently says for the orbital scans, but you're asking if the game could instead request a particular amount of area to scan from orbit instead of a percentage of the planet.

I'm fairly sure this could be implemented.. area of a sphere is easy enough to calculate. This would remove all the percentages except for the completion percentage. But this assumes the game can access the size of the target body when generating the mission, potentially in a system far far away..

@Gliese852
Copy link
Contributor

I'm fairly sure this could be implemented.. area of a sphere is easy enough to calculate. This would remove all the percentages except for the completion percentage. But this assumes the game can access the size of the target body when generating the mission, potentially in a system far far away..

Oh well, this is the least of the problems, you are doing GetSystemBody, it's all there.

@mwerle
Copy link
Contributor Author

mwerle commented Oct 9, 2024

Oh well, this is the least of the problems, you are doing GetSystemBody, it's all there.

Ok no worries; based on some other code comments and tinkering with the System Map it appeared as if not all information was available when not in-system..

What do others think about this change?

@impaktor
Copy link
Member

impaktor commented Oct 9, 2024

What do others think about this change?

My headspace is more in fixing the "upstream" issue of why give / show the player the percentage of the body to scan in the first place. I assume orbit scan does the same as surface, in that it measures distance traveled along surface (but from high altitude). The information player might be interested in is if it's a large or small "scan job", but I also assume the difference is pretty negligible for orbit missions? For surface missions you have to do actual flying and constantly keep an eye on the altitude. For orbit scanner, I assume it's just smooth gliding for some time, so might not matter much to the player how many percent of the planet body is to be scanned?

Either way, I'm sure what ever solution you converge to will be an improvement over what we have now.

@Zireael07
Copy link

Changing to area might be a good idea (you no longer get the two % that mean different things), but I think it would be better left to a follow-up PR

@mwerle
Copy link
Contributor Author

mwerle commented Oct 9, 2024

For orbit scanner, I assume it's just smooth gliding for some time, so might not matter much to the player how many percent of the planet body is to be scanned?

It is, but it can take many in-game days which, given the low time acceleration near planets, can translate to hours of real-time. Not sure if the 1000x time acceleration kicks in within range of the scanner - but reducing the amount of real-time would increase the amount of time in-game (higher orbits take longer) and the potential to miss deadlines.

So a higher percentage means more time, but the actual amount of time required also depends on the size of the body. So it is probably a bit difficult for someone to gauge.

Converting the display to area instead of percentage might provide players with a better chance to estimate the amount of time required.. I'm assuming that scanning a particular amount of area should take roughly the same amount of time regardless of the size of the body. So it would be similar to the surface scan which also is a simple distance measure.

Alternatively the debug window provides the number of orbits required to achieve the desired coverage. This is currently not exposed to the player. This would probably also be fairly straightforward for a player to estimate to complete the contract as long as they check the size of the body - larger planets will take longer to orbit.


I'll see if I can come up with some implementations.. (lol, talk about feature-creep!)

@mwerle
Copy link
Contributor Author

mwerle commented Oct 9, 2024

So I've done some research and playing around.. changing the surface scans to km² is easily doable and probably should be done - doesn't make sense for it to be a distance. The calculations in the game are already in km², it's only the way they're being displayed that's distance rather than area for some reason. Adding Area units to the formatter was pretty trivial.

Orbital scans, on the other hand, are a different kettle of fish. Again, the progress is originally calculated in km², but then converted to a percentage of the area of the target body.. and that makes sense when you start realising the sizes involved. Earth's surface, for example, is 510 Mm² (5.1 * 10^14 m², or 510,000,000 km²).. Titan is 83 Mm². Phobos is 5695 km², so the range is also huge.

In an orbit at the minimum altitude (650km) on Earth, the XKM-650 scanner sweeps out an area of about 20,000 km² per second (according to the in-game calculations). This may seem a lot, but it would still take 12½ years just to scan Australia! (Of course, at higher altitudes it would go a lot quicker..)

But it seems that our in-game scanners aren't that great compared to real Earth Observation satellites which are around 500km altitude and can cover the entire Earth every couple of days.

Although I may have made some serious errors in my maths..

@Gliese852
Copy link
Contributor

Gliese852 commented Oct 9, 2024

I think large areas should not scare us - we don’t know exactly what resolution there is. Obviously, the orbital scan is very survey and small-scale.

@mwerle
Copy link
Contributor Author

mwerle commented Oct 9, 2024

I think large areas should not scare us - we don’t know exactly what resolution there is. Obviously, the orbital scan is very survey and small-scale.

The Scout mission generator so far has mostly given me orbital survey missions which take a looong time to complete (surface scan missions are generally quick), requiring multiple orbits at least, and often many orbits. So the orbital scans are not so small-scale. But they are nifty because they force players to get into orbits.. (although I guess most will simply click on the autopilot buttons..)

The resolution of the scans are very much a thing and calculated internally, just not exposed to the Player. This is what effectively limits the maximum height above the terrain at which the scan is active.


Large areas don't scare me - but I don't know how to display them nicely in the rather limited amount of screen real estate available.

  • 10,000 m² = 0.01 km²
  • 1,000,000 m² = 1 km²
  • 10,000 km² = 0.01 Mm²
  • 1,000,000 km² = 1 Mm²

I guess we could switch between m² to km² and then to Mm² earlier? But most people have no concept of Mm².. (I didn't before looking into it yesterday - Wikipaedia gives a really good overview).

-> 0 - 100 m² display with decimals (0.12m², 99.37 m²)
-> 100 - 9,999 m² display as m² with no decimals (237 m², 8,312 m²)
-> 10,000m² to 100km² : display km² with decimals (0.02 km², 12.94 km²)
-> etc.

@mwerle
Copy link
Contributor Author

mwerle commented Oct 10, 2024

Ok, I've tried this and I think it works.. might still require tweaking the mission generator though. I already reduced it by a factor of 10, but it still generates pretty long missions. I don't think I really affected the generator apart from converting the percentage to area and didn't playtest the original implementation enough to see how it compares, but it did take a long time as well.

These range from 1.6Mm² to 8.1Mm2.

Details
Info: Generated orbital scan mission, coverage=0.020064%, body_coverage=0.019422%, body_coverage_km2=1627868.236900km2
Info: Generated orbital scan mission, coverage=0.040726%, body_coverage=0.015963%, body_coverage_km2=8160559.381900km2
Info: Generated orbital scan mission, coverage=0.046700%, body_coverage=0.008052%, body_coverage_km2=44040562.392800km2
Info: Generated orbital scan mission, coverage=0.039873%, body_coverage=0.001236%, body_coverage_km2=101028920.272300km2
Info: Generated orbital scan mission, coverage=0.012820%, body_coverage=0.004096%, body_coverage_km2=4721460.098400km2

For reference, a 100% scan of Dione (3.97Mm²) in a "high orbit" (1.57Mm) took 8.5 days game-time and 12 minutes real-time at a time-acceleration of 1000x

I did not have enough time to perform the scan as well as fly to/from Mars to Dione to complete the mission in time, and that was with a full hold of fuel. That said, it was an "urgent" mission.

The display is nice though:

Details

Below 100km²
Screenshot_20241010_110636

Below 10,000km²
Screenshot_20241010_110755

From 10,000km² onwards (0.01Mm²)
Screenshot_20241010_110821

EDIT: Earth, 15.29Mm² took only 4.5 hours in-game (time acceleration 100x, ~3min real time) - medium orbit 3.97Mm. Increasing the orbit to 6.5Mm reduced the time to 4h in-game. Scan generated about 1060km²/s

@sturnclaw
Copy link
Member

will discuss in forums first in future.

Do note that the forums are ...quite asynchronous in nature. They're good for long-range discussion but discussion surrounding active implementation effort tends to happen here or on IRC (with the balance depending on the day). We normally consign feature requests there as an "idea repository".

@impaktor
Copy link
Member

... bug (feature)? Scan missions complete as soon as you dock (at least in the same system). But the mission description says the player needs to return to the mission-giver.

I think some missions are technically supposed to be able to complete if handed in at any station (i.e. you're speaking to a representative of an organization with offices on multiple planets). However, that definitely looks like a bug!

I thought this mission type required docking in the same faction space, but glancing at the code, seems like I'm wrong, thus my comment contributes nothing but noise, but since I've already typed it up....

@mwerle mwerle force-pushed the feat/scan_manager branch from c7f446f to c1aee64 Compare October 14, 2024 16:57
@mwerle mwerle marked this pull request as ready for review October 14, 2024 16:58
@mwerle
Copy link
Contributor Author

mwerle commented Oct 14, 2024

As there were no further comments/suggestions/concerns, I have now cleaned up the PR, rebased on master, and marked it "Ready for Review". I've also updated the description to reflect the current solution.

Finally, this PR includes a fix to prevent Scout missions from completing at the first port a player docks at after finishing a scan, as well as improving (imho) the way missions are displayed after being accepted in the players' mission log. The full description is now always shown, as well as the return location (if known). It now also integrates with the "Set Return Location" navigation button from the mission manager.

Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

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

Just a few things to look at here - I'll give this a full playtest as soon as I'm available to do so.

Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

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

I will potentially have more changes to suggest upon the morrow after a proper playtest - this is where I got to tonight.

@mwerle mwerle force-pushed the feat/scan_manager branch from 8d6092a to 741805a Compare October 17, 2024 23:24
@mwerle
Copy link
Contributor Author

mwerle commented Oct 17, 2024

Rebased on main; squashed commits; addressed most comments.

Please continue review at your leisure.

@Bodasey
Copy link

Bodasey commented Oct 18, 2024

first test results:

  • Getting the cash only when reached the station where the mission has been accepted now working.
  • Surface scan works normally, percentage completion is shown correctly.
  • New orbital scan missions sometimes have a very small area to cover and are completed in less than one second, a mission accepted in former master branch was also completed in two complete orbits, percentage completion did not work there.

Change suggestion: The symbols for scan missions from the bulletin board could/should also be used in the scan manager.

@mwerle
Copy link
Contributor Author

mwerle commented Oct 20, 2024

Change suggestion: The symbols for scan missions from the bulletin board could/should also be used in the scan manager.

This is non-trivial - the BBS icons are loaded from individual icon files as a PiImage, and then drawn by invoking the Draw method. The scan display is inherited from ItemCard which assumes the icon is in the ui.theme.icons and performs calculations to find the offset inside that file for the icon to be rendered before drawing it with ui.icon(). The ui.theme.icons currently does not include the BBS icon images.

ItemCard is also used in EquipCard so that would also need to be modified if we pass in a PiImage instead of a ui.theme.icons defined icon.

We should probably have a unified approach for icons in the game to avoid such discrepancies - either they should all be PiImages, or they should all be ui.theme.icons. Having individual icon files is probably better for modders..

@sturnclaw
Copy link
Member

I've not forgotten this, just been horribly busy over the weekend. If all goes well, will do final review in ~12hrs. Thank you again for your patience!

@mwerle
Copy link
Contributor Author

mwerle commented Oct 22, 2024

I've not forgotten this, just been horribly busy over the weekend. If all goes well, will do final review in ~12hrs. Thank you again for your patience!

No rush..

@mwerle mwerle force-pushed the feat/scan_manager branch from 741805a to cd7261c Compare October 22, 2024 07:48
As per [this discussion](pioneerspacesim#5932 (comment)),
all instances of quoted table identifiers are replaced with the
identifiers directly.
@mwerle mwerle force-pushed the feat/scan_manager branch from cd7261c to 50dfd04 Compare October 22, 2024 08:31
Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

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

I'm glad I playtested this, as I noticed that a mission to Saturn wants me to scan all 41,000 Mm² of Saturn's surface - and a mission to scan all 7.2Mm² of Oberon's surface pays a measly $620, barely enough to cover fuel for the very long trip into deep space.

Stuff like this tends to slip through the cracks on long PRs sadly - other than this I think the PR is good to go.

local coverageKm2 = utils.round(body_area, 0.0001)

local rewardAmount = reward
* p.reward_per_km * (math.pi * radiusKm * coverage)
Copy link
Member

Choose a reason for hiding this comment

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

Reward needs to be updated to use math.sqrt(coverageKm2) rather than pi * radiusKm * coverage.

Additionally, reward_per_km may need to be adjusted in the orbital_params definition to scale mission rewards back into line. Quick playtesting with the requested changes suggests it should be increased by up to 20% to make small moon scans viable and reward difficult low-orbit scans around large bodies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So 20% increase makes 0.08 => 0.096 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in c69f897

Anecdotally, the rewards seem to be significantly less now..

Copy link
Member

Choose a reason for hiding this comment

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

I'm noticing that as well. For now, let's set reward_per_km = 0.11, and reward_resolution_min = 12.0 - in testing, this seems to produce adequately-lucrative results. A follow-on PR should adjust MissionUtils.CalcReward to take into account 1) this is a two-way trip rather than a single-hop to a station, and 2) properly calculate the distance between the closest hyperspace jump-in point and the target body in a distant system.

Copy link
Contributor Author

@mwerle mwerle Oct 23, 2024

Choose a reason for hiding this comment

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

The rewards for these missions (before this PR) seem to be fairly high, given there's no risk and quite often are even in the same system. As soon as a player can afford the scanners this seems to be the most lucrative mission type for starting-out players (based on my rather limited playtime so far..)

A future PR could add some risks to some of the missions - specifically I'm thinking the "claim" scans could involve some risk - the background being that a rival group might want the target planet for themselves. Also adding companies prospecting for valuable mining rights - again, rival companies or environmental groups might want to prevent that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated rewards in d6d1f69

Copy link
Member

Choose a reason for hiding this comment

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

A future PR

These are all great ideas - I would hate for them to get lost. Please feel free to add them as a comment header to Scout.lua, or document them on the forum at your discretion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A future PR

These are all great ideas - I would hate for them to get lost. Please feel free to add them as a comment header to Scout.lua, or document them on the forum at your discretion.

Added in b8d008b

@mwerle
Copy link
Contributor Author

mwerle commented Oct 23, 2024

I'm glad I playtested this, as I noticed that a mission to Saturn wants me to scan all 41,000 Mm² of Saturn's surface - and a mission to scan all 7.2Mm² of Oberon's surface pays a measly $620, barely enough to cover fuel for the very long trip into deep space.

Stuff like this tends to slip through the cracks on long PRs sadly - other than this I think the PR is good to go.

Hmm, this is really odd - I playtested this quite a bit and the only time I got full coverage was for very tiny moons. I see the current code is wrong, as you point out, but due to all the squashing/rebasing, I've lost when it was working as intended.

.... ok, found it - I was multiplying the body_area by body_coverage, and at the same time reducing the number of decimals. The code was then refactored to use utils.round() and in that update I somehow dropped the multiplication. I guess I only briefly tested from that point onwards.

Well caught, thank you.

As for the reward amount, yes, I never adjusted it.

Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

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

Making the call to accept this PR. Rewards can/will be rebalanced in a future PR, ideally post-equipment-rework once we've had some ability to look at how scan missions function and what the player's "buy in" is to accept more lucrative missions.

Thanks @mwerle for continuing to update the PR in a timely manner even when my own availability is quite spotty!

Other gauges reload as part of the gauges module, but the ScanGuage does
not as it's implemented in a different module.

This commit adds an option 'onDebugReload' member to all guages, and the
gauges module now invokes it if it is implemented.

The ScanGauge is now properly reloaded when the Lua debug reload
keystroke is invoked.
The Scan manager used by Scout missions shows the completion percentage
of the current scan target while performing a scan. This is potentially
confusing for players when performing orbital scan missions which require
less than 100% of the planet to be scanned.

For example, the mission might request that 42% of the target planet
needs to be scanned, but the completion percentage always goes from
0..100% - confusing the player when it goes past 42%.

Surface scan missions do not have this issue as the scan target is
displayed in kilometres, so having a 0..100% completion is
understandable.

This change modifies both displays to show both the scan target as well
as the completion in square kilometres, eliminating the potentially
confusing percentages. It also adds a progress bar for the currently
active scan. This is to both show a more intuitive way to show to the
player how far along they are in completing the scan target, as well as
to provide faster feedback as the current completion amount can be slow
to update.

While these changes should not have impacted the time required to
complete a mission, additional play-testing is required to compare
the changes against the original implementation and ensure that all
missions remain achievable.

Also tweak the reward calculations and parameters following these
changes as suggested by Web-eWorks.
The check to see whether the mission can be completed had a bad logical
operation and completed the first time the player docks anywhere.

This fixes the check and missions now complete as expected only when the
player returns to the station at which the mission was issued.
Set the "desc.returnLocation" field on mission completion to show the
"Set Return Route" button once the mission is finished, and continue
to show the mission description. Also show the return location, if
known, as part of the mission description.

TODO: Further improve the display by breaking out the return location
text based on whether "dropoff" is set.
Raised in
pioneerspacesim#5932 (comment)

some additional mission / risk ideas. Adding them as a comment so they
don't get lost for now. These could be added when the overall mission
difficulty/reward structure is overhauled following completion of the
equipment overhaul.
@mwerle mwerle force-pushed the feat/scan_manager branch from d6d1f69 to b8d008b Compare October 24, 2024 07:17
@mwerle
Copy link
Contributor Author

mwerle commented Oct 24, 2024

Thanks @mwerle for continuing to update the PR in a timely manner even when my own availability is quite spotty!

Not at all - I've been away myself. This is only a hobby after all :)

Rebased and squashed the final changes.

@sturnclaw sturnclaw merged commit fe95f23 into pioneerspacesim:master Oct 24, 2024
@mwerle mwerle deleted the feat/scan_manager branch October 28, 2024 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Orbital Scan missions always require 100% completion even if contract requires less

6 participants

X Tutup