Skip to content

Introduce climate objects #23774

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

Merged
merged 18 commits into from
Mar 10, 2025
Merged

Conversation

AaronVanGeffen
Copy link
Member

@AaronVanGeffen AaronVanGeffen commented Feb 2, 2025

This PR introduces a new climate object type, allowing players to create custom climates. The built-in climates are moved to a new set of objects. Existing scenarios and saves are automatically adjusted to include the relevant climate object type as well.

The distributions generated by the current object code don't exactly match the hardcoded ones. This may affect the chance of precipitation. I'll need to figure out if this means the biases need to be adjusted. The distributions now match.

In addition to the renaming from #23755, there's a bit more renaming going on in this PR. Specifically, I aimed to make a clearer distinction between 'weather' and 'climate'. This proposal and discussion has been split off to #23786 and can be discussed in that PR. This has been settled.

Depends on OpenRCT2/objects#375

To do

  • Add dedicated string for climate object type
  • Sort out the scripting API (currently returns a blank string)
  • Climate object 'previews' in object selection window
  • Fix snow transitions using rain animations
  • Add properties for 'cold' and 'hot' item bonus temperatures
  • Purge old ClimateSetAction (requires new replays, so just made it no-op for now)
  • Update replays to compensate for deleted action
  • Testing!

climate-types-3

@github-actions github-actions bot added the requires dependency Another change should be merged first. label Feb 4, 2025
@AaronVanGeffen
Copy link
Member Author

AaronVanGeffen commented Feb 7, 2025

Okay, I think I've figured out how to make my translated distributions match the originals. Consider the following example of a 'vanilla' climate:

static constexpr WeatherPattern kClimatePatternsCoolAndWet[] = {
    {  8, 18, { S, P, P, P, P, P, C, C, C, C, C, C, C, R, R, R, H, H, S, S, S, S, S } },
    { 10, 21, { P, P, P, P, P, C, C, C, C, C, C, C, C, C, R, R, R, H, H, H, T, S, S } },
    { 14, 17, { S, S, S, P, P, P, P, P, P, C, C, C, C, R, R, R, H, S, S, S, S, S, S } },
    { 17, 17, { S, S, S, S, P, P, P, P, P, P, P, C, C, C, C, R, R, S, S, S, S, S, S } },
    { 19, 23, { S, S, S, S, S, S, S, S, S, S, P, P, P, P, P, P, C, C, C, C, C, R, H } },
    { 20, 23, { S, S, S, S, S, S, P, P, P, P, P, P, P, P, C, C, C, C, R, H, H, H, T } },
    { 16, 19, { S, S, S, P, P, P, P, P, C, C, C, C, C, C, R, R, H, H, T, S, S, S, S } },
    { 13, 16, { S, S, P, P, P, P, C, C, C, C, C, C, R, R, H, T, S, S, S, S, S, S, S } },
};

If we expand the constants to look at the underlying values, it reveals:

static constexpr WeatherPattern kClimatePatternsCoolAndWet[] = {
    {  8, 18, { 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 0, 0, 0, 0, 0 } },
    { 10, 21, { 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 0, 0 } },
    { 14, 17, { 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 0, 0, 0, 0, 0, 0 } },
    { 17, 17, { 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 0, 0, 0, 0, 0, 0 } },
    { 19, 23, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 4 } },
    { 20, 23, { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 4, 4, 4, 5 } },
    { 16, 19, { 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 4, 5, 0, 0, 0, 0 } },
    { 13, 16, { 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0 } },
};

The new climate objects summarise these distributions by tallying up the frequencies for all weather types. Clearly, this isn't enough, because the values for 0 appear at the front and back of the distribution! Compared to a 'sorted' distribution, it is effectively rotated/offset.

I propose we implement this by adding a distributionRotation parameter to the objects. That should allow us to reconstruct the climate climates while also keeping the object definitions compact.

