Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
799 stars 90 forks source link

Redesigned Option menu #55

Open Phazorknight opened 6 months ago

Phazorknight commented 6 months ago

Creating a new issue as some issues mention stuff that all apply to this:

I'm planning on redesigning the Options menu to expose more parameters and settings. The plan is to group options of similar categories under tabs like a lot of games these days do.

My hope is to also use this to fold in the rebinding menu from #19

Phazorknight commented 6 months ago

Creating a list of potential options to be added:

Graphics/Display:

Gameplay:

Controls:

ac-arcana commented 6 months ago

Gamepad thumbstick deadzone?

Bezoika commented 6 months ago

I already did this in my project, but for graphics maybe add borderless fullscreen rather than only exclusive fullscreen. And an FOV Slider?

Phazorknight commented 6 months ago

I've just pushed the first version of the new TabMenu in https://github.com/Phazorknight/Cogito/commit/b785a1a4273e5ebad07463051048359c6dd50532 Be aware that this doesn't include any new options yet, just shows off the new menu style and navigation. This should make it easier though to add new options going foward.

Phazorknight commented 6 months ago

I seem to have broken how the options cfg saves/loads with this new menu. The game doesn't seem to retain saved settings on my end, but I'm not sure why...

generrosity commented 6 months ago

Very nice!

@Phazorknight I found that the setting for flipping Y axis worked immediate, and setting AA seemed to be remembered between sessions once applied?

I certainly got confused that the "pause menu" scene is "tab_menu" 😉

Could I suggest;

Cool stuff :)

Phazorknight commented 6 months ago

When I open the pause menu again after using 'Resume', the Resume button still think its :hovered?

This is due to the script manually grabbing focus of the Resume button for gamepad navigation and is expected behaviour. Can definitely refined though, like adding an input device check before grabbing focus.

I will hide the doubled up title labels.

I found that the setting for flipping Y axis worked immediate, and setting AA seemed to be remembered between sessions once applied?

For me, it seems quite random, but between Godot Engine sessions, settings definitely get lost somehow.

Phazorknight commented 6 months ago

I've just pushed a minor update to this in https://github.com/Phazorknight/Cogito/commit/901a2bef817bbcfbc5e3b3d3ef35568b14e53145 Fixed some of the bugs I described earlier, so options should now save again properly.

I've also added a setting to properly set window mode instead of just having a full screen toggle.

Planning to keep chipping away at this.

Phazorknight commented 6 months ago

Okay, I'm officially asking for help now 😅

I think the new options menu in TabMenu is working as intended, but for some reason the settings to stay saved on my end.

Here are my repro steps, as tested in https://github.com/Phazorknight/Cogito/commit/69b212e22ed7a139bd9173d0bb0a08ad1a75911e :

  1. Start game from editor > Open TabMenu > Go to Graphics tab > Set settings > Click "Apply changes"
  2. Quit game. > Start game again from editor > It loads all my settings saved in the previous session.
  3. Quit game again. > Start game again > All saved settings are reset to defaults.

I'm probably missing some simple function call in the right spot or something. If someone could take a look, I'd be grateful.

generrosity commented 6 months ago

I added the following code into startup_loader and tab_menu_options

func load_options():
    print("TABS: load")
func save_options():
    print("TABS: saving")
    print(anti_aliasing_2d_option_button.get_selected_id())
func set_msaa(mode, index):
    print("TAB: msaa set ")
    print(index)

All sorts of confusing things occuring, but most importantly, when you open the pause menu for the first time you get a "TABS: load" x1 and "TABS: saving" x2 with incorrect 0 values. I think it shouldn't be running that at that time, the dropdown box might not have been set by that stage.

Would it be that you set the volume in the tab settings, and setting the volume saves the config file??

I'm also not seeing "msaa set" from the tabs menu, only at game startup 😟 I think you are emitting a signal rather than calling the setter directly (which might be more correct)

Phazorknight commented 6 months ago

I think you're right. Originally the options got saved whenever the value of the volume sliders changes. I kept this in the new structure, but it looks like it caused the config to be overwritten with default values on load.

I commented out th _on_apply_changes_pressed() calls inisde the value change functions for the sliders and that seemed to have fixed this. Though with this for now the volume sliders don't get saved, but that should be an easy fix.

ksjfhor commented 5 months ago

grafik

I thought about adding some preset options for performance and such things, but that require access to the worldenviroment, would you mind if I change that around from one of the demo scenes to one global ? For sure I will keep the settings. But where to place it: Prefab Scenes, SceneManagement or .. ?

Phazorknight commented 5 months ago

