Delete poor quality trees / monthly auto uproot

Place for sharing your game modifications for Life is Feudal: Your Own

Arthenius
 
Posts: 29
Joined: 25 Nov 2014, 09:50

Delete poor quality trees / monthly auto uproot

Post by Arthenius » 05 Jan 2015, 13:37

Hello all

We have a serveur and it's always longer to connect to it.
We think it's because we have a lot of tree's 99095 lines in the forest table and 196182 lines in forest_patch table

I wanted to delete all the tree where the quality is below ten

but i think there is a link beetween the forest table and forest_patch table may be via geodataid ??

or can i simply do a
Code: Select all
delete * from forest where quality <10


or something like

Code: Select all
delete * from forest_patch where geodataid in (select geodataid from forest where quality <10);
delete * from forest where quality <10;


anybody tried this ??
just to know if the bloc after the delete will be available for terraforming for example or is there any other table to modify ??

other question, how can i know that my tree is a root I can uproot ??
is it the treehealth in forest_patch ???

thks


Machine
 
Posts: 2
Joined: 12 Jan 2015, 06:54

Re: Delete poor quality trees / monthly auto uproot

Post by Machine » 12 Jan 2015, 07:15

Here's what I used to remove all trees under Quality 80. You can change the quality to whatever you want. When I used it I got an instant fast loading server. It's very helpful if you don't wipe your server often.

There's 3 tables you need to change to remove the trees. The first and second is forest and forest_patch, the both share tree info, but after you remove the trees there, you need to re-index the Version column for each TerID (442-450) and then the last table you need to change is terrain_blocks. In there ForestVersion must have the latest Version from each TerID.

So as an example, if in forest_patch I'm looking at all the entries with the TerID = 442, I would need the largest Version number and put that in as the ForestVersion for ID 442.

Here's the code, you don't need to do anything, just run as query and done. Make sure you backup your database before using this!

Code: Select all
DELETE forest, forest_patch
FROM forest, forest_patch
WHERE forest.GeoDataID = forest_patch.GeoDataID  AND
      forest.Quality < 80;

SET @c442 = 1;
SET @c443 = 1;
SET @c444 = 1;
SET @c445 = 1;
SET @c446 = 1;
SET @c447 = 1;
SET @c448 = 1;
SET @c449 = 1;
SET @c450 = 1;

UPDATE forest_patch
SET Version = @c442:=@c442+1
WHERE TerID = 442;

UPDATE forest_patch
SET Version = @c443:=@c443+1
WHERE TerID = 443;

UPDATE forest_patch
SET Version = @c444:=@c444+1
WHERE TerID = 444;

UPDATE forest_patch
SET Version = @c445:=@c445+1
WHERE TerID = 445;

UPDATE forest_patch
SET Version = @c446:=@c446+1
WHERE TerID = 446;

UPDATE forest_patch
SET Version = @c447:=@c447+1
WHERE TerID = 447;

UPDATE forest_patch
SET Version = @c448:=@c448+1
WHERE TerID = 448;

UPDATE forest_patch
SET Version = @c449:=@c449+1
WHERE TerID = 449;

UPDATE forest_patch
SET Version = @c450:=@c450+1
WHERE TerID = 450;

SET @c442 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 442 ORDER BY TerID);
SET @c443 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 443 ORDER BY TerID);
SET @c444 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 444 ORDER BY TerID);
SET @c445 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 445 ORDER BY TerID);
SET @c446 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 446 ORDER BY TerID);
SET @c447 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 447 ORDER BY TerID);
SET @c448 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 448 ORDER BY TerID);
SET @c449 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 449 ORDER BY TerID);
SET @c450 = (SELECT Max(Version) as max FROM forest_patch WHERE TerID = 450 ORDER BY TerID);

UPDATE terrain_blocks
SET ForestVersion = @c442
WHERE ID = 442;

UPDATE terrain_blocks
SET ForestVersion = @c443
WHERE ID = 443;

UPDATE terrain_blocks
SET ForestVersion = @c444
WHERE ID = 444;

UPDATE terrain_blocks
SET ForestVersion = @c445
WHERE ID = 445;

UPDATE terrain_blocks
SET ForestVersion = @c446
WHERE ID = 446;

UPDATE terrain_blocks
SET ForestVersion = @c447
WHERE ID = 447;

UPDATE terrain_blocks
SET ForestVersion = @c448
WHERE ID = 448;

UPDATE terrain_blocks
SET ForestVersion = @c449
WHERE ID = 449;

UPDATE terrain_blocks
SET ForestVersion = @c450
WHERE ID = 450;


Arthenius
 
Posts: 29
Joined: 25 Nov 2014, 09:50

Re: Delete poor quality trees / monthly auto uproot

