[Bonus] Source code tweaks

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

[Bonus] Source code tweaks

by Calinou » Wed Jul 23, 2014 20:55

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:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
moveratio = moveratio * 0.8;
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: [Bonus] Source code tweaks

by Krock » Wed Jul 23, 2014 20:58

Thanks. Cheat teacher.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Bonus] Source code tweaks

by rubenwardy » Wed Jul 23, 2014 21:11

Not really cheating, unless you make it so you can see in the dark. God mode or giving yourself fly is cheating.
 

paramat
Member
 
Posts: 2662
Joined: Sun Oct 28, 2012 00:05
GitHub: paramat

Re: [Bonus] Source code tweaks

by paramat » Thu Jul 24, 2014 01:22

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: 1372
Joined: Sat Jul 06, 2013 06:33

Re: [Bonus] Source code tweaks

by hoodedice » Thu Jul 24, 2014 01:54

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: 683
Joined: Tue Sep 18, 2012 21:37

Re: [Bonus] Source code tweaks

by Chinchow » Thu Jul 24, 2014 02:47

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: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: [Bonus] Source code tweaks

by Calinou » Thu Jul 24, 2014 07:17

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: 2980
Joined: Sun Sep 09, 2012 17:31

Re: [Bonus] Source code tweaks

by Sokomine » Thu Jul 24, 2014 14:31

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: 1101
Joined: Fri Aug 03, 2012 16:59

Re: [Bonus] Source code tweaks

by Casimir » Thu Jul 24, 2014 17:05

 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: [Bonus] Source code tweaks

by Casimir » Sun Feb 22, 2015 20:00

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.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: [Bonus] Source code tweaks

by Linuxdirk » Sun Feb 22, 2015 21:58

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: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: [Bonus] Source code tweaks

by Calinou » Mon Feb 23, 2015 16:44

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: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: [Bonus] Source code tweaks

by Linuxdirk » Tue Feb 24, 2015 20:29

Calinou wrote:… some people may vote against.

Why would someone vote against more “optional options” with sane defaults?
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: [Bonus] Source code tweaks

by Krock » Wed Feb 25, 2015 17:56

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?
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Bonus] Source code tweaks

by rubenwardy » Wed Feb 25, 2015 17:59

I'm going to be adding smooth movement settings for cinematic mode, if nobody does it first. Probably do it tomorrow.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: [Bonus] Source code tweaks

by Krock » Wed Feb 25, 2015 18:35

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
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: [Bonus] Source code tweaks

by rubenwardy » Wed Feb 25, 2015 18:37

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
 

User avatar
Linuxdirk
Member
 
Posts: 497
Joined: Wed Sep 17, 2014 11:21
GitHub: dsohler
In-game: Linuxdirk

Re: [Bonus] Source code tweaks

by Linuxdirk » Wed Feb 25, 2015 22:08

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?
 


Return to Minetest General

Who is online

Users browsing this forum: No registered users and 11 guests

cron