Oh this is an interesting question. So as I understand it, some settings in the WorldEnvironment definitely have to be more scene-specific in my book (Sky, ambient light, Color grading). I know that scenes can have more than one world environment in them, so I wonder if we could set it up in a way that scenes can have their own WorldEnvironment for these scene-specific things, and then we apply the "Global WorldEnvironment" with the settings that make sense to have options for.

@ksjfhor If you're up for it, would you maybe have a separate test scene to give this a try? The options menu itself looks fantastic, love the layout. Also my two cents are that I'd personally not let the user control color adjustments (Brightness is okay). 😁

ksjfhor commented 5 months ago

As you can see, I am not yet done implementing the settings 🙃 The controllerinput makes it a bit unusual for me with unique names instead of signals, I adapt to that.

Godot does not make use of a second world enviroment, only the first has an effect in a scene... big butt: a second enviroment can be set on the camera to override the first. Butt (again) I do not know if it is possible to keep certain settings from that first enviroment and only override some things e.g. the skybox.

The node even got under adjustments a color correction where a 2D or 3D Texture could be placed, or a curve, but I have absolutly not the slightest clue of how such witchcraft is done.

So for first I would place that in Scenemanagment ?

Phazorknight commented 5 months ago

I do not know if it is possible to keep certain settings from that first enviroment and only override some things.

Hm, maybe one approach would be to get a reference to the level scenes world environment and then overwrite that environments' properties with what is set in the options cfg. This could be done during scene load. That way we also wouldn't need a global world environment scene.

So for first I would place that in Scenemanagment ?

What do you want to place there? But I'd assume yes. 😁

ksjfhor commented 5 months ago

Hm, maybe one approach would be to get a reference to the level scenes world environment and then overwrite that environments' properties with what is set in the options cfg. This could be done during scene load. That way we also wouldn't need a global world environment scene.

For sure there are ways, if nothing works we could make a parser which forces all input except the skybox to be loaded from the world enviroment with the user settings. 😄 But I don't know if this is the best way, but as long as it works I would be happy.

So far I got a few things implemented: grafik grafik

I split up the Video and the Graphics as it looked overwhelming with the others Tabs pretty empty (for now, we can always glue them back together).

Limits FPS needs a label that gives out the current value. The main menu is fixed to 720p, but something is still cramping it together verticaly. A Directionallight is also 'missing' but only in the main menu, I am not sure if needed, but it would be better if the player would see what the Options affect, in this case the shadow size.

The World Environment 😅 is now placed under Scene Management. So far I can load the Brightness and the Contrast with the right slider point. The presets work and all the new Buttons are also set to as what they were saved, except for the 2D- and 3D AA when I set them with set_msaa("msaa_3d",0) and set_msaa("msaa_2d",0) at least the buttons will not change, thus it should be emitted. Maybe I copy another way for these.

But again I ran into the Trap of changing the Optiontabs with the gamepad shoulderbuttons aaaand it crashed :/ So that is something I want to fix now, too.

and I overread it somehow: I just applied the cogito theme to the tabs 👍 But thats enough for today, time for me to touch some grass. :D

ksjfhor commented 5 months ago

So a few words to #158: What I miss so far is a good way to reliable check if a node exists, so that I could ignore an non-existent DirectionalLight3D but set the ones in the Demo Scenes. On the other hand: The QualityGridContainer has 2 columns, but you also could easily set them to 1: grafik

So far not really done with this, but I go on vacation soon and you should not wait for snaily me.

brian-holsters commented 5 months ago

whenever i'm dealing with finding nodes that could be literally anywhere or even not exist at all, I tend to fall back to using groups, you could set up groups to be used by nodes affected by settings and have the settings logic search for said nodes using said groups.

get_tree().get_nodes_in_group("my_group")