@AaronVanGeffen AaronVanGeffen force-pushed the climate-objects branch 2 times, most recently from 22900a4 to 45cfb46 Compare February 13, 2025 15:54
@AaronVanGeffen AaronVanGeffen marked this pull request as ready for review February 13, 2025 19:45
@ZeeMaji

This comment was marked as resolved.

@ZeeMaji

This comment was marked as resolved.

@AaronVanGeffen

This comment was marked as outdated.

@AaronVanGeffen AaronVanGeffen force-pushed the climate-objects branch 2 times, most recently from ab6e534 to a5f953f Compare February 22, 2025 15:47
@AaronVanGeffen AaronVanGeffen added changelog This issue/PR deserves a changelog entry. park file version Requires updating the park file version number labels Feb 22, 2025
@AaronVanGeffen
Copy link
Member Author

A question: how did you move the data to the objects? Scripted, or manually? Just want to know if I need to be extra careful when checking the objects metadata.

You're right to think that I've used a script. I've posted a link to my Python script in OpenRCT2/objects#375.

@Gymnasiast
Copy link
Member

Ok, I was just checking, as the scriptName property was initially incorrect.

@AaronVanGeffen
Copy link
Member Author

Right, that's ultimately a new property with a mapping that I'd manually created.

Speaking of new properties, I haven't made a new 'beta' objects release to account for the 'item temperature thresholds' now being part of the climate objects. This is why CI currently fails. The up-to-date objects can be obtained from OpenRCT2/objects#375, however.

@github-actions github-actions bot removed the requires dependency Another change should be merged first. label Mar 9, 2025
Copy link

github-actions bot commented Mar 9, 2025

This PR/issue depends on:

@Gymnasiast
Copy link
Member

I tested it and found no further bugs. I have therefore merged the objects PR and pulled it in.

Also asked @ZeeMaji to do a final test. If that succeeds, this can be merged as far as I’m concerned.

@AaronVanGeffen
Copy link
Member Author

Thanks for testing and creating a new objects bundle release.

I'll still need to purge the old ClimateSetAction and update the replays.

@AaronVanGeffen
Copy link
Member Author

Looks like replays are serialised more cleverly than I gave them credit for. It seems an update won't be required, after all.

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Mar 10, 2025

One little issue we talked about a few days ago but i forgot to bring up here was the rounding on the previews for climate objects seem to be a little off as the numbers displayed don't add up to 100%. On a custom object i made the blizzard shows as 0% despite being enabled in october.
Screenshot at 2025-03-10 10-38-41
Object used:
object.zip

@AaronVanGeffen
Copy link
Member Author

One little issue we talked about a few days ago but i forgot to bring up here was the rounding on the previews for climate objects seem to be a little off as the numbers displayed don't add up to 100%. On a custom object i made the blizzard shows as 0% despite being enabled in october.

While unfortunate, this has to do with integer rounding in the UI preview. I'm not sure there's a trivial way to go about solving this tbh. Can we let this one slide?

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Mar 10, 2025

That would be fine for now, to me at least.

@ZeeMaji
Copy link
Contributor

ZeeMaji commented Mar 10, 2025

I let the game run for a few dozen years each with both a vanilla climate (warm) and a custom climate i made with snow enabled and didn't encounter any issues.

I also checked and the proper climate object is imported in old scenarios/saves as expected.

Does this seem sufficient or should i test more things?

@AaronVanGeffen
Copy link
Member Author

@ZeeMaji Thanks for testing. Sounds great! I'm glad.

