deleting pos lines in sqlite map db

mike
Member
 
Posts: 45
Joined: Wed Sep 26, 2012 01:15

deleting pos lines in sqlite map db

by mike » Sun Aug 31, 2014 14:52

Hi,

will there be any problems if i delete some well selected pos lines from sqlite db?

What i need to know is, will deleted lines (entries) be regenerated from seed if not found?
So i could write an SQL Query to delete all sectors which i dont want to preserve.

like delete all pos where pos(x,y,z) is not in myRange.

e.g. delete all except posXYZtoPos(0,0,0 to 100,100,100)
 

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

Re: deleting pos lines in sqlite map db

by Sokomine » Sun Aug 31, 2014 15:06

mike wrote:What i need to know is, will deleted lines (entries) be regenerated from seed if not found?
So i could write an SQL Query to delete all sectors which i dont want to preserve.

That ought to work well. The only thing you might have to take into consideration is that mapgen generates several mapblocks (16x16x16 blocks) in one go as one chunk (usually 5x5x5 mapblocks, so 80x80x80 blocks). I don't know what will happen if you delete only part of a chunk.

mike wrote:e.g. delete all except posXYZtoPos(0,0,0 to 100,100,100)

You'll have to transform the pos index into coordinates first, but yes, it ought to work then.
A list of my mods can be found here.
 

mike
Member
 
Posts: 45
Joined: Wed Sep 26, 2012 01:15

Re: deleting pos lines in sqlite map db

by mike » Sun Aug 31, 2014 17:12

If this is that easy wouldnt it be a function for worldedit or an script?
 

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

Re: deleting pos lines in sqlite map db

by Sokomine » Sun Aug 31, 2014 18:31

mike wrote:If this is that easy wouldnt it be a function for worldedit or an script?

This is nothing WorldEdit can do, as WorldEdit runs while the server is running. This kind of work is better done while the world is not loaded. The necessary commands depend on the database backend. sqlite3 is easier to handle in that regard than leveldb.
A list of my mods can be found here.
 

User avatar
sfan5
Moderator
 
Posts: 3844
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

Re: deleting pos lines in sqlite map db

by sfan5 » Tue Sep 02, 2014 17:05

If you delete a MapBlock from the database it will get regenerated when you visit the area again.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

mike
Member
 
Posts: 45
Joined: Wed Sep 26, 2012 01:15

Re: deleting pos lines in sqlite map db

by mike » Wed Sep 03, 2014 18:59

so i dont have to care if i have to delete a set or just random picks?
 

User avatar
sfan5
Moderator
 
Posts: 3844
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5
 

mike
Member
 
Posts: 45
Joined: Wed Sep 26, 2012 01:15

Re: deleting pos lines in sqlite map db

by mike » Wed Sep 03, 2014 20:11

is there any code for generating the coords except the one from db spec page?
 

User avatar
sfan5
Moderator
 
Posts: 3844
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

Re: deleting pos lines in sqlite map db

by sfan5 » Thu Sep 04, 2014 08:21

Here's a small python program that does what you want: http://sprunge.us/KOhi
X, Y and Z are MapBlock coords. not node coords.

Example:
You want to delete the 16x16x16 cube the node (-123, 456, 25) belongs to:
-123 / 16 = -7
456 / 16 = 28
25 / 16 = 1
-> ./pos2dbpos.py -7 28 1
Then delete that entry in the database.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

twoelk
Member
 
Posts: 1352
Joined: Fri Apr 19, 2013 16:19
Location: northern Germany
GitHub: twoelk
IRC: twoelk
In-game: twoelk

Re: deleting pos lines in sqlite map db

by twoelk » Thu Sep 04, 2014 14:19

Not code but some playing with spreadsheets.

Beware might contain mistakes. Use with care.
Is extracted from some other project of mine therefore might have vital parts missing.
Attachments
Calculating_MapInteger.zip
(17.72 KiB) Downloaded 34 times
 

mike
Member
 
Posts: 45
Joined: Wed Sep 26, 2012 01:15

Re: deleting pos lines in sqlite map db

by mike » Thu Sep 04, 2014 15:37

That looks good.
So if i calculate like this for one node, then maximum 16 nodes in all directions will be deleted?

Next i have to think how to write a script which deletes all except "active" played map.
I cant delete e.g. block 123456 until inf. I hate unnormalized databases ;-)
 


Return to General Discussion



Who is online

Users browsing this forum: Extex, Majestic-12 [Bot], YaCy [Bot] and 1 guest