[Mod] Terraform [terraform]

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

[Mod] Terraform [terraform]

by x2048 » Post

Terraform mod allows editing landscape interactively using a configurable brush with undo support.

Image

Features:
  • Flexible painting brush:
    • Create new terrain using sphere, cube or cylinder shapes
    • Smoothen and reshape existing terrain
    • Mask support for conditional editing
    • (1.1) Weighted paint patterns using stacks of nodes to specify weights
    • Modifiers:
      • Scatter - randomly fill 5% of the nodes to be painted.
      • Surface - only paint nodes under air.
      • Decorate - place node on top of surface nodes.
      • (1.1) Landslide - simulate falling blocks, as if it were sand.
      • (1.1) Flat - set shape to be one node high
    • UI-based configuration
  • Undo support both for brush operations and normal block digging/placing
  • Light tools:
    • Light up the working area, whether working during night or in a deep cave
    • One-click light fixer
  • Teleport tool for faster travel
  • All tools protected with a dedicated privilege
Before you start

Here are important notes to know before you enable the mod on your server:

* You need "terraform" privilege to be able to use the tools. As a server owner, grant
terraform privilege only to trusted users.
* Several players using undo very close to each other may cause unexpected results.
* Current implementation of the undo engine consumes server memory and will lead
to server crash if used for a very long time or by many players at once.
* Light recalculation, flow of liquids and falling of physical blocks (e.g. sand) are
not triggered by the mod's tools and are not supported by the undo engine.
You can fix the light with the Light fixer tool, trigger water flow by placing a water
source and cause blocks to fall by digging one of them.

Licenses:
  • Code: AGPL-3.0
  • Graphics: CC0 Universal
Dependencies: None!

Resources Current Release: v1.2.1 https://content.minetest.net/packages/x ... /download/

Previous Releases
Last edited by x2048 on Sun May 02, 2021 22:12, edited 4 times in total.

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform] [Preview]

by x2048 » Post

Hey fellow players and modders,

I was looking for tools to edit terrain interactively (like creating custom rivers, valleys, mountains, caves etc.), and while there are a few existing mods, none of them was 'compelling enough'. So, I've created with mod as an exploration of Minetest API and a proof of concept for a paint-like experience in Minetest.

I would appreciate someone could try it out and give some feedback:
  • Does it work for you? Any technical problems?
  • Is it easy to learn and use?
  • Would you like to continue using the mod and see it evolve?
  • What would you like to improve or add?
Thank you and all the best.

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: [Mod] Terraform [terraform] [Preview]

by philipbenr » Post

If nobody else will, I am interested in this mod as a creative builder. However I am busy with other things in life right now, and I'll have to take a look at a later time.

...though I will say I'm already a fan of the fact that there is an undo button. :P

User avatar
1faco
Member
Posts: 84
Joined: Tue Sep 08, 2020 20:32
GitHub: minefaco
In-game: faco

Re: [Mod] Terraform [terraform] [Preview]

by 1faco » Post

i wanna make a mountain with some "natural" ores, but there are no options to configure the quantity for each material, like:
Stone: 80%
Dirt: 15%
Coal: 5%

it would be useful for all types of patterns.

PD: It's really an amazing mod. +10

User avatar
Codesound
Member
Posts: 365
Joined: Thu Jun 09, 2016 14:56

Re: [Mod] Terraform [terraform] [Preview]

by Codesound » Post

Beautiful mod.... Thanks!
Some improvements are needed but is a very good idea!

Thanks again!

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform] [Preview]

by x2048 » Post

1faco wrote:
Sun Feb 21, 2021 05:21
i wanna make a mountain with some "natural" ores, but there are no options to configure the quantity for each material, like:
Stone: 80%
Dirt: 15%
Coal: 5%

it would be useful for all types of patterns.
You can create coarse patterns by repeating the material in Paint list, like "stone,stone,stone,stone,dirt,dirt,coal". This is of course not ideal but could work as a stopgap solution.

I need to think how to implement the weights without cluttering the UI too much.

LC Creations
Member
Posts: 159
Joined: Mon Feb 18, 2019 02:53
GitHub: LandonAConway

Re: [Mod] Terraform [terraform] [Preview]

by LC Creations » Post

Great mod. This may seem far fetched but I have some suggestions