Post by Arthenius » 13 Jan 2015, 21:52

Tested and approuved !!

it destoyed all strump too !!

thank you very much
I deleted only tree quality <=10 but it was about 80 000 trees

the server run faster now
thanks a lot


Sanctifiedevil
 
Posts: 12
Joined: 22 Dec 2014, 07:37

Re: Delete poor quality trees / monthly auto uproot

Post by Sanctifiedevil » 13 Jan 2015, 22:23

Arthenius wrote:Tested and approuved !!

it destoyed all strump too !!

thank you very much
I deleted only tree quality <=10 but it was about 80 000 trees

the server run faster now
thanks a lot



Did you just run it once or stick it in your patch.sql?


MasterChief
True Believer
 
Posts: 55
Joined: 04 Oct 2014, 11:11

Re: Delete poor quality trees / monthly auto uproot

Post by MasterChief » 13 Jan 2015, 23:08

works indeed, thx man and nice work...


MasterChief
True Believer
 
Posts: 55
Joined: 04 Oct 2014, 11:11

Re: Delete poor quality trees / monthly auto uproot

Post by MasterChief » 13 Jan 2015, 23:23

Sanctifiedevil wrote:

Did you just run it once or stick it in your patch.sql?



works on both ways, just pust the script at the end of patch.sql and restart.... or just put it in qurey and press run,


Arthenius
 
Posts: 29
Joined: 25 Nov 2014, 09:50

Re: Delete poor quality trees / monthly auto uproot

Post by Arthenius » 14 Jan 2015, 08:46

I haven't put it in the patch.sql file
just run once..

after changing the first delete

Code: Select all
DELETE forest, forest_patch
FROM forest, forest_patch
WHERE forest.GeoDataID = forest_patch.GeoDataID  AND
      forest.Quality <= 10;


Ziong18
 
Posts: 109
Joined: 09 Oct 2014, 03:48

Re: Delete poor quality trees / monthly auto uproot

Post by Ziong18 » 16 Jan 2015, 02:35

Deleted <80q trees today on the server, the players freaked out lol the place looks kinda too naked. Opened up the land a bit but makes it too easy to find players/bases/animals. I would recommend doing <65q


Arhi
True Believer
 
Posts: 11
Joined: 03 Oct 2014, 07:49

Re: Delete poor quality trees / monthly auto uproot

Post by Arhi » 16 Jan 2015, 07:54

Q<30 and :good:

del ≈ 75% trees


Balax
 
Posts: 40
Joined: 30 Sep 2014, 11:03
Location: Norway

Re: Delete poor quality trees / monthly auto uproot

Post by Balax » 16 Jan 2015, 08:15

I deleted anything below q20, and even that was a bit too much in my opinion. The small isle looks a bit sad and naked.

Next time I'll first delete below 10 trees, and then see if I feel like deleting more.


Arthenius
 
Posts: 29
Joined: 25 Nov 2014, 09:50

Re: Delete poor quality trees / monthly auto uproot

Post by Arthenius » 16 Jan 2015, 13:58

10 for me is the good number, may be even 8 could be enough

at least strump will disapear with this :)
and our server seems to be more stable

User avatar
Twiztedmike
Beta Tester
 
Posts: 250
Joined: 24 Nov 2014, 15:47

Re: Delete poor quality trees / monthly auto uproot

Post by Twiztedmike » 16 Jan 2015, 14:25

Ran this script on my server. (1.5 months old). 360,000 rows were deleted :)

Previous server boot up times were 28 minutes

After running the script, boot up time was 5 minutes.

Perhaps I should've used a different quality instead of 80, it looks quite bare.

Is it possible to modify the selection criteria and delete a percentage of trees (with random quality)? Might be hard cause you would need to delete the same tree on two tables


Balax
 
Posts: 40
Joined: 30 Sep 2014, 11:03
Location: Norway

Re: Delete poor quality trees / monthly auto uproot

Post by Balax » 16 Jan 2015, 14:38

Twiztedmike wrote:Ran this script on my server. (1.5 months old). 360,000 rows were deleted :)

Previous server boot up times were 28 minutes

After running the script, boot up time was 5 minutes.

Perhaps I should've used a different quality instead of 80, it looks quite bare.

Is it possible to modify the selection criteria and delete a percentage of trees (with random quality)? Might be hard cause you would need to delete the same tree on two tables



It would be quite interesting to obersve regrowth rates and what quality the trees get at your server, because you of all probably have the best conditions for observing such things.

If it is not too much of a bother I would really like to hear in a while how things are turning out.

User avatar
Twiztedmike
Beta Tester
 
Posts: 250
Joined: 24 Nov 2014, 15:47

Re: Delete poor quality trees / monthly auto uproot

