[WIP / RELEASE] Server Cleanup Mod (alpha)

Video

** Made useless as of patch v206 since pvp decay timers have been added.**

Essentially this “mod” destroys any foundations the script deems abandoned.

The mod checks each foundation in the server for either a door, or a ceiling placed within 45m (just below the range enemy tribes are blocked from building near your foundations). and destroys the foundation if none are found.
This is to clear up server lag and restore dino / resource spawns in areas with abandoned foundations.

It should work with any mod that doesn’t use a custom gamemode override and be compatible with any custom building parts.

It’s untested in real settings, but the proof of concept is in the video on a single player game and I don’t see why it wouldn’t work in a dedicated server setting.

This is mostly for super large servers that have been going for awhile without a wipe.
Building decay (if it even exists) Would not apply here since in most cases foundations are left abandoned after active tribes use them for beds while raiding, or tribes get raided, move and leave their empty shell of a base behind.

Upcoming Additions
Better logic in finding abandoned bases (Damaged parts, missing doors and ceilings, abandoned for x amount of time, etc…)
Pillar support
Dino / Behemoth gate support
Fence support.

Let me know what you think / any improvements / any major server destroying issues that come up.

Changelog
8/3/2015
Added trap doors and dinogates to checklist.
Wipe is now controlled by admins as they please, simply type


 cheat summon cleanup_c 

to initiate a wipe Video


 cheat destroyall cleanup_c 

to cancel a wipe

**8/2/2015 **
Added a delay between scans.
Scans now remove other foundations detected from the array to minimize redundant scans.

I love the sound of this mod!
I won’t use it yet because I do run a large server and would like to see the two below adjustments made before I attempt to use it.

I would STRONGLY suggest that you modify this mod (if you can) in a couple ways;
#1 - Check the Foundation for Owner and how long its been since they’ve been on (so you aren’t destroying stuff that was made an hour ago and the player dc’d for what ever reason)
- This would also stop the destruction of bases that may choose not to use doors or ceilings for certain parts of their base.
#2 - You add in a delay between checks for destruction. If it checks ALL the foundations in one hit… This could be a major detriment to large servers and could even cause crashing and corruption.

btw, your video’s brightness/contrast is completely messed up, can’t see anything.

agree with the video comment … cant really see anything, too bright
“any foundations the script deems abandoned” : How do you determine if one is abandoned? more info about the logic will help
“destroys the foundation if none are found” : this is a really bad logic :confused:

Currently it determines a foundation is abandoned if there isn’t a ceiling or door within 45m of the foundation (build radius), 10 seconds after the server starts.

Our private server was getting bogged down by abandoned bases this week. We tried switching to PvE for a week to take advantage of the PvE decay, however we didn’t realize the decay timer doesn’t start until a member of the tribe logs in for the first time. So all of the abandoned bases have no timer at all. Is it possible to detect structures that don’t have a timer and destroy them?

This might not work, as i know some people on my PvE server build their egg farm with no ceiling or door :slight_smile:

In the video, he said it currently doesn’t touch wall foundations or gateways. It only applies to floor foundations, with plans for pillars and other things soon.

Changelog
Added a delay between scans.
Scans now remove other foundations detected from the array to minimize redundant scans.

To answer a few questions,

I was considering adding a ‘land claim’ sort of object that would prevent buildings from being cleaned up, but that would reduce the mods compatibility, and add an extra step for players to keep their house alive, causing confusion.
Checking a players last time online, or even who owns an object, seems to not exist in blueprints (yet?).
The idea behind doors and ceilings is that a raided base will never be missing both of these at the same time unless it was extremely small (like 1x1-2x2x1 size), and anyone’s creation will usually have one or the other somewhere within 45m of all their foundations that are important.
I might make metal exempt from the cleanup as no one would really waste metal on sticking 4 foundations in the woods to block spawns, besides griefers.

This is completely doable, I’ve added this to the mod. It waits 2 seconds before scanning a new foundation, and now removes other foundations it scans from the array to reduce redundant scans.
The idea behind it being instant was to minimize the time it takes so the server isn’t extremely laggy for the first minute + of startup.
I also wanted to get this out asap as a proof of concept and to see if there was interest in something like this.

oops.

My original post should of included it, but from the steam workshop page I have a description of how it works technically.
It checks if a ceiling or door is present within 45m of a foundation, if none is found then the foundation will be destroyed. 45m is the build radius that other tribes cannot build within.

If their foundations are close enough to their main base they would see no issue, but I can see how on PvE this would cause an issue since bases take up way more space.
Right now it ignores fence foundations and dino gates. It exclusively interacts with normal building foundations.