* The ability to select an area and edit it only. And to hide, and show, the markers. (blue would be a good color to
use for markers.) (Think of photoshop or gimp where, if an area is selected changed will
will only be made inside the area.)
* Different types of brushes. (Not sure if this would be worth the time to code but it is an idea.). What I mean by
different types of brushes is like using a (*.png) file, or bitmap, with black/white as a brush mask. White pixels
would make changes to the terrain while black pixels would not edit the terrain. Sorta like a photoshop brush.
It would be cool if these images could be imported, but if not they could be assets only provided by the mod.
* The ability to mix different nodes together and choose the amount per user-specified area that the may appear.
For example, my main node to paint with is stone. Within every 5*5*4 area of nodes, I want between 5-10 dirt
nodes to appear in the area if possible, and for every 5*7*2 area of nodes, I want between 4-8 iron ores. The
placement of the nodes would be random. Or instead of using areas, you can just do percentages of the chance
that they would appear.

Of course, these are all just ideas. They are some really advanced ideas but are interesting ones that not everyone may use.
cdb_ac3a146dcafb

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform] [Preview]

by x2048 » Post

Hi LC Creations

Thank you for the feedback.
LC Creations wrote:
Mon Feb 22, 2021 00:32
Great mod. This may seem far fetched but I have some suggestions

* The ability to select an area and edit it only. And to hide, and show, the markers. (blue would be a good color to
use for markers.) (Think of photoshop or gimp where, if an area is selected changed will
will only be made inside the area.)
Yes, this came up on my mind too when I was playing with the mod. I was thinking about integration with WorldEdit's POS1 and POS2. Would this work or is it better to have my very own tools for boundaries?
LC Creations wrote:
Mon Feb 22, 2021 00:32
* Different types of brushes. (Not sure if this would be worth the time to code but it is an idea.). What I mean by
different types of brushes is like using a (*.png) file, or bitmap, with black/white as a brush mask. White pixels
would make changes to the terrain while black pixels would not edit the terrain. Sorta like a photoshop brush.
It would be cool if these images could be imported, but if not they could be assets only provided by the mod.
Yes, a "stamp" brush that you can program. I've seen nice videos how people use these to create e.g. mountain slopes. Do you think something like 16x16 pattern would be enough for such a brush?
LC Creations wrote:
Mon Feb 22, 2021 00:32
* The ability to mix different nodes together and choose the amount per user-specified area that the may appear.
I think I will focus on simpler weighted patterns for starters, and there's also an option to ask the MapGen to insert ores when you paint. I need to spend some time researching to get to something specific here.

Cheers

LC Creations
Member
Posts: 159
Joined: Mon Feb 18, 2019 02:53
GitHub: LandonAConway

Re: [Mod] Terraform [terraform] [Preview]

by LC Creations » Post

I would prefer for the mod it have it's own markers. Although, an option to tick, would be also cool (a tick option to use the worldedit brush). I noticed how each brush has it's own settings and can have it's own color. So, you could also create a selection per-brush that is colored by it's brushes color tag. It would also be cool to be able to have a tick option to choose to use a 'global selection', instead of an individual one, which is where worldedit's pos1 and pos2 can come into integration. (If the mod is enabled maybe)

As for a brush pattern? What if the player wanted to use a '20' size brush for example, but the 16x16 image created a pixelated terrain if you know what mean. You could try 128x128 or 256x256. Require whatever the largest size brush can be, to allow for best quality - if you can.


Also another idea I didnt mention is replacing nodes while brushing. This would only allow for one type of node to be replaced at once, otherwise it could get disasterous.
cdb_ac3a146dcafb

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform]

by x2048 » Post

Just pushed version 1.0 to content DB. Added teleport tool for faster local travel.

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform]

by x2048 » Post

I've pushed two new brush modifiers to Github:
  • Landslide - simulates falling of the placed nodes, like sand or gravel. Helpful to quickly build hills, mountains and cliffs.
  • Flat - changes height of the brush to just 1 node. Useful to paint 'layers' or when using Landslide.
Quick recipe for a cliff: paint=stone, mask=air, shape=sphere, modifiers=Landslide.

Quick recipe for creating/raising a mountain slope: paint=stone, mask=air, shape=sphere, modifiers=Landslide,Flat.

If you want to preview, download here, unpack into /mods and rename terraform-develop to terraform.

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform] [Preview]

by x2048 » Post

Hey everyone,

Version 1.1 is out now in ContentDB, with the new features:
  • Landslide modifier in Terraform Brush to simulate falling blocks. Helps a lot to build cliffs and hills.
  • Flat modifier to make the shape one block high. Helps creating layered patterns and works well with Landslide to create slopes.
  • Weighted patterns. You can now place stacks of 40 stone, 8 gravel and 2 coal to simulate probabilities.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Terraform [terraform]

by MisterE » Post

When using this mod, I repeatedly get this error:

Code: Select all

2021-04-24 04:19:34: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback item_OnPlace(): std::bad_alloc
2021-04-24 04:19:34: ERROR[Main]: stack traceback:
2021-04-24 04:19:34: ERROR[Main]: 	[C]: in function 'write_to_map'
2021-04-24 04:19:34: ERROR[Main]: 	...minetest/minetest/games/aes_game/mods/terraform/init.lua:605: in function 'execute'
2021-04-24 04:19:34: ERROR[Main]: 	...minetest/minetest/games/aes_game/mods/terraform/init.lua:116: in function <...minetest/minetest/games/aes_game/mods/terraform/init.lua:112>

I am using the plateau and landslide features, with stone as what is being placed, and water source as a mask

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform]

by x2048 » Post

MisterE wrote:
Sat Apr 24, 2021 02:23
When using this mod, I repeatedly get this error:

Code: Select all

2021-04-24 04:19:34: ERROR[Main]: ServerError: AsyncErr: ServerThread::run Lua: Runtime error from mod '' in callback item_OnPlace(): std::bad_alloc
2021-04-24 04:19:34: ERROR[Main]: stack traceback:
2021-04-24 04:19:34: ERROR[Main]: 	[C]: in function 'write_to_map'
2021-04-24 04:19:34: ERROR[Main]: 	...minetest/minetest/games/aes_game/mods/terraform/init.lua:605: in function 'execute'
2021-04-24 04:19:34: ERROR[Main]: 	...minetest/minetest/games/aes_game/mods/terraform/init.lua:116: in function <...minetest/minetest/games/aes_game/mods/terraform/init.lua:112>

I am using the plateau and landslide features, with stone as what is being placed, and water source as a mask
Hey MisterE, looks like you are running out of memory. I have a few questions:
  • Which version of Minetest do you play?
  • Are you playing singleplayer or standalone server?
  • Are you playing on Linux, Windows or Mac (where is the server located)?
  • How soon in the process do you experience the issue? Is it immediate or after playing for a few hours?
I'll also try to reproduce the crash on my system and get back.

Thank you.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Terraform [terraform]

by MisterE » Post

I am using minetest 5.4. It just happens sometimes, when I use the brush to change large areas (landscape). THe server runs on openBSD it happens immediately when it happens

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Terraform [terraform]

by MisterE » Post

It also seems to happen with Worldedit, confirming the running out of mem idea

It would be nice if it was possible, to prevent crashes, and just send a message that the operation could not be completed because of running out of memory.

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform]

by x2048 » Post

MisterE wrote:
Sat Apr 24, 2021 20:25
It also seems to happen with Worldedit, confirming the running out of mem idea

It would be nice if it was possible, to prevent crashes, and just send a message that the operation could not be completed because of running out of memory.
The git master contains a fix that limits undo history to avoid memory problems. You might want to check it out.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Terraform [terraform]

by MisterE » Post

it was not occuring with undo... it was happening when just using the landslide modifier

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform]

by x2048 » Post

MisterE wrote:
Mon Apr 26, 2021 00:19
it was not occuring with undo... it was happening when just using the landslide modifier
Sure, this is because Brush records undo history and keeps it in memory, and landslide and plateau are the most memory-hungry tools.

I've now limited undo history to 100 entries by default, and you can reduce the number further in the settings UI if it keeps crashing.

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform]

by x2048 » Post

New version 1.2.1 adds a limit for undo history that you can configure using Minetest settings UI (terraform.undo_history_depth).

Version 1.2 improves compatibility with Minetest 5.2 and Mineclone 2.

User avatar
v-rob
Developer
Posts: 969
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
IRC: v-rob
Location: Right behind you.

Re: [Mod] Terraform [terraform]

by v-rob » Post

I really like this mod. While WorldEdit can do some heavy lifting, terraform is sooo much better for working with smaller, more delicate things. Cave filling is so much faster, trench digging is a breeze, and there's no need to do things like placing down grass by hand. And the undo ability is incredibly useful, making it much harder to mess up the world, unlike other bulk editing mods. I don't have the time to expound on everything I like about this mod, but suffice to say, it's really great.
Core Developer | My Best Mods: Bridger - Slats - Stained Glass

User avatar
philipbenr
Member
Posts: 1897
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: robinspi
Location: United States

Re: [Mod] Terraform [terraform]

by philipbenr » Post

While functionally there are similar mods out there, there is certainly something to be said for good UX. ;)

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform]

by x2048 » Post

v-rob wrote:
Mon May 03, 2021 05:15
I really like this mod. While WorldEdit can do some heavy lifting, terraform is sooo much better for working with smaller, more delicate things. Cave filling is so much faster, trench digging is a breeze, and there's no need to do things like placing down grass by hand. And the undo ability is incredibly useful, making it much harder to mess up the world, unlike other bulk editing mods. I don't have the time to expound on everything I like about this mod, but suffice to say, it's really great.
philipbenr wrote:
Mon May 03, 2021 06:26
While functionally there are similar mods out there, there is certainly something to be said for good UX. ;)
Wow, this is great feedback, guys! May I quote you on the front page and readme? :-D

I am really glad the feature set and the UX makes a difference, it was the initial goal for the mod.

BTW, there is a review of the mod on Minetest Videos, check out here.

User avatar
MisterE
Member
Posts: 693
Joined: Sun Feb 16, 2020 21:06
GitHub: MisterE123
IRC: MisterE
In-game: MisterE

Re: [Mod] Terraform [terraform]

by MisterE » Post

I got this error:

Code: Select all

2021-08-28 02:09:26: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'terraform' in callback environment_Step(): std::bad_alloc
2021-08-28 02:09:26: ERROR[Main]: stack traceback:
2021-08-28 02:09:26: ERROR[Main]:       [C]: in function 'get_voxel_manip'
2021-08-28 02:09:26: ERROR[Main]:       ...inetest/minetest4/games/aes_game/mods/terraform/init.lua:976: in function 'tick'
2021-08-28 02:09:26: ERROR[Main]:       ...inetest/minetest4/games/aes_game/mods/terraform/init.lua:1024: in function 'func'
2021-08-28 02:09:26: ERROR[Main]:       /home/minetest/minetest4/builtin/common/after.lua:20: in function </home/minetest/minetest4/builtin/common/after.lua:5>
2021-08-28 02:09:26: ERROR[Main]:       /home/minetest/minetest4/builtin/game/register.lua:422: in function </home/minetest/minetest4/builtin/game/register.lua:406>
2021-08-28 02:09:26: ERROR[Main]: stack traceback:

x2048
Developer
Posts: 68
Joined: Mon Feb 15, 2021 22:41
GitHub: x2048

Re: [Mod] Terraform [terraform]

by x2048 » Post

MisterE wrote:
Sat Aug 28, 2021 00:11
I got this error:

Code: Select all

2021-08-28 02:09:26: ERROR[Main]: ServerError: AsyncErr: environment_Step: Runtime error from mod 'terraform' in callback environment_Step(): std::bad_alloc
2021-08-28 02:09:26: ERROR[Main]: stack traceback:
2021-08-28 02:09:26: ERROR[Main]:       [C]: in function 'get_voxel_manip'
2021-08-28 02:09:26: ERROR[Main]:       ...inetest/minetest4/games/aes_game/mods/terraform/init.lua:976: in function 'tick'
2021-08-28 02:09:26: ERROR[Main]:       ...inetest/minetest4/games/aes_game/mods/terraform/init.lua:1024: in function 'func'
2021-08-28 02:09:26: ERROR[Main]:       /home/minetest/minetest4/builtin/common/after.lua:20: in function </home/minetest/minetest4/builtin/common/after.lua:5>
2021-08-28 02:09:26: ERROR[Main]:       /home/minetest/minetest4/builtin/game/register.lua:422: in function </home/minetest/minetest4/builtin/game/register.lua:406>
2021-08-28 02:09:26: ERROR[Main]: stack traceback:
Uh-oh. I haven't been here for a while. Your Minetest server ran out of memory when terraform:light was updating.

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests