[Mod] sourround holes by hedges etc [detect_holes]

Post Reply
Sokomine
Member
Posts: 4290
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

[Mod] sourround holes by hedges etc [detect_holes]

by Sokomine » Post

This is a funny little experiment done in order to protect mobs (and players) from falling into one of those many holes that can be found in MT's surface. The world generated is quite intresting when exploring.
Note: The algorithm doesn't *really* know about the holes as such - it just places something around the holes - it's just the start of edge detection)
Image

Protection will not always be perfect as the height of the hedge built from leaves is not adjusted to the sourrounding terrain. Yet in many cases it works quite well and will at least alert the traveller to the problem of the hole. A typical example, close up:
Image

The top of cliffs will also be protected:
Image

If the ground is desert stone, desert cobble will be placed instead of leaves. In all other places, wooden fences will be used. Sometimes that works quite well:
Image

Or, as a smaller example, here:
Image

Fence posts covering steep hills may not be the most optimal solution. Not all places will look as good as in the screenshots. It might be worth limiting the mod to leaves and desert cobble.

If meselamps are placed, the edges become very visible to the human eye. The algorithm just isn't aware of them yet - there's no connection between detected points.
Image

This is how it would look like if nodes would be considered as "dangerous cliffs" already if their neighbour would be just one node lower (instead of 2-3):
Image

The whole detection is based on the heightmap provided by mapgen and is very fast. The nodes are placed using set_node. As there are not too many to be placed, it's fast enough.

Download: https://github.com/Sokomine/detect_holes/archive/master.zip
Browse code: https://github.com/Sokomine/detect_holes
Version: 1.0
Licence: GPLv3 (if you want a license; really, it's more like a code example)
Depends on: default
Attachments
detect_holes3.jpg
detect_holes3.jpg (133.19 KiB) Viewed 271 times
detect_holes2.jpg
detect_holes2.jpg (57.87 KiB) Viewed 271 times
detect_holes1.jpg
detect_holes1.jpg (216.33 KiB) Viewed 271 times
A list of my mods can be found here.

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

Re: [Mod] sourround holes by hedges etc [detect_holes]

by texmex » Post

Quite interesting idea, Sokomine!

Post Reply

Who is online

Users browsing this forum: Nininik and 67 guests