@AaronVanGeffen AaronVanGeffen merged commit b29fb51 into OpenRCT2:develop Mar 10, 2025
23 checks passed
@AaronVanGeffen AaronVanGeffen deleted the climate-objects branch March 10, 2025 22:45
Gymnasiast added a commit that referenced this pull request Apr 5, 2025
- Feature: [#22646] New scenario files now contain a minimap image, shown in the scenario selection window.
- Feature: [#23774] Climates can now be customised using objects.
- Feature: [#23876] New park save files now contain a preview image, shown in the load/save window.
- Improved: [#24078] Handrails on Wooden Roller Coaster station sprites with no platforms have been removed.
- Improved: [objects#379] Add additional colour schemes to Mine Train.
- Change: [#23932] The land rights window now checks “Land Owned” by default.
- Change: [#23936] The ‘guests prefer less/more intense rides’ settings have been turned into a dropdown.
- Change: [#24059] The ‘select other ride’ button is now available in the track designs manager.
- Change: [#24067] [Plugin] Registered menu items are now listed alphabetically.
- Change: [#24070] Footpath selection menus now show object names on hover using a tooltip.
- Change: [#24101] Frozen peeps are no longer removed when using the 'remove all guests' cheat.
- Fix: [#4225] Ride Construction window offers non-existent banked sloped to level curve (original bug).
- Fix: [#5281] Missing supports on miniature railways built backwards.
- Fix: [#7222] Transparent pixels in sloped path tunnels (original bug).
- Fix: [#10379] Banners outside the park can be renamed and modified (original bug).
- Fix: [#10582] Low clearance tunnels below water are drawn incorrectly (original bug).
- Fix: [#17524, #23710] Station bases are drawn on many ride types when the “No entrance, no platform station” style is selected.
- Fix: [#18169] CJK, Arabic and Vietnamese display all text as ‘???’ on Android.
- Fix: [#18309] Flying and Multi Dimension trains glitch when changing between inverted and uninverted track when uncap fps is on.
- Fix: [#19506] Queue paths can be placed on level crossings by replacing an existing regular path.
- Fix: [#21803] The park fence is drawn differently in OpenGL compared to software rendering when zoomed out.
- Fix: [#21824] Some sprites are drawn incorrectly when zoomed out in OpenGL rendering.
- Fix: [#21908] Ride mode warnings when hovering track designs.
- Fix: [#22820] OpenGL does not draw masked sprites correctly.
- Fix: [#22961] Clicking on the construction preview places duplicate flat rides and stalls.
- Fix: [#23359] Scripting: Add car.moveToTrack, an easier API than setting car.trackLocation directly.
- Fix: [#23443] New GOG version of RCT2 is not extracted correctly.
- Fix: [#23484] Stray coloured pixels on castle-themed stations and Roman-themed entrances/exits (original bug).
- Fix: [#23486] Object selection minimum requirements can be bypassed with close window hotkey.
- Fix: [#23743] Parks with guest goals over 32767 do not appear in the scenario list.
- Fix: [#23844] Sound effects keep playing when loading another save.
- Fix: [#23881] Compiling on Raspbian/arm-linux-gnueabihf fails.
- Fix: [#23891] Inverted Hairpin Coaster track can draw over things above it (original bug).
- Fix: [#23892] Gentle banked Wooden Roller Coaster track glitches as trains pass (original bug).
- Fix: [#23897] Reverse Freefall Coaster slope up to vertical track piece does not draw a vertical tunnel.
- Fix: [#23910] Heartline Twister Coaster track can draw over things above it (original bug).
- Fix: [#23939] Incorrect assertion when trying to load heightmap.
- Fix: [#23941] Underflow in “Repay loan and achieve a certain park value” objective when using Japanese.
- Fix: [#23949] Walls draw over sloped rear water edges and those edge sprites are misaligned (original bug).
- Fix: [#23960] Corner path fences can draw over adjacent sloped land (original bug).
- Fix: [#23961] Lamps and queue line tvs draw incorrectly on paths with fences.
- Fix: [#23983] Ordering files by size does not work and occasionally crashes the game.
- Fix: [#24009] [Plugin] The object manager API does not identify recently introduced object types.
- Fix: [#24028] Giga and LSM Launched Coaster booster sprites have pixels that draw over transparent pixels.
- Fix: [#24077] Track Designer crashes when clicking the park fence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog This issue/PR deserves a changelog entry. park file version Requires updating the park file version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants