New to coding, need help with deeper modifications

Post Reply
User avatar
plaguedoctor
New member
Posts: 7
Joined: Fri Sep 21, 2018 02:47

New to coding, need help with deeper modifications

by plaguedoctor » Post

I'm new to coding (and to minetest) and I have some rather ambitious goals for a project using minetest as it's base.

And when I say new to coding, I mean really really new.

I would like a tiny bit of help editing some of the core components of the game. For a start, I would like to see if I can fix the accelerating/wobbly/skating mouse and make it snappy and responsive, but despite all my searching I can't find any help on how to begin finding the right parts of the game to edit. In fact, I can't seem to find anything written in c++, just the LUA files.

I'm not expecting you to hold my hand through all of this, but if you could quickly point out to me which files I need to open and where they are, that would be greatly appreciated. I can sift through and start working it out for myself from there.

Thanks.

(Edit) I've already made an item, familiarized myself with how to make basic skins/mobs and a little work on biomes and I found all of that exceedingly easy.

User avatar
DrFrankenstone
Member
Posts: 231
Joined: Tue May 24, 2016 05:36
GitHub: treer
Location: Australia
Contact:

Re: New to coding, need help with deeper modifications

by DrFrankenstone » Post

plaguedoctor wrote:For a start, I would like to see if I can fix the accelerating/wobbly/skating mouse and make it snappy and responsive
You might have cinematic mode turned on, it's normally bound to F8 and toggles between snappy and eased
plaguedoctor wrote:I can't seem to find anything written in c++, just the LUA files.
The Minetest engine (mostly C++) is separate to "Minetest Game" (mostly Lua), so you might be looking at minetest_game, the engine is at https://github.com/minetest/minetest and there's plenty of cpp files in /src

User avatar
plaguedoctor
New member
Posts: 7
Joined: Fri Sep 21, 2018 02:47

Re: New to coding, need help with deeper modifications

by plaguedoctor » Post

You might have cinematic mode turned on
I didn't, but cinematic makes it much much much worse. I guess I'm just a stickler for snappy mouse control from playing competitive FPS games.
there's plenty of cpp files in /src
-_- omg I knew it would turn out I had done something stupid. Right there, camera.cpp
Even lets me adjust FOV, nice.

Thank you for graciously indulging my stupidity.

User avatar
Linuxdirk
Member
Posts: 3218
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: New to coding, need help with deeper modifications

by Linuxdirk » Post

plaguedoctor wrote:I didn't, but cinematic makes it much much much worse. I guess I'm just a stickler for snappy mouse control from playing competitive FPS games.
There's something wrong on your side then. Mouse works properly. :)

User avatar
plaguedoctor
New member
Posts: 7
Joined: Fri Sep 21, 2018 02:47

Re: New to coding, need help with deeper modifications

by plaguedoctor » Post

Linuxdirk wrote:There's something wrong on your side then. Mouse works properly. :)
Like I said, I play a lot of competitive FPS games at a high level, I'm 30 years old and have been doing so since I was 16. I'm accustomed to very very snappy and responsive mouse controls, and I have very snappy responses in the games that I play regularly. I have a very expensive Asus RoG mouse and I have modified my OS settings for accuracy.

I'm sure it's not an issue for most people, but there is absolutely mouse lag in minetest. :)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: New to coding, need help with deeper modifications

by texmex » Post

Does setting fps_max in advanced settings to, let’s say, 999 help? (Restart may be needed)

User avatar
plaguedoctor
New member
Posts: 7
Joined: Fri Sep 21, 2018 02:47

Re: New to coding, need help with deeper modifications

by plaguedoctor » Post

texmex wrote:Does setting fps_max
Yes! That's really good! Thanks! :D

User avatar
Linuxdirk
Member
Posts: 3218
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: New to coding, need help with deeper modifications

by Linuxdirk » Post

plaguedoctor wrote:I'm 30 years old and have been doing so since I was 16.
When I was 16 Counter-Strike was still a Half-Life mod in early beta state. Back then competitive gaming wasn’t “ranked matches” between teams but “clans” had “clan wars” and we were actually good in this and were local celebrities (oh glorious time … I miss this so much) till people moved away (yes, Internet gaming was not an option back in 1999).

Oh and remember Quake III Arena? Had a small clan there, too and together we ran a medium popular server. Just getting all the nostalgic feels right now … Later on I was part of a semi-successful OpenArena team but since then I stuck to Sauerbraten (which unfortunately is pretty much dead except Venice Inferno and Rigatoni Rugby – I wish there were people interested in reviving Ogros, though).
plaguedoctor wrote:… but there is absolutely mouse lag in minetest. :)
Sorry, still can’t confirm after sharing some nostalgia with you :)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: New to coding, need help with deeper modifications

by texmex » Post

plaguedoctor wrote:
texmex wrote:Does setting fps_max
Yes! That's really good! Thanks! :D
Cool! That bug has been pestering me since the start. What’s your platform?

User avatar
plaguedoctor
New member
Posts: 7
Joined: Fri Sep 21, 2018 02:47

Re: New to coding, need help with deeper modifications

by plaguedoctor » Post

