[Bonus] Source code tweaks

Post Reply
User avatar
Calinou
Member
Posts: 3168
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

[Bonus] Source code tweaks

by Calinou » Post

This topic guides you in changing settings which are normally not supposed to be changed. In order for this to work, you need to have the game's source code and you need to recompile it after each modification.


Third person distance
camera.cpp

You can change the third person distance by changing the value at line 385:

Code: Select all

for (int i = BS; i <= BS* 3.2; i++)

Damage flash and damage tilt
game.cpp

You can tweak or entirely disable the screen turning red when getting damaged, or the screen tilting when getting damaged, or both. Change the values between lines 2398 and 2403, or comment the instructions out using // like this:

Code: Select all

// damage_flash += 100.0;
// damage_flash += 8.0 * event.player_damage.amount;

// player->hurt_tilt_timer = 1.5;
// player->hurt_tilt_strength = event.player_damage.amount/2;
// player->hurt_tilt_strength = rangelim(player->hurt_tilt_strength, 2.0, 10.0);

Infotext position
game.cpp

The first number is the X offset (horizontal position from top-left of screen), the second one is the Y offset (vertical position from top-left of screen). Note that this doesn't scale depending on screen resolution, so the actual position will change depending on the screen aspect. Change the two numbers at the end of the line 1542:

Code: Select all

core::rect<s32>(0,0,400,text_height*5+5) + v2s32(100,200),

Light table
light.cpp

Many light tables are available, but only one of them can be used at a time. The only one which isn't commented out by default is the first one.

Most of them are commented by default, using #if 0. The first one is enabled using #if 1. Thus, to change the light table, you have to comment out the first one by changing #if 1 to #if 0 and enable another one by changing #if 0 to #if 1. Make sure only one light table is enabled at once!


Other player movement smoothing
content_cao.cpp

Change the value at line 109. Increasing it will make it less smooth but more instant, whereas decreasing it makes it less responsive by smoother. Older Minetest versions used a value like 0.5:

Code: Select all

moveratio = moveratio * 0.8;

User avatar
Krock
Developer
Posts: 4691
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Bonus] Source code tweaks

by Krock » Post

Thanks. Cheat teacher.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
rubenwardy
Moderator
Posts: 7028
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: London, United Kingdom
Contact:

Re: [Bonus] Source code tweaks

by rubenwardy » Post

Not really cheating, unless you make it so you can see in the dark. God mode or giving yourself fly is cheating.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
paramat
Developer
Posts: 3700
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat
IRC: paramat
Location: UK

Re: [Bonus] Source code tweaks

by paramat » Post

Thanks for this, i find damage tilt very disorientating, sickening, it should be possible to disable it in minetest.conf. I have a strange form of motion sickness not triggered by most Minetest motion, but i don't like view bobbing or the Minecraft FOV changes i see in videos.

User avatar
hoodedice
Member
Posts: 1374
Joined: Sat Jul 06, 2013 06:33
GitHub: hoodedice
IRC: hoodedice
In-game: hoodedice
Location: world
Contact:

Re: [Bonus] Source code tweaks

by hoodedice » Post