Your best bet in this case is to just identify bases manually and destroy them with admin commands. Any of the info relating to building decay seems to not be shared with blueprints.

I was wondering about something like this. Is it possible to get structure health? A lot of the raided and abandoned structures on my server have walls missing instead of doors.

Maybe a way to handle this is to “mark the building” as raided and remove next day or so if not altered

That is a good idea, maybe making buildings that have heavy damage marked with something and if its not repaired the building would be removed after 18 hours
Maybe like a small fire particle or something attached to structures below 50% hp

I wouldnt say 50% most people wouldnt be arsed repairing aftera failed raid, Id say below 10% or destroyed

Our pvp server had certain rules to follow when raiding. Because of these rules, many of the bases didn’t have any damage. It was impossible to tell who was inactive without switching to PvE for a few days and looking at the decay timer. However, there aren’t any good admin commands to remove those large bases in PvE, and switching back to PvP to use rockets would be a nightmare remembering where each base was to destroy.

A PvP decay system is really needed, but without access to the timer function, I was going to try to make a placeable admin flag that destroys floor foundations, fence foundations, gates, pillars, pipes, crop plots, electric cable, lights, generators, and campfires within a 40m radius. And maybe another flag to cleanup the dinosaurs. However, the admin of our server got impatient and has already wiped the server within 24 hours of discovering the issue of the decay timer.

Perhaps what you could do for this mod is add in 3 new items;
Emitter Fields like the Force Field mod in 3 sizes, Small, Medium, Large.
Anything in this fields radius get destroyed after the admin flicks a switch like C4.

That way an Admin can just place it down and destroy these structures easily?
I was thinking of adding a C4 Nuke type thing does the same thing in a radius.

To respond to both of your comments on adding some sort of place-able item, yeah I was thinking of doing something similar but keep it automated.

The idea I’ve had is instead of this being an auto-run when the server starts, I’d add a structure the admin could place that would run the cleanup script that exists now every 24 hours and after server resets.
So an admin could place it wherever, and it would instantly do a cleanup, and then automatically repeat every 24 hours or after a server restart.
Giving admins more control over when to actually perform the wipe, and let them do it in real time.

Now for manual cleanup, at the time being there is
My mod is more for an automated process so admins don’t need to be actively destroying useless bases, and to reduce the potential of admin abuse.

Fences / pillars / gates I’m considering making the nearby structure requirement
Door
Dino Gate (not frame)
Ceiling AND Wall
or alive tamed dinosaur

This should allow dino pens to still exist perfectly safe, but ones that are empty, and missing a gate, and not near an active base would be destroyed.

Edit: Changelog
8/3/2015
Added trap doors and dinogates to checklist.
Wipe is now controlled by admins as they please, simply type


 cheat summon cleanup_c 

to initiate a wipe Video


 cheat destroyall cleanup_c 

to cancel a wipe

Unfortunately… I still think this is the wrong logic to approach.

What about players bases that are in the process of being built?
It would nuke their base.

No fine tuning control is going to be a detriment to any live server.
You can’t just blanket apply something like this across the whole server.

to counter buildings being built would be to mark all builds that would have been destroyed the first time its ran then next time (24hours) perhaps then remove the buildings that have not been altered or repaired

I’d argue that a base in progress should be able to have a door / ceiling / gate somewhere on the building within the 15 minute countdown

I’m stuck working within the limitations of the devkit, and a lot of functions (last online, tribe owner, etc…) are either not exposed to blueprints (yet) or aren’t possible (external config, etc…).

I’m trying to keep the script simple for now so it doesn’t run into any edge cases where a full base is destroyed. With the current parameters set it should near never destroy a base that is in use.
I say should just because I cannot test every scenario on a single player server.

Fair enough :slight_smile:

What I might do in the near future is copy my server onto my desktop.
Then I will run the mod and see what happens.

Really cool - I bet you had a great feeling when this worked :smiley: I eventually want to implement something like this in to my mods that have custom structures so an admin can execute a command and it destroys any old structures and replaces them with new from the mod for better integration in to an existing world.

On that note, if you are looking for more things to throw in, mind looking in to creating an alternative version that you can summon that accepts two arguments (I’m trying to think of a good way to pass an argument in to your system though - maybe just a chat listener from the admin of the class name?) so you can replace one object with another. This could be a really useful utility for any mod that changes structures :smiley: Can always check the user by confirming that what they gave you have the same parents, but then there is the issue of casting a string to actually be that object… The other issue is whether or not placement is as easy as destruction.

I will likely look in to this myself at some point but let me know your thoughts.