Replace all instances of a node in the entire world

User avatar
DuDraig
Member
 
Posts: 75
Joined: Sun Sep 28, 2014 17:56
IRC: DuDraig
In-game: DuDraig

Replace all instances of a node in the entire world

by DuDraig » Fri Jun 16, 2017 19:02

Is there a way to replace all instances of a node with another node in the entire world? I don't mean just the areas currently loaded like you can with an abm or worldedit, I mean the whole world at once.

Is there a way to do this online in the background while the players are logged in?
Is there a way to do this when the server is offline with an offline tool that modifies the world database directly?
 

User avatar
maikerumine
Member
 
Posts: 1249
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine
 

User avatar
DuDraig
Member
 
Posts: 75
Joined: Sun Sep 28, 2014 17:56
IRC: DuDraig
In-game: DuDraig

Re: Replace all instances of a node in the entire world

by DuDraig » Sat Jun 17, 2017 05:51

That does not actually replace the nodes, it merely causes them to be treated like another node. What I want is actual, immediate, world-wide replacement.
 

User avatar
Linuxdirk
Member
 
Posts: 990
Joined: Wed Sep 17, 2014 11:21
Location: Germany
GitHub: 4w
In-game: Linuxdirk

Re: Replace all instances of a node in the entire world

by Linuxdirk » Sat Jun 17, 2017 06:22

Impossible.

Maybe mess around with replacing the nodes directly in the SQLite database of the world (map.sqlite in ./worlds/worldname).
 

User avatar
DuDraig
Member
 
Posts: 75
Joined: Sun Sep 28, 2014 17:56
IRC: DuDraig
In-game: DuDraig

Re: Replace all instances of a node in the entire world

by DuDraig » Sat Jun 17, 2017 19:32

Nothing is ever impossible.

Online, the server would need to expose an API that allowed a background task to run through all the nodes in the world to make the replacement. If such an API does not already exist, then the question is what would it take to do so.

Replacing directly in the database would be the offline question in the OP -- except it would make more sense to use the database API routines already in the Minetest code base so that node acquisition and replacement could be done to any configured database and not just SQLite. I find it difficult to believe that no one has yet made such a useful and obvious offline tool.
 

User avatar
Linuxdirk
Member
 
Posts: 990
Joined: Wed Sep 17, 2014 11:21
Location: Germany
GitHub: 4w
In-game: Linuxdirk

Re: Replace all instances of a node in the entire world

by Linuxdirk » Sat Jun 17, 2017 20:44

DuDraig wrote:I find it difficult to believe that no one has yet made such a useful and obvious offline tool.

You mean like all the various DBMS’s that are available for all of the databases that can be used by Minetest? :)
 

User avatar
DuDraig
Member
 
Posts: 75
Joined: Sun Sep 28, 2014 17:56
IRC: DuDraig
In-game: DuDraig

Re: Replace all instances of a node in the entire world

by DuDraig » Sun Jun 18, 2017 19:07

Yes.... Using the Minetest Database virtual class that could, depending on compilation configuration, be a database-sqlite, database-leveldb, or database-redis database implementation class.

What's your point?
 

User avatar
Linuxdirk
Member
 
Posts: 990
Joined: Wed Sep 17, 2014 11:21
Location: Germany
GitHub: 4w
In-game: Linuxdirk

Re: Replace all instances of a node in the entire world

by Linuxdirk » Sun Jun 18, 2017 20:43

DuDraig wrote:What's your point?

The point is that there are multiple good tools to alter the database while the server is offline and the discussion ended some posts ago.
 

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

Re: Replace all instances of a node in the entire world

by texmex » Mon Jun 19, 2017 06:37

DuDraig wrote:I find it difficult to believe that no one has yet made such a useful and obvious offline tool.

Me too!
Taking a break from Minetest.
Mods Commons, Sling, hbSprint, Floodables, item_drop⑂, Telemosaic⑂, Herbs⑂.
Texturepacks Good Morning Craft
 

User avatar
DuDraig
Member
 
Posts: 75
Joined: Sun Sep 28, 2014 17:56
IRC: DuDraig
In-game: DuDraig

Re: Replace all instances of a node in the entire world

by DuDraig » Mon Jun 19, 2017 14:35

Linuxdirk: A discussion does not end simply because you realize that you had nothing reasonable to say from the beginning and are just trolling. Please stop replying so that others might feel more comfortable addressing this issue.

texmex: Yeah... I wanted to query the community before I exerted any effort on this. Wouldn't want to re-invent the node, yes? <grin>

