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

Added water options to 'TopMenubar/Settings' menu. #3142

Closed

Conversation

ohlidalp
Copy link
Member

@ohlidalp ohlidalp commented Mar 24, 2024

I tried to investigate #3137 but got nothing. So I at least analyzed the water code and added UI for tweaking HydraX water.

Both basic water with waves and HydraX water boil down to the same thing: a dynamic grid-mesh updated in code. The only major difference is how the waves are calculated: Basic uses configurable "wave trains", HydraX uses Perlin noise with adjustable params (via .hdx config file). Since both systems are in our codebase, it would make sense to unify them. To better understand how the system operates, I added the UI.

obrazek

@ohlidalp ohlidalp requested a review from tritonas00 March 24, 2024 23:15
@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from 6f67ed0 to 7409958 Compare March 25, 2024 01:01
@ohlidalp
Copy link
Member Author

ohlidalp commented Mar 25, 2024

I got curious if I could change water type in-game by simply destroying the water subsystem and initing it again. Well, it works.
obrazek
Also waves are now toggleable there, that was already possible before just the UI was missing.
Note the HydraX options only show up when HydraX is active.

@ohlidalp ohlidalp changed the title Added HydraX wave params to 'TopMenubar/Settings' menu. Added water options to 'TopMenubar/Settings' menu. Mar 25, 2024
@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from 7409958 to e0f8b62 Compare June 30, 2024 17:57
@ohlidalp
Copy link
Member Author

I've bumped this PR with one small fix. I couldn't fix the glitch but I got closer, see #3137 (comment)

@CuriousMike56
Copy link
Member

CuriousMike56 commented Aug 6, 2024

RoR_2024-08-06_01-59-35.mp4

Switching between reflection water types often results in white, and Hydrax always crashes:

RoR_2024-08-06_01-58-00

The options remain shown when on a terrain that doesn't feature water (but doesn't do anything besides crash without error if Hydrax is selected)

Real time waves adjustment is fun, also now would be a good opportunity to add a water level slider.

@ohlidalp
Copy link
Member Author

Looks like something isn't cleaned up properly and then duplicates and breaks. Might also be Cg or Ogre bug.

@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from e0f8b62 to cf91749 Compare August 18, 2024 21:03
@ohlidalp
Copy link
Member Author

@CuriousMike56 I tried only under Dx9 and didn't see the white surfaces... but I got a lot of other glitches/crashes. I fixed switching between all modes except Hydrax which still crashes when toggled the 2nd time.

@CuriousMike56
Copy link
Member

Looks like the white surfaces are gone now.

Hydrax options seem to do nothing:

RoR_2024-08-18_21-55-36.mp4

Switching to Hydrax results in visual glitches:

RoR_2024-08-18_22-03-45.mp4

And finally, basic water visuals freeze if waves are disabled:

RoR_2024-08-18_21-59-46.mp4

@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from 41239a5 to 6c53409 Compare September 1, 2024 17:31
@ohlidalp
Copy link
Member Author

ohlidalp commented Sep 5, 2024

Fixed the dummy hydra options and freezing waves.

Hydra glitches on 2nd activation are still there - the problem is something isn't cleaned up right, but Hydrax actually does clean up it's stuff, so either I missed something or there's an OGRE bug (note we use outdated OGRE 11.6)

@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from 6c53409 to 086a11a Compare September 18, 2024 15:46
@ohlidalp
Copy link
Member Author

I fixed HydraX crashing on nd activation, but now it seems to hang when returning to menu >:/

@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from 086a11a to f42b3fa Compare September 18, 2024 15:59
@CuriousMike56
Copy link
Member

It may be best to just not include Hydrax for now (or hide it behind a setting), its visuals are still busted for me:
RoR_2024-09-19_03-25-58

@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from 32f0e91 to 0d8438a Compare September 19, 2024 14:42
ohlidalp added a commit to ohlidalp/rigs-of-rods that referenced this pull request Sep 20, 2024
                // I tried making all water modes toggleable, see RigsOfRods#3142
                //    but I gave up on HydraX, it always looks different when started for 2nd time.
                // For the time being, only basic water modes are toggleable.
@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from 0d8438a to 5bdf133 Compare September 20, 2024 11:05
@ohlidalp
Copy link
Member Author

Done. HydraX excluded from the top menubar dropdown. I'll continue fixing it after OGRE13+ port.
obrazek
obrazek

@CuriousMike56
Copy link
Member

  • The options appear on terrains that don't feature water, changing mode there does nothing (would be fun to enable water on these maps though)
    image
  • Returning to menu crashes with Hydrax enabled
  • Hydrax sliders have too much range IMO, it's easy to create horrors and tank your frame rate:
    RoR_2024-09-22_21-50-00
    Grid complexity should max at 500, and strength/elevation at 25.

The module type isn't configurable, it's hardcoddd in hydrax setup - file 'HydraxWater.cpp', function `InitHydrax()`.

The corresponding dummy line was removed from file 'HydraxDefault.hdx' and the check for it's presence was removed from file 'hydrax/Module.cpp'
Most occurences are long commented out, but this one slipped because nobody called that function until I started working on diag. UI.
This version is based on HydraX hardcoded defaults, but needs to be adjusted based on RoR's defaults.
Also cleaned up code and fixed a bug in Terrain.cpp - game would crash if other Water mode than HydraX was selected.
Codechanges:
* DustPool.cpp - // Make sure water wasn't disabled in Top menubar - if yes, just drop the particle.
* Water.cpp - just code cleanup actually - to clarify the water plane is the same with or without waves - so they can safely be toggled ad-hoc.
* GUIUtils - DrawGCombo() now returns bool - true if value changed.
* GUI_TopMenubar.cpp - change cvar `gfx_water_mode` and run `Terrain::reInitWater()`
* Terrain - added function `reInitWater()`
Uninitialized variables `m_cam_forced`* :/

I cleaned up the variable init, using in-class initializers for all.
Summary of changes:
* introduced ✉️ `MSG_SIM_REINIT_WATER_REQUESTED` - Request restarting water subsystem based on cvar 'gfx_water_mode'; sent by TopMenubar UI, also accepted from scripts via `game.pushMessage()`.
* HydraX resources are now loaded each time.
* Removed all direct interaction with HydraX - both classic water (Water.cpp, `class Water`) and HydraX water (HydraxWater.cpp, `class HydraxWater`) are now controlled exclusively via interface `IWater` - see comments in file 'IWater.h'
* Added 'active_water_mode' field to `IWater` - because the cvar 'gfx_water_mode' can now change anytime.
                // I tried making all water modes toggleable, see RigsOfRods#3142
                //    but I gave up on HydraX, it always looks different when started for 2nd time.
                // For the time being, only basic water modes are toggleable.
@ohlidalp ohlidalp force-pushed the 3137_Miner34Dev_hydraxwaves branch from 5bdf133 to 8c9755a Compare September 26, 2024 23:42
@ohlidalp
Copy link
Member Author

Closing until OGRE14 port... too much garbage. There are 2 outstanding issues:

@ohlidalp ohlidalp closed this Sep 27, 2024
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.

2 participants