Better Victory Screen


Upon victory it shows various interesting game statistics, like the total amount of time you spent hand crafting and your peak power production. Can be added to an existing save.

Utilities
a month ago
1.1 - 2.0
25.5K

i [Implemented] A few small suggestions

10 months ago
(updated 10 months ago)

SE should get basic BVS support with some initial stats in the next update: https://i.imgur.com/72NA35n.png

I had a few ideas while implementing this:

1) It would be nice to be able to send parameters with the localized keys of stat names. For my case I wanted a Number of tier __1__ modules produced stat, where __1__ would be your highest tier produced. But I couldn't pass that parameter so I had to split it in 2 stats: "Highest module tier achieved" and "Number of highest tier modules produced".

2) The default BVS stats are Written In Title Case Like This ("Distance Walked" with a capital W), but the default Factorio victory screen doesn't do that ("Time played") so I think for consistency it should be written with normal capitalization.

3) For perfect mimicking of the vanilla victory screen (https://i.imgur.com/MhMGcCo.png), can you remove the thin black bars separating each stat?

4) If a stat has a tooltip, can you add a ⓘ icon at the end of the stat name automatically? Similar to what Factorio does in the Mod Settings menu.

5) What do you think of "Ores mined" as a default stat between "Items produced" and "Science packs consumed"? I think that would be interesting for most mods. Maybe "Ores produced" instead to be more generic... up to you.

10 months ago

Hello Wiwiweb! That looks really nice! Even cooler than what I had in mind.

About your suggestions:

1) Done
2) Done
3) Will fix when I figure out how.
4) Done. Note: This now has the caveat that each entry with a tooltip needs has_tooltip=true (or localised_tooltip={...}) explicitly set so that I can detect when to add the little info icon. But this was a good suggestion because the little icons look really nice.
5) Looking into it. I like the idea, just need to see if I can reliably find which items are ores.

I will try to publish the update today with the more configuribility if you want to use the newer interface.

Thanks for adding compatibility to Space Exploration! I really appreciate the effort and feedback. It's an honour to have my mod officially supported :)

10 months ago

Okay released version with more configurability for now.

I'm curious, did it take long to generate the Victory Screen GUI for you? I was aiming for massive SE saves so have had to do quite some optimization. My feeling is that the Peak Power stat would take the longest to calculate because I'm looping over each power pole. And I do't have a save as big as yours. Next time you run a test could you possibly see the profiler information that's printed out in the logs? Should look something like this (from a massive Nullius base, and Nullius still does some slow processing in the remote call).

  22.533 Script @__better-victory-screen__/scripts/trigger.lua:67: Showing to forces: {"player"}
  23.505 Script @__better-victory-screen__/scripts/trigger.lua:37: Successfully gathered statistics from: nullius
  23.814 Script @__better-victory-screen__/scripts/trigger.lua:115: Statistics collection profiling:
    Other mods: Duration: 971.431455ms
    Infrastructure: Duration: 0.355242ms
    Peak Power: Duration: 188.599256ms
    Chunk counter: Duration: 115.372997ms
    TOTAL: Duration: 1280.940906ms

Also, remember you can add custom victory messages depending on spaceship or secret victory. I didn't see it in your screenshot :)

10 months ago

Regarding point 3:
I made the gui framework for this, and I tried to remove the inner table borders when I made it initially.
It's impossible to remove table borders without removing them from the edges as well, which results in a really funky look.
The C++ styling for that isn't exposed to the Lua api, so can't really do much on that front.
I'm about to look into a more jank (internally) solution to this, which should look just like the vanilla gui if I can pull it off.

10 months ago
(updated 10 months ago)

I did not know the victory GUI style was one of the hardcoded C++ styling, nevermind then (Unless your hack works).

I think it took about 0.5 secs to generate the victory screen. I will give you performance stats next time I can, I can give you my save file too if you want.

To find items that are ores I would loop over game.get_filtered_entity_prototypes({{filter = "type", type = "resource"}}) and then just make sure each name corresponds to an item name to filter out fluid resources.

Also, remember you can add custom victory messages depending on spaceship or secret victory. I didn't see it in your screenshot :)

Yes I added some too, this is just the default message because I'm using /show-victory-screen.

Thanks for all your changes, I don't think I'll have too much free time this week so this might be released mostly as-is as "Basic compatibility" and then I'll add some more interesting stats later, maybe rearrange categories, in another update.

10 months ago

Performance from logs:

 313.135 Script @__better-victory-screen__/scripts/trigger.lua:115: Statistics collection profiling:
    Other mods: Duration: 2.098400ms
    Infrastructure: Duration: 1.680800ms
    Peak Power: Duration: 456.735700ms
    Chunk counter: Duration: 446.430400ms
    TOTAL: Duration: 911.675400ms

Profiling from FMTK:
https://imgur.com/a/omoOTV1

10 months ago

I got it to work, took some fiddling but the solution ended up being relatively clean all things considered. PR created :P

10 months ago

All suggestions have been implemented :)

New response