The reason I brought this up is because I have noticed that many server admins are frustrated with the accumulation of unwanted nodes over time as they experiment with different mods and change or evolve mods. Some mod developers are faced with providing frustrating alternatives to deal with deleting or replacing deprecated nodes as the mod evolves when what they want is to delete or upgrade those nodes world-wide all at once. Trying to learn and use complicated database editing tools for a specific database is beyond the capability and desire of most admins and is unreasonably dangerous to the validity of Minetest specific world data. It seems that, currently, the only ways to clean up a world are by:
  • Randomly poking small areas with worldedit.
  • Creating more abms and hoping players travel everywhere there are unwanted nodes while sucking up more server cycles checking everywhere every player goes whether there are unwanted nodes or not. However, there is no way to know when this process is complete.
  • What most admins wind up doing: start a new world.
The first goal I envisioned was a simple Minetest tool any admin could use that would perform world-wide offline node deletion: You identify a target node, with qualifying configuration data, and every instance of that node will be replaced by:
  • Whatever node occurs the most in the 26 adjacent nodes.
  • A random choice if there are more than one most-adjacent nodes.
  • A stone node if the target node can not be flowed into, at least one adjacent node is flowable (water, lave, etc.), and one can be flowed into.
I just wanted to know if anyone has already done something like this, especially an in-game version; like a world-wide version of worldedit that could make that kind of change in-game in the background while players are playing.
 

User avatar
Linuxdirk
Member
 
Posts: 990
Joined: Wed Sep 17, 2014 11:21
Location: Germany
GitHub: 4w
In-game: Linuxdirk

Re: Replace all instances of a node in the entire world

by Linuxdirk » Mon Jun 19, 2017 15:38

DuDraig wrote:A discussion does not end simply because you realize that you had nothing reasonable to say from the beginning and are just trolling.

You just did not get the point. There currently is no tool or functionality built into the game that allows you to replace all occurrences of one defined node in a world at once. Thus you need to take a DBMS of your choice and alter the database directly.

DuDraig wrote:The first goal I envisioned was a simple Minetest tool any admin could use that would perform world-wide offline node deletion:

Such a tool does not exist in a Minetest-specific variant (i.e. a DBMS build to work exclusively with the databases created by Minetest) and discussing such a tool is not a part of the solution to your question, but why don't you open a feature request issue at GitHub and suggest such a thing?

DuDraig wrote:I just wanted to know if anyone has already done something like this

If you wanted to know that, why did you ask something else?
 

Byakuren
Member
 
Posts: 653
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo

Re: Replace all instances of a node in the entire world

by Byakuren » Mon Jun 19, 2017 15:52

Using a DBMS directly (by using the command line tools that come with it) is not practical because mapblocks are stored compressed. Though you could write a program that interfaces with the DBMS and do stuff that way.
Every time a mod API is left undocumented, a koala dies.
 

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

Re: Replace all instances of a node in the entire world

by texmex » Tue Jun 20, 2017 07:36

Linuxdirk, please refrain from passive-agressiveness. Why do you want to kick up dust?

DuDraig, your ideas for a tool of this kind is most welcome. As a server admin it's frustrating that you cannot easily remove the nodes from a mod addition gone wrong. It harms experimentation with mods as you have to be very careful of what you add all the time.
Taking a break from Minetest.
Mods Commons, Sling, hbSprint, Floodables, item_drop⑂, Telemosaic⑂, Herbs⑂.
Texturepacks Good Morning Craft
 

User avatar
sorcerykid
Member
 
Posts: 451
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
In-game: Nemo

Re: Replace all instances of a node in the entire world

by sorcerykid » Thu Jul 06, 2017 17:59

Why not use lag's "remap" Python script? It only depends on mt_block_parser.py to read the database and decompress the blobs, but it can filter the map block data, allowing for global search and replace of nodes with only a regex.

viewtopic.php?f=14&t=10333

Admittedly, it's an offline tool, but afaik it does the job pretty well. It's been used by both maikerumine and 843jdc on their servers to fix "corrupted" worlds.
 

ABJ
Member
 
Posts: 3015
Joined: Sun Jan 18, 2015 13:02
Location: In Earth orbit, with a perigee of 1048 km and an apogee of 1337 km and an inclination of 69 degrees.
GitHub: ABJ-MV
In-game: ABJ

Re: Replace all instances of a node in the entire world

by ABJ » Wed Jul 12, 2017 09:29

I hope I'm not going offtopic or interfering unneededly.

When checking for most similar nodes around node to be replaced, you could get the results into a math.random. If there are multiple mosts, it would choose randomly, if not, it would automatically choose the only one available.
 


Return to General Discussion



Who is online

Users browsing this forum: Google [Bot] and 6 guests