Hmm, there is also a third player camera offset in the lua api. You can use set_eye_offset to do that (https://github.com/minetest/minetest/bl ... .txt#L1908)

Here is something I did while playing around with it:

Image
7:42 PM - Bauglio: I think if you go to staples you could steal firmware from a fax machine that would run better than win10 does on any platform
7:42 PM - Bauglio: so fudge the stable build
7:43 PM - Bauglio: get the staple build

User avatar
Chinchow
Member
Posts: 684
Joined: Tue Sep 18, 2012 21:37

Re: [Bonus] Source code tweaks

by Chinchow » Post

hoodedice wrote:Hmm, there is also a third player camera offset in the lua api. You can use set_eye_offset to do that (https://github.com/minetest/minetest/bl ... .txt#L1908)

Here is something I did while playing around with it:

Image
Over the shoulder minetest gameplay.

User avatar
Calinou
Member
Posts: 3168
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: [Bonus] Source code tweaks

by Calinou » Post

rubenwardy wrote:Not really cheating, unless you make it so you can see in the dark. God mode or giving yourself fly is cheating.
I use the debug light table because my screen makes stuff very dark. Without it, it's impossible to even walk around at night. It also makes block lighting look much better.

Sokomine
Member
Posts: 4317
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Bonus] Source code tweaks

by Sokomine » Post

Calinou wrote: I use the debug light table because my screen makes stuff very dark. Without it, it's impossible to even walk around at night. It also makes block lighting look much better.
Seems I've got a similar problem. People sometimes complain that my houses are too brightly lit, while on screenshots or videos taken in the dark, it's almost impossible for me to make out what's going on.

Thanks for the thread!
A list of my mods can be found here.

User avatar
Casimir
Member
Posts: 1207
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: [Bonus] Source code tweaks

by Casimir » Post


User avatar
Casimir
Member
Posts: 1207
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: [Bonus] Source code tweaks

by Casimir » Post

One click drawing in craft
guiFormSpecMenu.cpp
line 3207

There is a feature that lets you "draw" your items on to the craft grid, similar to minecraft. But it is almost unusable at the moment. This is how to change it to one click. Just add the comments and recompile.

Code: Select all

		else if(updown == -1) {
			// Mouse has been moved and rmb is down and mouse pointer just
			// entered a new inventory field (checked in the entry-if, this
			// is the only action here that is generated by mouse movement)
			if(m_selected_item != NULL && s.isValid()){
				// Move 1 item
				// TODO: middle mouse to move 10 items might be handy
//				if (m_rmouse_auto_place) {
					// Only move an item if the destination slot is empty
					// or contains the same item type as what is going to be
					// moved
//					InventoryList *list_from = inv_selected->getList(m_selected_item->listname);
//					InventoryList *list_to = inv_s->getList(s.listname);
//					assert(list_from && list_to);
//					ItemStack stack_from = list_from->getItem(m_selected_item->i);
//					ItemStack stack_to = list_to->getItem(s.i);
//					if (stack_to.empty() || stack_to.name == stack_from.name)
						move_amount = 1;
//				}
			}
		}
Immediate Respawn
game.cpp
line 3028

Respawn without being prompted with a button. This i only useful when using random-input. Add the line marked with "Add this" and add the comments in the lines below.

Code: Select all

		} else if (event.type == CE_DEATHSCREEN) {
			client->sendRespawn(); // Add this.
			//show_deathscreen(&current_formspec, client, gamedef, texture_src,
			//		 device, client);

			chat_backend->addMessage(L"", L"You died.");

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

Re: [Bonus] Source code tweaks

by Linuxdirk » Post

Calinou wrote:Third person distance
Damage flash and damage tilt
Infotext position
Light table
Other player movement smoothing
Casimir wrote:One click drawing in craft
Immediate Respawn
And the main question here is: Why aren’t this options in minetest.conf but hardcoded values?

:)

User avatar
Calinou
Member
Posts: 3168
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou
Location: Troyes, France
Contact:

Re: [Bonus] Source code tweaks

by Calinou » Post

A pull request could be made for that, but I guess you would need one pull request per variable (or two) added. Else, some people may vote against.

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

Re: [Bonus] Source code tweaks

by Linuxdirk » Post

Calinou wrote:… some people may vote against.
Why would someone vote against more “optional options” with sane defaults?

User avatar
Krock
Developer
Posts: 4691
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Bonus] Source code tweaks

by Krock » Post

Linuxdirk wrote:
Calinou wrote:… some people may vote against.
Why would someone vote against more “optional options” with sane defaults?
Would you like to have over 9000 different settings?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
rubenwardy
Moderator
Posts: 7028
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: London, United Kingdom
Contact:

Re: [Bonus] Source code tweaks

by rubenwardy » Post

I'm going to be adding smooth movement settings for cinematic mode, if nobody does it first. Probably do it tomorrow.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Krock
Developer
Posts: 4691
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Bonus] Source code tweaks

by Krock » Post

rubenwardy wrote:I'm going to be adding smooth movement settings for cinematic mode, if nobody does it first. Probably do it tomorrow.
You're 4 hours too late; master already has that feature - it's amazing.
https://github.com/minetest/minetest/commits
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
rubenwardy
Moderator
Posts: 7028
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: London, United Kingdom
Contact:

Re: [Bonus] Source code tweaks

by rubenwardy » Post

Krock wrote:
rubenwardy wrote:I'm going to be adding smooth movement settings for cinematic mode, if nobody does it first. Probably do it tomorrow.
You're 4 hours too late; master already has that feature - it's amazing.
https://github.com/minetest/minetest/commits
...

I wrote that commit. It only adds camera smoothing, not movement smoothing.

And thank you :P
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

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

Re: [Bonus] Source code tweaks

by Linuxdirk » Post

Krock wrote:Would you like to have over 9000 different settings?
If they’re all optional and with sane default and do not clutter minetest.conf: Yes, why not?

User avatar
Casimir
Member
Posts: 1207
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: [Bonus] Source code tweaks

by Casimir » Post

Does someone know how the lighttable works now? To me the night is much to bright and I would like to change that.

Post Reply