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

[WIP] Basic pause menu settings #6965

Conversation

ThomasMonroe314
Copy link
Contributor

@ThomasMonroe314 ThomasMonroe314 commented Jan 25, 2018

This is a work in progress of issue #6722

Please give suggestions for settings you would like to see in #6722

WIP Screenshots(will be updated as work gets done):

screenshot

@paramat
Copy link
Contributor

paramat commented Jan 25, 2018

The minimum normal FOV allowable needs to be tuned to avoid normal FOV being treated as a zoom and triggering the loading of distant world.

src/camera.cpp Outdated
@@ -457,6 +457,8 @@ void Camera::update(LocalPlayer* player, f32 frametime, f32 busytime, f32 tool_r
fov_degrees = player->getZoomFOV();
} else {
fov_degrees = m_cache_fov;
//if the callback(see line 63) gets added then this won't need to be here.
m_cache_fov = g_settings->getFloat("fov");
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this is temporary as we can't fetch this from settings this often.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, all it needs to do is be able to be reset when the FOV gets changed, but as there is no callback yet, this has to be here. As far as I have checked, it doesn't affect my performance at all.

Copy link
Contributor

Choose a reason for hiding this comment

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

The performance impact is probably not very noticeable, but these small efforts add up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, which is why the callbacks would need to be added

@paramat paramat added @ Client / Audiovisuals WIP Feature ✨ PRs that add or enhance a feature labels Jan 25, 2018
@ThomasMonroe314 ThomasMonroe314 force-pushed the basic_pause_menu_settings branch from 233d2a2 to 612e1db Compare January 26, 2018 02:41
@ThomasMonroe314 ThomasMonroe314 force-pushed the basic_pause_menu_settings branch from 612e1db to cb3f4a0 Compare January 26, 2018 02:48
@ThomasMonroe314
Copy link
Contributor Author

@paramat I got the fov to use a callback 😃

@paramat
Copy link
Contributor

paramat commented Jan 26, 2018

Enabling fog doesn't need to be in an in-game menu because we have F3 for that, neither does enable 3D clouds, that is something a user sets very rarely.

@paramat
Copy link
Contributor

paramat commented Jan 26, 2018

Or fast mode, there is a key for that.

@ThomasMonroe314
Copy link
Contributor Author

@paramat the reason I added fast, fly, etc is because a server owner asked if it would be possible because they are getting tired of explaining exactly how to go fast, fly, etc step-by-step.

@ThomasMonroe314
Copy link
Contributor Author

@TekhnaeRaav I would like the feature discussion to be on #6722 while the code gets discussed here

@paramat
Copy link
Contributor

paramat commented Jan 26, 2018

the reason I added fast, fly, etc is because a server owner asked if it would be possible because they are getting tired of explaining exactly how to go fast, fly, etc step-by-step.

From IRC this refers to touchscreens:

20:48 ThomasMonroe paramat I added fast, fly, and noclip because of a convo I had with aerozoic in which he said:
20:48 ThomasMonroe [08:15:56] �<�aerozoic�>�� I've had to explain fast/fly/noclip to so many people on touch screens and they can never find it.

I'm not sure what controls Android users have access to, and i suggest we wait for discussion of Android controls before adding them in this PR. So for this PR i suggest only being concerned about desktop MT.

This still stands so i am 👎 for now:

Enabling fog doesn't need to be in an in-game menu because we have F3 for that, neither does enable 3D clouds, that is something a user sets very rarely.

'enable build where you stand' might be justified if builders need to switch often between those modes while building, @Sokomine

@paramat
Copy link
Contributor

paramat commented Jan 26, 2018

IRC:
21:16 Wayward_One noclip, fast, fly, f5, and f7 are all available on android by pressing the gear icon on the right of the screen.

So no need for those. Any new controls added for Android could be added to that 'gear' menu.
Please keep this PR for desktop only.

@ThomasMonroe314
Copy link
Contributor Author

Ok I will do that

@paramat
Copy link
Contributor

paramat commented Jan 28, 2018

Why are 'fall bobbing' and 'view bobbing' present in the code changes?

@ThomasMonroe314
Copy link
Contributor Author

erm idk, I think I just did all of them XD

@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Jan 29, 2018

The minimum normal FOV allowable needs to be larger than 1.775 / 2 radians

Does the engine actively prevent this from happening, even if set in minetest.conf? Or is it currently just a GUI thing?

@paramat
Copy link
Contributor

paramat commented Jan 29, 2018

It might be better to make the minimum FOV 55 or 60 degrees because 51 is a weird number.

@paramat paramat added the Action / change needed Code still needs changes (PR) / more information requested (Issues) label Jan 29, 2018
@ThomasMonroe314
Copy link
Contributor Author

I agree, 51 is kind of odd

@paramat
Copy link
Contributor

paramat commented Jan 30, 2018

We have a key for autoforward already.
'build where you stand' needs to be discussed, i don't see a good reason for it, even Sokomine who added the setting and relies on it doesn't see much need for it to be changed in-game.

How about just adding FOV for now?

@ThomasMonroe314
Copy link
Contributor Author

ok, sounds good to me, as I already re-adjusted the files to make it easier to add new settings.

src/camera.cpp Outdated
@@ -40,6 +40,20 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define WIELDMESH_OFFSET_X 55.0f
#define WIELDMESH_OFFSET_Y -35.0f

void Camera::onSettingsChange(const std::string &name){
if (name == "fov"){
Copy link
Contributor

Choose a reason for hiding this comment

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

brace removal in this whole block.

src/camera.h Outdated
@@ -165,6 +168,8 @@ class Camera
void drawNametags();

inline void addArmInertia(f32 player_yaw);

//f32 m_cache_fov;
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

leftover from an experiment

src/game.cpp Outdated
@@ -139,7 +139,7 @@ struct LocalFormspecHandler : public TextDest
void gotText(const StringMap &fields)
{
if (m_formname == "MT_PAUSE_MENU") {
if (fields.find("btn_sound") != fields.end()) {
if (fields.find("btn_options") != fields.end()) {
g_gamecallback->changeVolume();
Copy link
Contributor

Choose a reason for hiding this comment

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

rename the callback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah good catch, thanks

@@ -0,0 +1,259 @@
/*
Part of Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

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

Add yourself to the copyright headers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

are you sure?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

Also, the filename could be better, maybe something like 'guiPauseSettings'?

void removeChildren();
/*
Remove and re-add (or reposition) stuff
*/
void addCheckBox(const std::string name,const std::string setting, int ID, int xoff, int yoff);
Copy link
Contributor

Choose a reason for hiding this comment

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

These helper functions should be put in GUIModalMenu imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No I don't that would be a good idea because these functions work only with GUIOptionsChange as they use m_size.

e->setPos(init);
}

void GUIOptionsChange::addDynText(const std::string name, int value, const std::string ending, int ID, int xoff, int yoff){
Copy link
Contributor

Choose a reason for hiding this comment

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

whitespace issues

Copy link
Contributor

@red-001 red-001 Jan 30, 2018

Choose a reason for hiding this comment

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

name and ending can be const references.

core::stringw temp_text = text;
delete[] text;

temp_text += core::stringw(value)+core::stringw(wgettext(ending.c_str()));
Copy link
Contributor

Choose a reason for hiding this comment

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

space after +

true, this, ID);
}

void GUIOptionsChange::addText(const std::string name, int ID, int xoff, int yoff){
Copy link
Contributor

Choose a reason for hiding this comment

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

space

Copy link
Contributor

Choose a reason for hiding this comment

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

name can be a const reference.

true, this, ID);
}

void GUIOptionsChange::updateDynText(const SEvent& event, const std::string setting, int scale, int ID, const std::string beginning, const std::string ending){
Copy link
Contributor

Choose a reason for hiding this comment

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

space and const references to strings

@@ -140,7 +140,7 @@ class MainGameCallback : public IGameCallback

virtual void changeVolume()
Copy link
Contributor

@red-001 red-001 Jan 30, 2018

Choose a reason for hiding this comment

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

rename this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, I had forgotten about doing that.

@red-001
Copy link
Contributor

red-001 commented Jan 30, 2018

src/camera.cpp Outdated
m_cache_fov = g_settings->getFloat("fov");
}else if(name == "view_bobbing_amount"){
m_cache_view_bobbing_amount = g_settings->getFloat("view_bobbing_amount");
}else if(name == "fall_bobbing_amount"){
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering why 'view/fall bobbing' settings are included here if they are not being changed in-game?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm removing those in the next commit


if (gui::IGUIElement *e = getElementFromId(ID_forwardButton))
e->remove();
GUIModalMenu::removeChildren();
Copy link
Contributor

Choose a reason for hiding this comment

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

just removeChildren(); not GUIModalMenu::removeChildren();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂️ I knew that

@paramat
Copy link
Contributor

paramat commented Feb 20, 2018

Is the screenshot up to date? 'build where you stand' and 'autoforward' need removing.
The formspec is too tall for the settings it contains.

I'm not sure about the way this is structured in the expectation of adding many extra in-game settings. Maybe it could be simpler if it just did what it needed to adjust FOV?
I'm unconvinced FOV needs to be settable in-game, it's something that you adjust a few times to see what you like then never touch again, so low priority to be in-game settable.
👎

@ThomasMonroe314
Copy link
Contributor Author

@paramat updated screenshot.

@thecow275
Copy link

@paramat @ThomasMonroe314 almost all modern game engines have FOV sliders in pause menu under settings though but i havent had any need myself to change fov ingame but some other settings could be usefull though

@paramat
Copy link
Contributor

paramat commented Apr 12, 2018

See #7234 the lowest settable FOV is 45 degrees, not 55 as i stated before.

row+=spacing;
addDynText("Field Of View: ", FOV, "", ID_fovText, column_pos, row);
row+=spacing;
addSlider(ID_fovSlider, 160, 51, FOV, column_pos, row);
Copy link
Contributor

Choose a reason for hiding this comment

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

Minimum can be 45 degrees, i tested the lowest that does not trigger loading of distant world.

@paramat paramat added the Rebase needed The PR needs to be rebased by its author label Apr 12, 2018
@paramat
Copy link
Contributor

paramat commented Apr 12, 2018

Closing for now due to inactivity but should be reopened on progress.

@ClobberXD
Copy link
Contributor

@ThomasMonroe314 Any progress? Are you still interested in working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Action / change needed Code still needs changes (PR) / more information requested (Issues) @ Client / Audiovisuals Feature ✨ PRs that add or enhance a feature Rebase needed The PR needs to be rebased by its author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants