Block loading

Post Reply
Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

Block loading

by Nore » Post

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
Location: Germany

by PilzAdam » Post

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
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

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

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

by thetoon » Post

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 :

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
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

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.

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

by OmniStudent » Post

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 :

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
Moderator
Posts: 6289
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

by rubenwardy » Post

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 :

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
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

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

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

by andrea65751 » Post

hi..
no it is not possible.

User avatar
prestidigitator
Member
Posts: 640
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Post

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.

User avatar
lkjoel
Member
Posts: 779
Joined: Wed Feb 29, 2012 19:27
Location: Gallifrey
Contact:

by lkjoel » Post

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.

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

by paramat » Post

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 for basic income. PayPal viewtopic.php?f=3&t=14935 Patreon https://www.patreon.com/paramat

User avatar
prestidigitator
Member
Posts: 640
Joined: Thu Feb 21, 2013 23:54

by prestidigitator » Post

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
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

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

by Sokomine » Post

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest