Page 1 of 1
Dwarf Fortress like ramps in Minetest

Posted:
Mon Apr 27, 2015 22:10
by BobbyBonsaimind
If you're familiar with Dwarf Fortress, you know what I'm talking about, in case if not, here is a short explanation.
Dwarf Fortress is a real-time strategy/adventure game. Even though the concepts of Dwarf Fortress and Minetest are vastly different, but they share the same terrain idea: a voxel based approach. But Dwarf Fortress has ramps, Minetest does not.
So, after some hard thinking I came up with
with this experiment which allows to generate ramps in Minetest during the world generation phase. Keep in mind that this is inly a proof of concept and can not be applied to other subgames/mods easily. I might find the time later to see if I can bring it into a form that makes it easily re-usable.
Here is a screenshot showing the ramps with meshes.

And this one is showing the ramps as nodeboxes, with a detail level of 6.

Re: Dwarf Fortress like ramps in Minetest

Posted:
Tue Apr 28, 2015 01:35
by paramat
Interesting and looks good, i once made a mod that placed halfslabs to make terrain walkable.
Reading your code, you actually can set node rotation fast using the luavoxelmanip, set_node is extremely slow. See my flexrealm mod to see how
https://forum.minetest.net/viewtopic.php?f=11&t=7887 i use it to set rotation of trees and leaves.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Tue Apr 28, 2015 15:31
by Sokomine
Looks very nice. In the screenshots, the nodebox-variant looks even better. I think this depends on the uniform texture, where the eye desperately seeks some contrast, and will look quite diffrent with the normal dirt texture without borders.
Paramats half-step mapgen was a very intresting experiment as well, though it did not work as good as I had hoped it would. The diffrent lighting of the half-steps and the difficulty when i.e. placing a plant on them didn't work out convincingly in the end. Slopes may be diffrent in that regard. They're now supported by the engine, and their predecessors have been used extensively on Landrush for landshaping - which turned out to look very good.
Maps may look best if only a part of the nodes get converted to slopes. Some steep walls here and there amongst the smooth slopes make the world far more intresting.
The problem with other nodes on top of the slopes remains. Digging them may yield a full dirt block and thous cause no trouble at all. But placing a plant on a slope most likely won't look good. Maybe the slope ought to convert itself into a full node if something is placed on top.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Tue Apr 28, 2015 17:11
by BobbyBonsaimind
@paramat Thank you very much, I completely missed it when looking for it.
@Sokomine Thank you. At the moment the meshes/nodeboxes is determined upon start and can be changed without having to regenerate the map, so testing different settings is very easy (if you want to try it out, see the parameters.lua).
Placing something on top will of course not look nicely. Changing the ramps on the fly would be a solution, of course, that can easily be implemented on a node by node basis, if I remember correctly.
I'll see if I can extract the logic into a separate utility that can be easily re-used in other mods...but I don't know how to fix the map block problematic now.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Fri May 01, 2015 19:45
by BobbyBonsaimind
I have extracted the logic
into an easily reusable util repository...or at least I hope that it is easy to use. It allows to create and automatically place ramps, even in an already existing subgame. The system has also learned to place ramps at the ceiling, great for caves.
It looks a little odd because the textures are not made for the ramps, that's why they are a little stretched.
Here are a few more screenshots, taking in minetest-game:






Re: Dwarf Fortress like ramps in Minetest

Posted:
Sat May 02, 2015 06:11
by Krock
BobbyBonsaimind wrote:I have extracted the logic.. <snip>
Yes, the nodebox type looks much better and fits to Minetest.
There's a problem when players dig a ramp - the ramps do not "regenerate" automatically.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sat May 02, 2015 09:33
by BobbyBonsaimind
Yes, for the time being it is only applied if a map block is generated. You'd have to register an ABM or callback to the node you'd want to automatically turn into a ramp, "rampgen.run_on_node" is the function which can be applied to single nodes...I added an example to the README.
Though, the API is at the moment a little bit complicated with the lookup table that is required, but I didn't have a better idea.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sat May 02, 2015 16:34
by paramat
Stunning.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sat May 02, 2015 17:13
by ExeterDad
@BobbyBonsaimind
Without looking at your models... I think the odd shading on the corners of the ramps is cause by not exporting your normals when exporting the .obj
The engine won't know how to treat the lighting on the mesh without them. I ran into this when helping Don out with the myroofs and mypaths mods. I was pulling my hair out for days trying to figure out what was wrong with the meshes and why there was this mysterious "shading"
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sun May 03, 2015 08:38
by BobbyBonsaimind
Re: Dwarf Fortress like ramps in Minetest

Posted:
Tue May 05, 2015 23:24
by paramat
That looks good, i actually prefer the ramps to stepped nodeboxes
Re: Dwarf Fortress like ramps in Minetest

Posted:
Wed May 06, 2015 15:38
by LionsDen
Yeah, I prefer the ramps as well.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sat May 09, 2015 15:57
by Wuzzy
Well, that's cool. I like the idea. This reminds me of OpenTTD. :-)
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sun May 10, 2015 12:44
by BobbyBonsaimind
@wuzzy Yeah, me too, it also reminds me a lot of older games like Half Life, especially when walking through the terrain.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sat May 30, 2015 10:03
by red
Where can I download the version for minetest_game?
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sat May 30, 2015 14:46
by BobbyBonsaimind
@red There is no package, you'll have to do it yourself. Here is a very simple variant that will only place ramps during worldgen, you will not be able to place it again afterwards:
1. Get the worldgen-utils and utils mods and pace them in the minetest_game/mods directory.
2. Create a new directory in minetest_game/mods named "mtg_ramps".
3. Create in that directory the files "init.lua" and "depends.txt".
Now to the content of said files, depends.txt:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
And init.lua:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local function register_ramps(lookup_table, node_name)
return tableutil.merge(
lookup_table,
ramputil.register_ramps_for_node(
"default:" .. node_name,
"mtg_ramps:" .. node_name,
true,
6
)
)
end
local ramped_nodes = {}
ramped_nodes = register_ramps(ramped_nodes, "desert_sand")
ramped_nodes = register_ramps(ramped_nodes, "dirt")
ramped_nodes = register_ramps(ramped_nodes, "dirt_with_grass")
ramped_nodes = register_ramps(ramped_nodes, "dirt_with_snow")
ramped_nodes = register_ramps(ramped_nodes, "ice")
ramped_nodes = register_ramps(ramped_nodes, "sand")
ramped_nodes = register_ramps(ramped_nodes, "snow")
ramped_nodes = register_ramps(ramped_nodes, "stone")
minetest.register_on_generated(function(minp, maxp, seed)
local manipulator = MapManipulator:new()
rampgen.run(manipulator, minp, maxp, ramped_nodes)
manipulator:set_data()
end)
You'd need to register a callback for the place and dig functions if you want that the ramps are automatically created every time you place or dig a node. I'm not sure how that is possible, given that those nodes are already registered, I'd need to look into it. Also this method has the downside that the textures are kinda distorted.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sat Jun 13, 2015 12:37
by MirceaKitsune
This is an amazing idea, thank you for doing it! It might actually work out as an alternative to my
smooth voxel terrain idea, depending on how fast and complete this approach can be.
However, I cannot get it to work. I tried this as both a mod and a game, and it crashes as both.
That said, the thing I can say I don't like about this straight away is that it uses an individual node definition per corner. Is there no way to change the mesh or node box of an individual mesh yet, and can this be implemented? From what I know, a change was recently added that lets you modify the texture of an individual node placed in the world.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Sun Jun 14, 2015 15:24
by BobbyBonsaimind
I don't think that "alternative" is a great term, it really is something different, with similar intentions. I like your idea of a smooth terrain in the way you proposed and would like it to see it implement one day (I'm not sure if I could do it or find the time to do it, Marching Cubes seems quite straighforward to implement, but because of mechanics of Minetest there are a lot of corner cases to consider).
If you let me know the error with which it crashes, I might be able to pin point the issue.
I don't think that you can change a node on the fly, at least I could not find a good reference for it. However you can "link" these four nodes (normal plus three ramps) together in a way that it makes it appear like it is only one node to the player.
Re: Dwarf Fortress like ramps in Minetest

Posted:
Wed Jun 24, 2015 23:01
by Inocudom
BobbyBonsaimind, you have my thanks for undertaking such an ambitious project. If this feature ever makes it into Minetest, the results will be phenomenal.