Linuxdirk wrote: Sorry, still can’t confirm after sharing some nostalgia with you :)
Which is very easy to do when you're...errm I mean when you ignore the comments where someone else had the same problem, and their solution worked for me :)
Last edited by plaguedoctor on Fri Sep 21, 2018 18:59, edited 1 time in total.

User avatar
plaguedoctor
New member
Posts: 7
Joined: Fri Sep 21, 2018 02:47

Re: New to coding, need help with deeper modifications

by plaguedoctor » Post

texmex wrote:
plaguedoctor wrote:
texmex wrote:Does setting fps_max
Yes! That's really good! Thanks! :D
Cool! That bug has been pestering me since the start. What’s your platform?
Ubuntu 18.04.1 LTS, radeon card (not sure that it's relevant here but it seems to be an issue in a lot of games)

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: New to coding, need help with deeper modifications

by texmex » Post

plaguedoctor wrote: Ubuntu 18.04.1 LTS, radeon card (not sure that it's relevant here but it seems to be an issue in a lot of games)
Hmm, I’ve only seen it on macOS up until now. Please take the time report this in https://github.com/minetest/minetest/issues/2697 as this is now on at least two platforms and also because macOS alone is a too small of a platform (?!) for core devs to care.

User avatar
plaguedoctor
New member
Posts: 7
Joined: Fri Sep 21, 2018 02:47

Re: New to coding, need help with deeper modifications

by plaguedoctor » Post

texmex wrote:this is now on at least two platforms
I'm sure it's on more than that. Everyone on youtube seems a tiny bit "floaty" to me. It's just that it's too fine for most people to notice, and most people don't care either. And it doesn't affect gameplay.

I'll submit a request.

A few other bits of information: I have 2 screens, one proper computer monitor at 1080p and a cheap television at (supposedly) 1080p (which doesn't work so well, it runs on a slightly shrunken aspect ratio which doesn't fill the screen properly but it's the best I can do). I'm also overclocked to 5ghz (which could potentially cause issues, maybe sort of possibly. It's far higher than anything available and might cause issues in specific cases.) Any of that the same for you? Dual monitor especially?

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: New to coding, need help with deeper modifications

by texmex » Post

External cheap 1080p monitor is what I use. Old MacBook. I believe the engine is quite unoptimized. Compare with Build A World, which engine is also built on Irrlicht.

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: New to coding, need help with deeper modifications

by Hybrid Dog » Post

There's the code related to fps_max:
https://github.com/minetest/minetest/bl ... .cpp#L3906
I've set fps_max to 61 some time ago because I thought that maybe something bigger than 60 fps may avoid trigger sleeping when vsync is enabled.
Now I changed code to print messages always when fps_max is exceeded:

Code: Select all

diff --git a/src/game.cpp b/src/game.cpp
index 34606172..05f0fcdd 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -3901,9 +3901,13 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime)
                        ? g_settings->getFloat("pause_fps_max")
                        : g_settings->getFloat("fps_max"));
 
+       bool slept = false;
        if (fps_timings->busy_time < frametime_min) {
                fps_timings->sleep_time = frametime_min - fps_timings->busy_time;
+               errorstream << "fps_max exceeded, sleeping " << fps_timings->sleep_time
+                       << "ms!" << std::endl;
                device->sleep(fps_timings->sleep_time);
+               slept = true;
        } else {
                fps_timings->sleep_time = 0;
        }
@@ -3914,9 +3918,15 @@ inline void Game::limitFps(FpsControl *fps_timings, f32 *dtime)
         * device rather than calculating it by adding sleep_time to time.
         */
 
+       u32 t_before_sleep = time;
+
        device->getTimer()->tick(); // Update device timer
        time = device->getTimer()->getTime();
 
+       if (slept)
+               errorstream << "actually slept " << time - t_before_sleep << "ms."
+                               << std::endl;
+
        if (time > last_time)  // Make sure last_time hasn't overflowed
                *dtime = (time - last_time) / 1000.0;
        else

Surprisingly it constantly sleeps although I set fps_max to 61, something bigger than my screen fps, and vsync is enabled (I did not start minetest with vblank_mode=0).
It also slept while loading the game, this did not slow down loading because it's another thread.

Code: Select all

2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 8ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 8ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 4ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 4ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 2ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 2ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 6ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 6ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 8ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 6ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 6ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 5ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 5ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 8ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 9ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 8ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 8ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 5ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 5ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 2ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 3ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 8ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 8ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 8ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 5ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 6ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 6ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 6ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
2018-09-30 20:37:09: ERROR[Main]: actually slept 7ms.
2018-09-30 20:37:09: ERROR[Main]: fps_max exceeded, sleeping 7ms!
I tried to find the threshold of the fps_max setting where it does not sleep.
When setting it to 120 it still sleeps, but less frequently and mostly only about 1 millisecond.

fps_max was introduced 6 years ago: https://github.com/minetest/minetest/co ... 4162eR1211

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
Linuxdirk
Member
Posts: 3218
Joined: Wed Sep 17, 2014 11:21
In-game: Linuxdirk
Location: Germany
Contact:

Re: New to coding, need help with deeper modifications

by Linuxdirk » Post

Hybrid Dog wrote:fps_max was introduced 6 years ago: https://github.com/minetest/minetest/co ... 4162eR1211
And it still does not work properly.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests