ValkyrienSkies / Eureka

Basically Archimedes Ships, but with VS2 as the backend
Apache License 2.0
53 stars 31 forks source link

Limit the BFS depth #225

Closed Kurtoid closed 1 year ago

Kurtoid commented 1 year ago

The block blacklist does a good job of preventing the server from getting stuck in BFS, but modded blocks could cause runaways. (This happened in a server I help run - a ship was connected to a seafloor made of salt blocks by another mods Kelp. Attempting to assemble the ship without removing the kelp crashed the server)

This PR adds a maxShipBlocks config value, which allows the BFS function to quit if there are too many blocks, preventing a server crash/slowdown.

I'm not sure what a good default value should be - right now, it's 64^3. As is, the limit is just number-of-blocks, but it could be modified to limit the bounding box instead (keep track of the farthest blocks found in BFS, and limit with that instead)

Kurtoid commented 1 year ago

Re-creation of the scenario that inspired this PR

Re-creation of the scenario that inspired this PR. (I used 100 as a small test value)

Kurtoid commented 1 year ago

Ok, in practice, the 64^3 limit was too large - 32768 seems to be better.