Post by Twiztedmike » 16 Jan 2015, 14:53

Balax wrote:
Twiztedmike wrote:Ran this script on my server. (1.5 months old). 360,000 rows were deleted :)

Previous server boot up times were 28 minutes

After running the script, boot up time was 5 minutes.

Perhaps I should've used a different quality instead of 80, it looks quite bare.

Is it possible to modify the selection criteria and delete a percentage of trees (with random quality)? Might be hard cause you would need to delete the same tree on two tables



It would be quite interesting to obersve regrowth rates and what quality the trees get at your server, because you of all probably have the best conditions for observing such things.

If it is not too much of a bother I would really like to hear in a while how things are turning out.

Balax, when I get home what I'll do is delete ALL the trees, go in GM mode and use the /grow command and see what happens!

One more request - is it possible to create a hardwood/softwood log remover?

Can it distinguish quality?


Machine
 
Posts: 2
Joined: 12 Jan 2015, 06:54

Re: Delete poor quality trees / monthly auto uproot

Post by Machine » 16 Jan 2015, 15:03

Reason I did under quality 80 was because the server has never been wiped and the growth cycle was higher than default so it got so bad you couldn't really travel as the trees were just about growing on each other and the boot up time was ridiculous.

Went from over 30 minutes to 3 minute restarts with this script. If your forest isn't too bad or you just want to optimize your server then just do under 10 quality and that should be enough to help.

User avatar
Twiztedmike
Beta Tester
 
Posts: 250
Joined: 24 Nov 2014, 15:47

Re: Delete poor quality trees / monthly auto uproot

Post by Twiztedmike » 16 Jan 2015, 15:10

Machine wrote:Reason I did under quality 80 was because the server has never been wiped and the growth cycle was higher than default so it got so bad you couldn't really travel as the trees were just about growing on each other and the boot up time was ridiculous.

Went from over 30 minutes to 3 minute restarts with this script. If your forest isn't too bad or you just want to optimize your server then just do under 10 quality and that should be enough to help.

Yep - I decided to just leave it as 80 as my primary purpose was to determine what it was that was causing the long server startups.

A combination of trees and mining I guess. The reason why the mining is troublesome is that its not something that can be removed.

User avatar
Burne109
Zealous Believer
 
Posts: 160
Joined: 26 Nov 2014, 07:03
Location: Ohio, US

Re: Delete poor quality trees / monthly auto uproot

Post by Burne109 » 17 Jan 2015, 19:58

Becareful with it.

Might not be related, but I'm not sure what happened, I ran it one day, no problem. The next day I ran it, same as last time, right before a restart and poof. everything vanished, buildings, trees, terraforming changes... everything but characters & their inventory & whatever they were holding at the time.(saw one guy holding a cart..)

messy logs, attempted backup but the backup db was right after I ran the query. so it was still fubar'd.

Spoiler


Spoiler


After those errors, I got a ton of weird errors involving weapons, ghosts..
Spoiler


Had good people on the server, hope they find a good home.


Vampy
 
Posts: 2
Joined: 18 Jan 2015, 09:35

Re: Delete poor quality trees / monthly auto uproot

Post by Vampy » 18 Jan 2015, 09:40

How can I manually insert more trees in the database?

I deleted all trees under quality 40, was to much.

I see in the server logs there is a automatic grow mechanism:

Code: Select all
ECHO 2015-01-18 05:30:05.019 {00} <NOSCOPE> FOREST_STRETCHED: - grow 100 items of ter(s) 445 in 0.010 sec
ECHO 2015-01-18 05:30:05.113 {00} <NOSCOPE> FOREST_STRETCHED: - grow 100 items of ter(s) 445 in 0.006 sec
ECHO 2015-01-18 05:30:05.222 {00} <NOSCOPE> FOREST_STRETCHED: - grow 100 items of ter(s) 445 in 0.005 sec
ECHO 2015-01-18 05:30:05.316 {00} <NOSCOPE> FOREST_STRETCHED: - grow 100 items of ter(s) 445 in 0.008 sec


But how can I manually patch the tree growth into my DB, let's say 10 times in a row or so.

Thank you very much.


Arthenius
 
Posts: 29
Joined: 25 Nov 2014, 09:50

Re: Delete poor quality trees / monthly auto uproot

Post by Arthenius » 19 Jan 2015, 22:01

I putted this mod in a stored procedure and it is run every morning before our server restart... it's running for 1 week !!

until this day no matter with it... hope this will continue

User avatar
Twiztedmike
Beta Tester
 
Posts: 250
Joined: 24 Nov 2014, 15:47

Re: Delete poor quality trees / monthly auto uproot

Post by Twiztedmike » 20 Jan 2015, 01:21

