[Mod] Structures [git] [minetest_mods_structures]

User avatar
thefamilygrog66
Member
 
Posts: 169
Joined: Mon Jul 09, 2012 19:08

by thefamilygrog66 » Mon Jun 10, 2013 00:32

MirceaKitsune wrote:thefamilygrog66: That's probably because the default structures are set to only spawn from 5 nodes up (in some cases even higher). They'd spawn too close to water which looked ugly without that. Also note that the default buildings only spawn on grass_with_dirt, so make sure that's what the flat floor is made of.


Ah, that makes sense. I wonder if the mod can check to see if "flat" is indicated in the map generation attributes in the minetest.conf file, and if so, lower the minimum height at which to spawn.

Anyway, which line of code is that specified, so I can try it out in the flatlands? Thanks!
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Mon Jun 10, 2013 10:36

thefamilygrog66 wrote:Ah, that makes sense. I wonder if the mod can check to see if "flat" is indicated in the map generation attributes in the minetest.conf file, and if so, lower the minimum height at which to spawn.

Anyway, which line of code is that specified, so I can try it out in the flatlands? Thanks!


Doubt I can do that, and I like the current implementation as it is (code's already complex enough).

I don't suggest editing the script either. Instead, edit the minimum spawn height of structures in mapgen.txt. I think that's the third parameter counting from the end to left (5 for most buildings and 25 for the tower). Setting it to 0 should do the trick.
 

User avatar
thefamilygrog66
Member
 
Posts: 169
Joined: Mon Jul 09, 2012 19:08

by thefamilygrog66 » Mon Jun 10, 2013 19:46

MirceaKitsune wrote:
thefamilygrog66 wrote:Ah, that makes sense. I wonder if the mod can check to see if "flat" is indicated in the map generation attributes in the minetest.conf file, and if so, lower the minimum height at which to spawn.

Anyway, which line of code is that specified, so I can try it out in the flatlands? Thanks!


Doubt I can do that, and I like the current implementation as it is (code's already complex enough).

I don't suggest editing the script either. Instead, edit the minimum spawn height of structures in mapgen.txt. I think that's the third parameter counting from the end to left (5 for most buildings and 25 for the tower). Setting it to 0 should do the trick.


Great, thanks! I'll try it out.
 

User avatar
Mossmanikin
Member
 
Posts: 599
Joined: Sun May 19, 2013 16:26

by Mossmanikin » Mon Jun 10, 2013 23:50

Find this mod very useful for exporting and importing buildings from one map to another.
I use it together with WorldEdit.
Although I'm not using it yet, I like the possibility to let custom villages spawn.

Noob 4 life!
My stuff
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Sun Jun 16, 2013 18:10

Added a load of small but important fixes and improvements today. Also added farms now that Minetest has a default farming system at last.

Image

Image
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Wed Jun 19, 2013 11:39

Yesterday I tackled the issue of structures spawning on extreme terrain, causing holes in cliff walls and tall floors over large peaks. The surface is checked at each corner and structures only spawn if the difference is at most 20 by default.
 

User avatar
Inocudom
Member
 
Posts: 2889
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Wed Jun 19, 2013 13:15

This is a nice mod. It could be used alongside peaceful_npc to spawn villages in maps.
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Thu Jun 20, 2013 19:00

Spawning entire villages is pretty difficult. Even a 80x80 map of a village proved problematic. I hope it will get better with the new mapgen. MirceaKitsune wrote a function to improve spawning, but other developers where apparently working on something similar. I hope the needed function to set multiple nodes at a time will be available soon.
A list of my mods can be found here.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Thu Jun 20, 2013 20:34

Sokomine wrote:Spawning entire villages is pretty difficult. Even a 80x80 map of a village proved problematic. I hope it will get better with the new mapgen. MirceaKitsune wrote a function to improve spawning, but other developers where apparently working on something similar. I hope the needed function to set multiple nodes at a time will be available soon.


Spawning whole villages (pretty large ones too) works surprisingly well with the latest mod. Partly because I optimize the loops and actions so nothing is wasted. It still takes a lot until all buildings are spawned however (I'd estimate over 30 seconds per group instance) and there are still incomplete / malformed spawns occasionally. Still, it can safely work and do its thing... especially for normal sized houses and the like.

My biggest issue with the mod at this moment is the spawning pattern. Randomly searching for origins and avoiding buildings is both slower and uglier. I'm hoping to figure out a matrix system which can analyze building sizes and distances and calculate all origins in an uniform grid before spawning begins. I shall get around to that too soon enough.

Other improvements done yesterday include fixing buildings that were supported by leafs or water. Only nodes with drawtype "normal" are calculated for ground roughness, and if they aren't found the building doesn't spawn.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Sun Jun 23, 2013 19:58

I'm happy to announce the biggest improvement since the creation of this mod. I've been working on a new spawn pattern, together with a major rewrite of the mapgen system. The latest code has a much more optimal and cheap architecture and results in a way better spawn pattern.

Previously, a radius was given and buildings would randomly choose a location within it, doing expensive checks to avoid other buildings. The new system arranges buildings into columns and rows, then jigsaws them into place under an uniform pattern. There are no more avoidance checks, and each building knows exactly where it goes before the system begins spawning anything. Buildings are now placed in line and as little space as possible is wasted between them, resulting dense and nice looking cities.

The new architecture also moves the hard work (position checks, trigger node search, terrain roughness checks) to a new function which simply returns the structure list and parameters. Spawning only begins after this list is received and we know where everything goes. Previously the dirty work was done per-building, resulting in laggy checks each time and resource intensive spawns. Performance improvement with the current architecture is visibly noticeable.

Here are some screenshots of how towns look with the new code:

Image

Image

Image

Thanks to the better density, I was able to generate the largest town so far during one of the tests. Although it might seem scary when you think of all the nodes being spawned, it actually worked pretty quickly on my machine (single player). When the voxel manipulator will be ready, spawning of large and numerous structures will be a ton faster. This is the big town I got so far:

Image

Image
 

User avatar
Topywo
Member
 
Posts: 1718
Joined: Fri May 18, 2012 20:27

by Topywo » Sun Jun 23, 2013 20:15

Great work!
 

Temperest
Member
 
Posts: 651
Joined: Tue Nov 15, 2011 23:13
GitHub: Uberi

by Temperest » Sun Jun 23, 2013 20:56

Wow, is this using the new schematics stuff? Those look really well placed, blends right into the landscape.

I bet it would look a bit better if it set the lower nodes to dirt with grass instead of leaving the stone visible.
WorldEdit 1.0 released

The Mesecons Laboratory - the art of Mesecons circuitry
Latest article: Mesecons Basics.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Wed Jun 26, 2013 10:18

Temperest wrote:Wow, is this using the new schematics stuff? Those look really well placed, blends right into the landscape.

I bet it would look a bit better if it set the lower nodes to dirt with grass instead of leaving the stone visible.


No, it uses its own original system to spawn stuff. I'm not sure if schematics would be most appropriate here. I might consider using that though... if it wouldn't be too painful to switch the I/O system to their format.

Anyway, I fixed and adapted more things during the last days. Merged the ground level detection and terrain roughness checks into one formula, which yields in better centered buildings. Also made group radius be detected automatically, and now groups can spawn very close to each other if they don't collide. Here's screenshots of two neighboring towns:

Image

Image
 

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Wed Jun 26, 2013 13:57

I have a little suggestion: add some way to smooth the terrain around the places where you place buildings, so it is not visible that you are adding dirt_with_grass around it...
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

by Sokomine » Wed Jun 26, 2013 15:16

The spawning of towns/villages, or, as you call it, group spawning, looks already quite well. I hope the *schematic functions will get extended with rotation (that's planned according to hmmm) and a way to easily replace nodes. In that case, much of the work could be done with those schematics.
A list of my mods can be found here.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Wed Jun 26, 2013 17:06

Sokomine wrote:The spawning of towns/villages, or, as you call it, group spawning, looks already quite well. I hope the *schematic functions will get extended with rotation (that's planned according to hmmm) and a way to easily replace nodes. In that case, much of the work could be done with those schematics.


I already added support for schematics today. Initially it works, and it's sure a lot faster. But of course it's disabled by default for now because:

- As you said, you can only spawn at one rotation. Nothing can be done until the function supports 0 / 90 / 180 / 270 rotations too.

- Inability to measure the area which the schematic would take up. I need a safety check to assure that importing a structure doesn't go out of the bounds specified with markers. If anyone knows of a way tell me... all I'd need is to know the X Y and Z size of the schematic before creating it.

- Waiting for the furnace crash to be fixed. Currently importing a schematic which contains a furnace crashes Minetest due to the fuel parameter.
Last edited by MirceaKitsune on Wed Jun 26, 2013 17:07, edited 1 time in total.
 

sweetbomber
New member
 
Posts: 4
Joined: Tue Jul 03, 2012 16:38

by sweetbomber » Thu Jun 27, 2013 14:13

Hi MirceaKitsune,

I suggest you to focus on the spawning of structures by the user, as the natural spawning of structures by mapgen is currently being taken care by me, which shall have much higher performance in core rather than lua.

What im doing is aimed at very large structures, such as towns, or very big structures in general, like floating spaceships, boats, etc...
I encourage people to use your format, and build such type of structures, since im using your format for schematic import.
People can even design structures from other games, such as command and conquer :) that would be nice :)
 

sweetbomber
New member
 
Posts: 4
Joined: Tue Jul 03, 2012 16:38

by sweetbomber » Thu Jun 27, 2013 14:26

Btw, nodes with meta require the call to on_create, such as furnaces, chests, etc...
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Thu Jun 27, 2013 20:00

sweetbomber wrote:Hi MirceaKitsune,

I suggest you to focus on the spawning of structures by the user, as the natural spawning of structures by mapgen is currently being taken care by me, which shall have much higher performance in core rather than lua.

What im doing is aimed at very large structures, such as towns, or very big structures in general, like floating spaceships, boats, etc...
I encourage people to use your format, and build such type of structures, since im using your format for schematic import.
People can even design structures from other games, such as command and conquer :) that would be nice :)


I don't think anything better than the schematics system can be done for spawning buildings. With that, the Lua code for this mod only handles detecting ground level, terrain nodes and level, and generating the structure pattern (considering I later plan on adding roads too... someday somehow). Doubt a system that specific would get accepted in the code upstream. But good luck with that idea, it could be very useful :)
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Tue Jul 09, 2013 20:34

hmmm fixed the facedir rotations for schematics, while PilzAdam explained how to fix the furnace crash. As a result, the I/O system has been defaulted to schematics and the default buildings converted from txt to mts. The clear function as well as the function to generate structure floors were switched to use the voxel manipulator instead.

Spawning structures is a lot less resource intensive and more fast now! It's also safer as there are no more incomplete spawns caused by the Lua <-> C++ lag. There are some minor issues left which I'll hopefully figure out in time... mostly floors being built incorrectly.

The text-file system will still exist for a while for compatibility. It will eventually be removed, so if you have any txt structures convert them to mts.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Wed Jul 10, 2013 18:44

A few more changes today. I added a 'bury' mapgen parameter which allows structures to be spawned that many nodes into the ground (when negative above it). This allows buildings to have basements or other areas hidden underground.

Also separated building-specific functions from the base mapgen file. When roads will be implemented the same will be done for them.
Last edited by MirceaKitsune on Wed Jul 10, 2013 18:44, edited 1 time in total.
 

User avatar
Inocudom
Member
 
Posts: 2889
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Wed Jul 10, 2013 19:44

This sounds like it is coming along nicely. I think this would be a great basis for spawning alien ruins in paramat's titan realm.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Thu Jul 11, 2013 23:32

Added a fun little system today. Since node metadata isn't saved with structures, signs are set to have the address of each home. So if any structure contains a sign, its text will be the number (in reality the position of the loop iteration). Signs were added to the houses and tower for this purpose.

Also limited the amount of retries on unloaded areas, so if a place never loads don't keep trying to create a group there forever.

Image

Image

Image

Image
Last edited by MirceaKitsune on Thu Jul 11, 2013 23:33, edited 1 time in total.
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Fri Jul 12, 2013 04:37

MirceaKitsune: Disable the filtering if youre using a 16x pack...

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Fri Jul 12, 2013 09:59

Jordach wrote:MirceaKitsune: Disable the filtering if youre using a 16x pack...


I usually do that, but temporarily had a HD pack and forgot to.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Fri Jul 12, 2013 13:08

Today I fixed the terrain corner skip issue (allowed buildings to be supported by air in some cases). Some Lua functionality with tables got me very confused and it took a while until I figured it out. Also converted table.getn(t) to #t which is the correct name now and needed for Lua 5.2 compatibility. This mod is relatively bug-free now, except for some buildings occasionally cutting into each other for a reason not known yet.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

by MirceaKitsune » Sat Jul 13, 2013 19:23

Major new feature added today, as an expansion to the address signs. There's now a metadata text file, containing metadata instructions which are applied to nodes in structures that are naturally spawned. The format is:

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
name [1], field [2], value [3], probability [4]


For all nodes of type 'name' the 'field' is set to 'value' if 'probability' is true. There can be any number of such lines in the metadata file, and each line is shuffled to eliminate ordering influence to probabilities. The 'value' can also contain expressions which are replaced inside the code (eg: $NAME is converted to the name of the structure).

Currently this is used for address signs. I'm planning to use them to add random inventory to chests, but due to the complex node inventory system it's a bit difficult to (since this only works with meta:set_string commands). If anyone figures out how to set the inventory of a chest using only meta:set_string that would be highly appreciated! Till then this system should be good for several things, and the system will prolly help with features like technic_game's where newly spawned machines can be already functional.
 

Exilyth
Member
 
Posts: 60
Joined: Sun Jul 28, 2013 18:46

by Exilyth » Sat Aug 03, 2013 18:22

Looks nice, downloading now...

As I said about street generation on the screenshot thread (were I found out about this mod):
"Most cities have a motorway/highway; from which main streets branch off; from which side streets branch off; from which back alleys branch off...

If you look at it like that, you could (ab-)use L-Systems for streets. The hard part would then be assigning buildings to the space between the streets."


Also, there's http://vterrain.org/, which imho is a great source for everything terrain generation related (although it links mostly to academic sources, which tend to be heavy on theory).


Edit:
Finally found this article again - http://procworld.blogspot.de/2012/03/building-rooms.html.
That would be a nice method to get different room layouts for the same building.
Last edited by Exilyth on Mon Aug 05, 2013 10:49, edited 1 time in total.
I'm running 0.4.13 stable with [technic][carts][farming_plus][biome_lib][unified_inventory] and a few other mods.
 

Exilyth
Member
 
Posts: 60
Joined: Sun Jul 28, 2013 18:46

by Exilyth » Sat Aug 03, 2013 21:29

So, I walked away far enough to generate a chunk with structures in an already existing world...

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
...
23:15:17: ACTION[ServerThread]: singleplayer places node default:cobble at (-177,28,853)
23:15:28: ACTION[ServerThread]: singleplayer damaged by 2 hp at (-169.793,21.3,855.318)
23:15:57: ERROR[EmergeThread0]: ERROR: An unhandled exception occurred: LuaError: error: ...\minetest-0.4.7\bin\..\mods\structures/structures_io.lua:29: bad argument #1 to 'byte' (string expected, got nil)
23:15:57: ERROR[EmergeThread0]: stack traceback:

In thread 9b4:
..\..\src\minetest\src\emerge.cpp:472: EmergeThread::Thread: Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD 9b4:
#0  EmergeThread::Thread
(Leftover data: #1  ServerMap::emergeBlock: p=(-17,3,68), create_blank=0)
(Leftover data: #2  ServerMap::createSector: p2d=(-17,68))
(Leftover data: #3  ServerMap::loadBlock)
DEBUG STACK FOR THREAD 9fc:
#0  main
#1  ClientMap::renderMap
(Leftover data: #2  ClientEnvironment::step)
(Leftover data: #3  Client::Receive)
(Leftover data: #4  Client::ProcessData)
(Leftover data: #5  MeshUpdateQueue::addBlock)
DEBUG STACK FOR THREAD a40:
#0  MeshUpdateThread::Thread
DEBUG STACK FOR THREAD c70:
#0  ServerThread::Thread
#1  Server::Receive
(Leftover data: #2  ServerEnvironment::step)
(Leftover data: #3  Server::SendBlockNoLock)
(Leftover data: #4  Server::SendHP)
(Leftover data: #5  ServerMap::loadBlock)
(Leftover data: #6  ItemStack::deSerialize)


Does this mod require a version of minetest newer than 0.4.7?
I'm running 0.4.13 stable with [technic][carts][farming_plus][biome_lib][unified_inventory] and a few other mods.
 

User avatar
Inocudom
Member
 
Posts: 2889
Joined: Sat Sep 29, 2012 01:14
IRC: Inocudom
In-game: Inocudom

by Inocudom » Sat Aug 03, 2013 23:26

Exilyth wrote:So, I walked away far enough to generate a chunk with structures in an already existing world...

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
...
23:15:17: ACTION[ServerThread]: singleplayer places node default:cobble at (-177,28,853)
23:15:28: ACTION[ServerThread]: singleplayer damaged by 2 hp at (-169.793,21.3,855.318)
23:15:57: ERROR[EmergeThread0]: ERROR: An unhandled exception occurred: LuaError: error: ...\minetest-0.4.7\bin\..\mods\structures/structures_io.lua:29: bad argument #1 to 'byte' (string expected, got nil)
23:15:57: ERROR[EmergeThread0]: stack traceback:

In thread 9b4:
..\..\src\minetest\src\emerge.cpp:472: EmergeThread::Thread: Assertion '0' failed.
Debug stacks:
DEBUG STACK FOR THREAD 9b4:
#0  EmergeThread::Thread
(Leftover data: #1  ServerMap::emergeBlock: p=(-17,3,68), create_blank=0)
(Leftover data: #2  ServerMap::createSector: p2d=(-17,68))
(Leftover data: #3  ServerMap::loadBlock)
DEBUG STACK FOR THREAD 9fc:
#0  main
#1  ClientMap::renderMap
(Leftover data: #2  ClientEnvironment::step)
(Leftover data: #3  Client::Receive)
(Leftover data: #4  Client::ProcessData)
(Leftover data: #5  MeshUpdateQueue::addBlock)
DEBUG STACK FOR THREAD a40:
#0  MeshUpdateThread::Thread
DEBUG STACK FOR THREAD c70:
#0  ServerThread::Thread
#1  Server::Receive
(Leftover data: #2  ServerEnvironment::step)
(Leftover data: #3  Server::SendBlockNoLock)
(Leftover data: #4  Server::SendHP)
(Leftover data: #5  ServerMap::loadBlock)
(Leftover data: #6  ItemStack::deSerialize)


Does this mod require a version of minetest newer than 0.4.7?


It is very likely that it does. Try using the latest development build from either PilzAdam, Sfan5, or Fess.
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 8 guests

cron