Block loading

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

Block loading

by Nore » Thu Dec 13, 2012 17:37

Is it possible to add a parameter to change the distance where the blocks get unloaded ? Or even to add a node that forces block loading ?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Thu Dec 13, 2012 17:43

You cant add a node that forces update.
But there are some settings in minetest.conf, something like client_unload_unused_data_timeout or something like this.
 

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Thu Dec 13, 2012 18:03

A node that forces update could not even be done in the C++ code ? (with a file to know where those block are)
 

thetoon
Member
 
Posts: 106
Joined: Tue Dec 11, 2012 12:55

by thetoon » Thu Dec 13, 2012 18:37

There should be a way, but it's more like a hack than a real solution. Haven't tested it yet, for I'm not on my computer. In environment.cpp, from line 990, you got :

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::list<v3s16> players_blockpos;
                for(core::list<Player*>::Iterator
                                i = m_players.begin();
                                i != m_players.end(); i++)
                {
                        Player *player = *i;
                        // Ignore disconnected players
                        if(player->peer_id == 0)
                                continue;
                        v3s16 blockpos = getNodeBlockPos(
                                        floatToInt(player->getPosition(), BS));
                        players_blockpos.push_back(blockpos);
                }


players_blockpos is a list containing players' positions (populated in the following loop). Later in the code, elements in that list are used as centers of perimeters within which blocks are considered active.

If, for any reason, coordinates where added to that list without being any player's position (say, from a table the map's sqlite file), I bet the perimeter (within active_block_range radius) around those coordinates would be considered active nonetheless.

What do you think?
 

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Thu Dec 13, 2012 18:43

It could work, but as I am no C coder (more like a Python coder), I don't know if it would work, and if it would not have any secondary effect on the rest.
 

OmniStudent
Member
 
Posts: 261
Joined: Sat Nov 03, 2012 06:40

by OmniStudent » Thu Dec 13, 2012 19:04

thetoon wrote:There should be a way, but it's more like a hack than a real solution. Haven't tested it yet, for I'm not on my computer. In environment.cpp, from line 990, you got :

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::list<v3s16> players_blockpos;
                for(core::list<Player*>::Iterator
                                i = m_players.begin();
                                i != m_players.end(); i++)
                {
                        Player *player = *i;
                        // Ignore disconnected players
                        if(player->peer_id == 0)
                                continue;
                        v3s16 blockpos = getNodeBlockPos(
                                        floatToInt(player->getPosition(), BS));
                        players_blockpos.push_back(blockpos);
                }


players_blockpos is a list containing players' positions (populated in the following loop). Later in the code, elements in that list are used as centers of perimeters within which blocks are considered active.

If, for any reason, coordinates where added to that list without being any player's position (say, from a table the map's sqlite file), I bet the perimeter (within active_block_range radius) around those coordinates would be considered active nonetheless.

What do you think?


Is this executed on the server or the client?
 

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

by rubenwardy » Thu Dec 13, 2012 19:05

OmniStudent wrote:
thetoon wrote:There should be a way, but it's more like a hack than a real solution. Haven't tested it yet, for I'm not on my computer. In environment.cpp, from line 990, you got :

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::list<v3s16> players_blockpos;
                for(core::list<Player*>::Iterator
                                i = m_players.begin();
                                i != m_players.end(); i++)
                {
                        Player *player = *i;
                        // Ignore disconnected players
                        if(player->peer_id == 0)
                                continue;
                        v3s16 blockpos = getNodeBlockPos(
                                        floatToInt(player->getPosition(), BS));
                        players_blockpos.push_back(blockpos);
                }


players_blockpos is a list containing players' positions (populated in the following loop). Later in the code, elements in that list are used as centers of perimeters within which blocks are considered active.

If, for any reason, coordinates where added to that list without being any player's position (say, from a table the map's sqlite file), I bet the perimeter (within active_block_range radius) around those coordinates would be considered active nonetheless.

What do you think?


Is this executed on the server or the client?

server
 

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Wed Jan 16, 2013 15:18

Would it be possible to add a function to do that to the modding API?
 

andrea65751
New member
 
Posts: 4
Joined: Thu Feb 14, 2013 13:01

by andrea65751 » Thu Feb 14, 2013 13:10

hi..
no it is not possible.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Fri Feb 22, 2013 00:59

I'd be more interested in an API function that forces a one-time load of a chunk with explicitly provided coordinates, as if a player had just visited (though not extending to surrounding chunks). I think this would be very useful for mods that need to know what's in some neighboring region of space, and consider it high enough priority not to just fall back to some default behavior if they get "ignore" nodes.
 

lkjoel
Member
 
Posts: 778
Joined: Wed Feb 29, 2012 19:27

by lkjoel » Fri Feb 22, 2013 01:33

prestidigitator wrote:I'd be more interested in an API function that forces a one-time load of a chunk with explicitly provided coordinates, as if a player had just visited (though not extending to surrounding chunks). I think this would be very useful for mods that need to know what's in some neighboring region of space, and consider it high enough priority not to just fall back to some default behavior if they get "ignore" nodes.

+10000000000

I'd do anything to have that, even help making it, if that's needed!!!
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.
 

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

by paramat » Fri Feb 22, 2013 10:05

prestidigitator wrote:I'd be more interested in an API function that forces a one-time load of a chunk with explicitly provided coordinates, as if a player had just visited (though not extending to surrounding chunks). I think this would be very useful for mods that need to know what's in some neighboring region of space, and consider it high enough priority not to just fall back to some default behavior if they get "ignore" nodes.

Yep i have some mods that need exactly this function (landup, moonlet).

Apparently this may have just been added, see this pull request https://github.com/celeron55/minetest/pull/446
I don't understand the technical language here so i'm not sure if it has gone ahead or not.
Last edited by paramat on Fri Feb 22, 2013 10:16, edited 1 time in total.
I rely on donations to help provide an income https://forum.minetest.net/viewtopic.php?f=3&t=14935
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Fri Feb 22, 2013 10:48

paramat wrote:
prestidigitator wrote:I'd be more interested in an API function that forces a one-time load of a chunk with explicitly provided coordinates, as if a player had just visited (though not extending to surrounding chunks). I think this would be very useful for mods that need to know what's in some neighboring region of space, and consider it high enough priority not to just fall back to some default behavior if they get "ignore" nodes.

Yep i have some mods that need exactly this function (landup, moonlet).

Apparently this may have just been added, see this pull request https://github.com/celeron55/minetest/pull/446
I don't understand the technical language here so i'm not sure if it has gone ahead or not.

Awesome! Yes, it looks like it may be included. So to do a one-time load I guess we'd spawn a probe entity, send it to the desired location, and then remove it after a moment's delay. Not too bad.
 

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Fri Feb 22, 2013 15:16

What you should do is:
- Declare a new invisible entity with force_load= true
- Create the entity at that location
- Wait 2 seconds (the server must update active blocks)
- Do your modifications
- Remove the entity

It has not been merged yet, but I wish it will be later (after all, it is my pull request).
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Fri Feb 22, 2013 15:56

That sounds good and would be very helpful! Hope it gets merged.
A list of my mods can be found here.
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 9 guests

cron