Vampy wrote:How can I manually insert more trees in the database?

I deleted all trees under quality 40, was to much.

I see in the server logs there is a automatic grow mechanism:

Code: Select all
ECHO 2015-01-18 05:30:05.019 {00} <NOSCOPE> FOREST_STRETCHED: - grow 100 items of ter(s) 445 in 0.010 sec
ECHO 2015-01-18 05:30:05.113 {00} <NOSCOPE> FOREST_STRETCHED: - grow 100 items of ter(s) 445 in 0.006 sec
ECHO 2015-01-18 05:30:05.222 {00} <NOSCOPE> FOREST_STRETCHED: - grow 100 items of ter(s) 445 in 0.005 sec
ECHO 2015-01-18 05:30:05.316 {00} <NOSCOPE> FOREST_STRETCHED: - grow 100 items of ter(s) 445 in 0.008 sec


But how can I manually patch the tree growth into my DB, let's say 10 times in a row or so.

Thank you very much.


I suspect an easier way is to go in GM mode and use the /grow command but I haven't tested it


Vampy
 
Posts: 2
Joined: 18 Jan 2015, 09:35

Re: Delete poor quality trees / monthly auto uproot

Post by Vampy » 20 Jan 2015, 07:35

/grow is not working for trees, already tested it.

User avatar
Razoreqx
 
Posts: 91
Joined: 06 Oct 2014, 13:13

Re: Delete poor quality trees / monthly auto uproot

Post by Razoreqx » 23 Jan 2015, 03:19

Burne109 wrote:Becareful with it.

Might not be related, but I'm not sure what happened, I ran it one day, no problem. The next day I ran it, same as last time, right before a restart and poof. everything vanished, buildings, trees, terraforming changes... everything but characters & their inventory & whatever they were holding at the time.(saw one guy holding a cart..)

messy logs, attempted backup but the backup db was right after I ran the query. so it was still fubar'd.

Spoiler


Spoiler


After those errors, I got a ton of weird errors involving weapons, ghosts..
Spoiler


Had good people on the server, hope they find a good home.



I ran this script and had the same results as you. Had to restore the DB from backup. Thank god im backing up the server every 15 mins.
Razors Edge
A Life is Feudal Persistent World
http://razors-edge.org
22 Custom MODS / Custom Graphics models Planned. Visit our Gallery.


Arthenius
 
Posts: 29
Joined: 25 Nov 2014, 09:50

Re: Delete poor quality trees / monthly auto uproot

Post by Arthenius » 23 Jan 2015, 08:39

really strange are you sure you ran the end of the script ??

this script is run every day on our server without problems :(


Sanctifiedevil
 
Posts: 12
Joined: 22 Dec 2014, 07:37

Re: Delete poor quality trees / monthly auto uproot

Post by Sanctifiedevil » 25 Jan 2015, 08:07

Arthenius wrote:really strange are you sure you ran the end of the script ??

this script is run every day on our server without problems :(


Same, works fine for me. I set it to <1 and use it mainly for stumps.


Remystemple
 
Posts: 80
Joined: 15 Jan 2015, 22:30

Re: Delete poor quality trees / monthly auto uproot

Post by Remystemple » 06 Feb 2015, 19:21

Hi, after running this script i can't cut down any trees. any ideas as to how i can fix this?


Remystemple
 
Posts: 80
Joined: 15 Jan 2015, 22:30

Re: Delete poor quality trees / monthly auto uproot

Post by Remystemple » 08 Feb 2015, 21:10

K guys. i need an answer on this. it's been 2 days i had to wipe my server. would love to run it again but not if it's gonna break my server. so how did this happen and how can i avoid it from happening again...


Koiecks
 
Posts: 28
Joined: 07 Feb 2015, 07:15

Re: Delete poor quality trees / monthly auto uproot

Post by Koiecks » 09 Feb 2015, 01:09

I set mine to <10 and it works fine on my server
Image


Remystemple
 
Posts: 80
Joined: 15 Jan 2015, 22:30

Re: Delete poor quality trees / monthly auto uproot

Post by Remystemple » 09 Feb 2015, 01:37

how many times have you run it?


Koiecks
 
Posts: 28
Joined: 07 Feb 2015, 07:15

Re: Delete poor quality trees / monthly auto uproot

Post by Koiecks » 09 Feb 2015, 02:31

5-7 so far, due to adding other mods and restarting my server
Image


Koiecks
 
Posts: 28
Joined: 07 Feb 2015, 07:15

Re: Delete poor quality trees / monthly auto uproot

Post by Koiecks » 09 Feb 2015, 02:33

I also have my growth rate set to .5 so maybe that helps? Understand tho that 7 times with no issue can't be taken as the law of it being ok.
Image

Return to Game mods

cron