groups can be kind of awkward to work with in the current version of godot (iirc in 4.3 there's a bit of an overhaul to group management), but I think it can still be a decent solution.

Phazorknight commented 4 months ago

@ksjfhor / @brian-holsters In regard to node references, I sometimes use one of the global scripts for this (eg. the scene manager has a reference to the player node in the current scene). I can see something similar to grab/update a reference to the scene's WorldEnvironment node, which can be updated, and then the settings set accordingly each time a scene is loaded. Groups can definitely be helpful when needed.

Regarding the Graphics options themselves, I have to say that I really don't like the results of some of them, and I'm not sure if I'd want to implement it this way. Global Illumination completely breaks the look of a scene if it's not set up for it, creating light bleed everywhere. Bloom can get blown out, so I personally would make it that the player could only toggle it between a dev-set amount and off. That being said, some of it works nicely, the AO settings as well as the Shadow settings are quite nice to have.

@ksjfhor, I know I sound quite critical, so I want to emphasize how much I appreciate your effort in this part. It's very enlightening to see how you've accomplished creating the options menu and the breadth of parameters that can be influenced. Coming from Unity, the way Godot combines certain settings with its Environment resource is a bit baffling to me, and while I haven't done a lot of research yet, I haven't found a lot of documentation or examples on how to handle user-controlled Settings like this in practice.

In the interest of Cogito being more "plug-and-play" with devs adding their own settings as needed, I might limit how many options we include out-of-the-box, if the implementation gets too convoluted or with lots of caveats.

ksjfhor commented 4 months ago

@Phazorknight Welcome to the cult of the little blue robot I guess 😅

Do you know the demos ? https://github.com/godotengine/godot-demo-projects/tree/master/3d/global_illumination You can find them from the docs: https://docs.godotengine.org/en/stable/tutorials/3d/global_illumination/introduction_to_global_illumination.html This is also were the settings come from, except the load save and so on.

I comment out the options for bloom and global illumination, because I am also not a big fan of it at all. If other devs want to have it in their levels, they just have to comment the lines back in again and turn the nodes to visible. Because .... the lightning will be different (better) again soon, see https://github.com/godotengine/godot/pull/86267 and/or Juans Youtube Channel. This is going to replace SDFGI with HDDAGI. In fact SDFGI just came with Godot 4, so it is not that old and it can be adjusted in many ways, since it is very variable and I only adopted the existing world environment.

Such changes will for sure not instantly look perfect, when a new feature suddenly spawns out of the high grass with default options, usually you adapt (lower) you light intensity when you activate bloom and such. The new feature may help a bit with that, but both global illuminations (SDFGI and HDDAGI) are usually for bigger maps. So reimplementing the new one is not much of a problem that way and on export the commentend stuff is not worth to be considered, even with the (two) unused signals right now.

There is the VoxelGI but it brings its own light bleeding: https://github.com/godotengine/godot/issues/83025 LightmapGI needs uv2, not sure if that would be an option.

and .... light round lamp in the CEO Office is a little sun on its own, when this is reduced and the wall is connected to the celling it looks not that bad, I made the celling thicker in #158 🤓

@brian-holsters Yes, I had a similar idea when I sat in the car, but then it was already too late as I cannot drive and code at the same time. 😄 So this is now also build in. The Directionallight3D of a scene got to be placed in the group "DirectionalLight" to can be set from within the options menu.

generrosity commented 4 months ago

Just adding my 10c here :) tho I need to re-download the templates and play from scratch again

ksjfhor commented 4 months ago

Oh money :> giphy-4128359672

@generrosity I added the "Apply Changes" to every Tab, for consistency and better looks, thus in the graphics tab all of the options are instantly set and stayed like they were, at least for me 🤷 The OptionsTabMenu adds all "first row childen" as tabs, so not sure how I could make one not-Tab visible the whole time...

Your third idea seems like a good fit for this, but for now I would wait on feedback from Phazorknight before I add or change anything further :)

Phazorknight commented 4 months ago

@generrosity

do you have a guiding "rule of thumb" for how complicated you want the default presentation of your template to be?

If we're talking about the out-of-the-box features (aka someone downloads Cogito and runs the game), then it should be a decent showcase of what's included in the template and ideally inspire people on how they can use it to make their own game.

I'm hesitant about some player-exposed graphic settings that are very Environment dependant for a main reason: The level scene / game style needs to be set up for them. I know currently the Cogito Demo scenes aren't "professionally" set up to look the best, but even if we "fix it", if a dev then has their own level that's in a different art style or uses different environment settings, the included graphics menu would enable to player to "break" the look/settings of that scene. This would cause the dev more work, either removing those settings or tweaking their level scene to make it work. Either way, it's additional work for them, and I don't want Cogito to create MORE work for devs.

In addition to this, @ksjfhor mentioned that there's potentially more changes to the available Lighting settings incoming. All of this currently makes me lean towards including less player-exposed settings, and rather let developers only add what they need themselves.

do you know how you want a dev to add more options? Like having an array of modules with checkmarks?

This of course would be very convenient, but it's honestly not the main purpose of Cogito, so I don't consider this a priority. I think/hope we might see proper "3D game graphic options" add-ons on the Asset Library soon, which would probably handle this way better, and we could then work towards integrating it.

I'd still love to have at least stuff like shadow quality/resoultion, or AO settings, that can already help. (I say this still haven't had time to fully look into this more. Sorry @ksjfhor , I'll get to it when I'm back from my trip, I swear).