[MOD] villages

ironzorg
Member
 
Posts: 46
Joined: Tue Aug 23, 2011 06:34

[MOD] villages

by ironzorg » Sat Dec 10, 2011 14:09

Hello everyone.

Releasing that mod I made a couple days ago that will randomly place buildings on your map.

Default buildings
Image

Watchtower ruin (built on sand/dirt)

Image

Watchtower (built on sand/dirt)

Image

Wooden house (built on dirt)

How it works
  • You declare the building in the buildings.lua file (cf below)
  • You force the server to generate new chunks
  • Enjoy !

For each new chunk generated, the mod will try to place the building on the map: if it fits, it uses the value (the `odds`) you declared for that building to decide weither the building can be placed or not.

How to declare new buildings
The buildings file is basically a single table in which you have to declare your buildings. It uses the variables:
  • name: the name of the building
  • size: the dimensions of the building (in relation to the `structure` variable
  • odds: chances the building has to be placed on the map for each chunk it fits in
  • building_surfaces: a table of the nodes the building can be placed on
  • structure: the actual building

The mod
I called it "villages" but it's merely a mod that allows you to place random buildings on the map. It's up to you to make it generate complete towns !

Note that every building you generate has to be AT MOST 15x15x15 nodes, which is the size of the chunks generated by the server.

Download init.lua

Download buildings.lua
Last edited by ironzorg on Sun Dec 11, 2011 15:44, edited 1 time in total.
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Dec 10, 2011 14:19

We need better a File Format for the Buildings
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

ironzorg
Member
 
Posts: 46
Joined: Tue Aug 23, 2011 06:34

by ironzorg » Sat Dec 10, 2011 14:26

sfan5 wrote:We need better a File Format for the Buildings

Unless you are talking about the way the tables are organized, I think what I have here is pretty much the less time consuming way of going through all the available buildings at runtime.

What did you have in mind ?
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Dec 10, 2011 14:39

ironzorg wrote:
sfan5 wrote:We need better a File Format for the Buildings

Unless you are talking about the way the tables are organized, I think what I have here is pretty much the less time consuming way of going through all the available buildings at runtime.

What did you have in mind ?

Something like:
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
wood,wood,wood,wood <- this is from pos to pos+(4,0,0)
stone,stone,stone,stone <- this is from pos+(0,1,0) to pos+(4,1,0)
;
tree,tree,tree,tree <- this is from pos+(0,0,1) to pos+(4,0,1)
leaves,leaves,leaves,leaves <- this is from pos+(0,1,1) to pos+(4,1,1)

Anything after "<-" is a comment

By the Way, cool Mod!
Last edited by sfan5 on Sat Dec 10, 2011 14:41, edited 1 time in total.
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

ironzorg
Member
 
Posts: 46
Joined: Tue Aug 23, 2011 06:34

by ironzorg » Sat Dec 10, 2011 14:47

sfan5 wrote:
ironzorg wrote:
sfan5 wrote:We need better a File Format for the Buildings

Unless you are talking about the way the tables are organized, I think what I have here is pretty much the less time consuming way of going through all the available buildings at runtime.

What did you have in mind ?

Something like:
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
wood,wood,wood,wood <- this is from pos to pos+(4,0,0)
stone,stone,stone,stone <- this is from pos+(0,1,0) to pos+(4,1,0)
;
tree,tree,tree,tree <- this is from pos+(0,0,1) to pos+(4,0,1)
leaves,leaves,leaves,leaves <- this is from pos+(0,1,1) to pos+(4,1,1)

Anything after "<-" is a comment

By the Way, cool Mod!


Thanks.

However: I thought about that format too, the thing is that it adds a lot of code for parsing the file, detecting errors, etc…
I don't feel like doing it right now (although I might in a near future), I'll just focus on improving the main algorithm.

Patches welcome, of course.
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Dec 10, 2011 14:50

ironzorg wrote:
sfan5 wrote:...


Thanks.

However: I thought about that format too, the thing is that it adds a lot of code for parsing the file, detecting errors, etc…
I don't feel like doing it right now (although I might in a near future), I'll just focus on improving the main algorithm.

Patches welcome, of course.

I'm working on WorldEdit for Minetest.
Maybe I'll write a parser for this file format
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
lmtea
Member
 
Posts: 35
Joined: Tue Oct 18, 2011 13:40

by lmtea » Sat Dec 10, 2011 15:19

Not working for me(

Debug.txt


-------------
Separator
-------------

Debug streams initialized, disable_stderr=0
22:16:40: ACTION[main]: minetest with SER_FMT_VER_HIGHEST=21, VER=0.4.dev-20111209-1 RUN_IN_PLACE=1 USE_GETTEXT=1 INSTALL_PREFIX=/usr/local BUILD_TYPE=Release
22:16:40: INFO[main]: Parsing configuration file: "/home/semen/minetest-dev/minetest/bin/../minetest.conf"
22:16:40: INFO[main]: Settings: Setting not found: "enable-unittests"
22:16:40: INFO[main]: Settings: Setting not found: "server"
22:16:41: INFO[main]: Settings: Setting not found: "speedtests"
22:16:41: INFO[main]: Settings: Setting not found: "random-input"
22:16:41: INFO[main]: text_height=18
22:16:41: INFO[main]: Created main menu
22:16:42: INFO[main]: Dropping main menu
22:16:42: INFO[main]: Updating configuration file: "/home/semen/minetest-dev/minetest/bin/../minetest.conf"
22:16:42: INFO[main]: Creating server
AuthManager: loading from /home/semen/minetest-dev/minetest/bin/../world/auth.txt
BanManager: loading from /home/semen/minetest-dev/minetest/bin/../world/ipban.txt
22:16:42: INFO[main]: Mod search paths:
22:16:42: INFO[main]: /home/semen/minetest-dev/minetest/bin/../usermods
22:16:42: INFO[main]: /home/semen/minetest-dev/minetest/bin/../world/worldmods
22:16:42: INFO[main]: /home/semen/minetest-dev/minetest/bin/../data/mods
22:16:42: INFO[main]: Server: Initializing scripting
22:16:42: INFO[main]: scriptapi_export
22:16:42: INFO[main]: Server: Loading builtin Lua stuff from "/home/semen/minetest-dev/minetest/bin/../data/builtin.lua"
22:16:42: INFO[main]: Loading and running script from /home/semen/minetest-dev/minetest/bin/../data/builtin.lua
22:16:42: INFO[main]: registerNode: registering content id "126": name="air"
22:16:42: INFO[main]: registerNode: registering content id "127": name="ignore"
22:16:42: INFO[main]: registerNode: WARNING: Ignoring CONTENT_IGNORE redefinition
22:16:42: INFO[main]: Server: Loading mod "villages"
22:16:42: INFO[main]: Loading and running script from /home/semen/minetest-dev/minetest/bin/../data/mods/villages/init.lua
22:16:42: ERROR[main]: Failed to load and run script from /home/semen/minetest-dev/minetest/bin/../data/mods/villages/init.lua:
22:16:42: ERROR[main]: [LUA]
22:16:42: ERROR[main]: [LUA] ...test-dev/minetest/bin/../data/mods/villages/init.lua:1: module 'data/mods/villages/buildings' not found:
22:16:42: ERROR[main]: no field package.preload['data/mods/villages/buildings']
22:16:42: ERROR[main]: no file './data/mods/villages/buildings.lua'
22:16:42: ERROR[main]: no file '/usr/local/share/lua/5.1/data/mods/villages/buildings.lua'
22:16:42: ERROR[main]: no file '/usr/local/share/lua/5.1/data/mods/villages/buildings/init.lua'
22:16:42: ERROR[main]: no file '/usr/local/lib/lua/5.1/data/mods/villages/buildings.lua'
22:16:42: ERROR[main]: no file '/usr/local/lib/lua/5.1/data/mods/villages/buildings/init.lua'
22:16:42: ERROR[main]: no file './data/mods/villages/buildings.so'
22:16:42: ERROR[main]: no file '/usr/local/lib/lua/5.1/data/mods/villages/buildings.so'
22:16:42: ERROR[main]: no file '/usr/local/lib/lua/5.1/loadall.so'
22:16:42: ERROR[main]: stack traceback:
22:16:42: ERROR[main]: [C]: in function 'require'
22:16:42: ERROR[main]: ...test-dev/minetest/bin/../data/mods/villages/init.lua:1: in main chunk
22:16:42: ERROR[main]: [LUA]
22:16:42: ERROR[main]: Server: Failed to load and run /home/semen/minetest-dev/minetest/bin/../data/mods/villages/init.lua
BanManager: saving to /home/semen/minetest-dev/minetest/bin/../world/ipban.txt
AuthManager: saving to /home/semen/minetest-dev/minetest/bin/../world/auth.txt
22:16:42: ERROR[main]: ModError: Failed to load and run /home/semen/minetest-dev/minetest/bin/../data/mods/villages/init.lua
22:16:42: ERROR[main]: error_message = ModError: Failed to load and run /home/semen/minetest-dev/minetest/bin/../data/mods/villages/init.lua
22:16:42: ERROR[main]: Check debug.txt for details.
22:16:42: INFO[main]: Created main menu
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Dec 10, 2011 15:21

You forgot to download buildings.lua
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
lmtea
Member
 
Posts: 35
Joined: Tue Oct 18, 2011 13:40

by lmtea » Sat Dec 10, 2011 15:29

No, I have it.
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Dec 10, 2011 16:00

Try to change
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
require('data/mods/villages/buildings')

to
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
require('buildings')
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

bwog
Member
 
Posts: 283
Joined: Wed Nov 30, 2011 14:09

by bwog » Sat Dec 10, 2011 16:47

Once the bugs get sorted out I'll try it.
 

User avatar
xyz
Member
 
Posts: 449
Joined: Thu Nov 10, 2011 14:25

by xyz » Sat Dec 10, 2011 16:57

Nice mod. Just some ideas:
1) use table.getn() to get table size (and dont make user to input x, y and z for every building)
2) maybe make chances depend on what buildings are near? to finally make villages (for example - farm near house, etc..)
 

ironzorg
Member
 
Posts: 46
Joined: Tue Aug 23, 2011 06:34

by ironzorg » Sat Dec 10, 2011 17:19

xyz wrote:Nice mod. Just some ideas:
1) use table.getn() to get table size (and dont make user to input x, y and z for every building)
2) maybe make chances depend on what buildings are near? to finally make villages (for example - farm near house, etc..)


No, I want to be able to draw parts of a building.

MrThebuilder3: your mod folders has to be called 'village'. Also paste your debug.txt file to codepad instead of flooding this thread.
 

User avatar
MrThebuilder3
Member
 
Posts: 104
Joined: Sat Nov 19, 2011 18:26

by MrThebuilder3 » Sat Dec 10, 2011 17:32

i'll try that and sorry
 

User avatar
MrThebuilder3
Member
 
Posts: 104
Joined: Sat Nov 19, 2011 18:26

by MrThebuilder3 » Sat Dec 10, 2011 17:36

nope:(
 

User avatar
xyz
Member
 
Posts: 449
Joined: Thu Nov 10, 2011 14:25

by xyz » Sat Dec 10, 2011 17:44

ironzorg wrote:
xyz wrote:Nice mod. Just some ideas:
1) use table.getn() to get table size (and dont make user to input x, y and z for every building)
2) maybe make chances depend on what buildings are near? to finally make villages (for example - farm near house, etc..)


No, I want to be able to draw parts of a building.

MrThebuilder3: your mod folders has to be called 'village'. Also paste your debug.txt file to codepad instead of flooding this thread.

ah, ok, got your idea
but what about number 1)?
 

Wolfgang
Member
 
Posts: 37
Joined: Thu Jun 23, 2011 11:21

by Wolfgang » Sat Dec 10, 2011 18:11

Is there a way to distinguish auto generated buildings from player made content? Otherwise this gives a new excuse for griefing: "Oh that was your building? I assumed it to be some auto-generated place."
 

User avatar
neko259
Member
 
Posts: 769
Joined: Sun Jun 19, 2011 06:51

by neko259 » Sat Dec 10, 2011 18:31

Wolfgang wrote:Is there a way to distinguish auto generated buildings from player made content? Otherwise this gives a new excuse for griefing: "Oh that was your building? I assumed it to be some auto-generated place."


Maybe add some sign near the building door. For example, "AUTO 0001" or something similar.
Bitcoin donations: 18r66dJmUjwTmWRTFnorpGMzs8d4B8jzbw
 

User avatar
lmtea
Member
 
Posts: 35
Joined: Tue Oct 18, 2011 13:40

by lmtea » Sun Dec 11, 2011 06:43

Not working(
 

ironzorg
Member
 
Posts: 46
Joined: Tue Aug 23, 2011 06:34

by ironzorg » Sun Dec 11, 2011 08:53

To install the mod, just create a `villages` folder in your mods directory and paste init.lua and buildings.lua in it. Create a new file called depends.txt that contains `default`.

And the most important: lua uses your PWD to locate the mods, so launch the game from the main minetest directory (where the data folder is).

Nothing fancy, I didn't think I would have to explain all this. Ima try to fix this though, its annoying to have mod pwd reliant.

neko259 wrote:
Wolfgang wrote: Is there a way to distinguish auto generated buildings from player made content? Otherwise this gives a new excuse for griefing: "Oh that was your building? I assumed it to be some auto-generated place."

Maybe add some sign near the building door. For example, "AUTO 0001" or something similar.


I don't think a sign will do the trick. I don't think you can really check that your automatically generated buildings are not turned to a pile of dust by some griefers.
Well, there is one way: make a server mod that disallow harvesting of groups of blocks (= the buildings), but even you will probably need to destroy an annoying watchtower that spawned out of nowhere on the space you wanted to build a giant castle.
 

User avatar
Staffs
Member
 
Posts: 329
Joined: Thu Aug 04, 2011 13:16

by Staffs » Sun Dec 11, 2011 10:17

ironzorg wrote:Hello everyone.

Image

Wooden house (built on dirt)


Hey behind the tree there is something like jellyfish but grey... What is it ?
I love mods :D
 

User avatar
lmtea
Member
 
Posts: 35
Joined: Tue Oct 18, 2011 13:40

by lmtea » Sun Dec 11, 2011 12:04

It's rat)
 

Wolfgang
Member
 
Posts: 37
Joined: Thu Jun 23, 2011 11:21

by Wolfgang » Sun Dec 11, 2011 13:48

ironzorg wrote:I don't think a sign will do the trick. I don't think you can really check that your automatically generated buildings are not turned to a pile of dust by some griefers.
Well, there is one way: make a server mod that disallow harvesting of groups of blocks (= the buildings), but even you will probably need to destroy an annoying watchtower that spawned out of nowhere on the space you wanted to build a giant castle.


Exactly. If a player made the annoying watchtower I'd have to build somewhere else. But if it is a automatically generated building, not claimed by any player it is pickaxe time. At the moment it is usually easy to tell if the structure is a generated dungeon or something else. (Unless it is a already vandalized building). So some sign might help. Then again first griefer steals sign or changes sign on player's building to
 

ironzorg
Member
 
Posts: 46
Joined: Tue Aug 23, 2011 06:34

by ironzorg » Sun Dec 11, 2011 14:13

Staffs wrote:
ironzorg wrote:Hello everyone.

Image

Wooden house (built on dirt)


Hey behind the tree there is something like jellyfish but grey... What is it ?


It is indeed a rat, from g4cj's texture pack.

I will fix the require('buildings') bug whenever the repo gets updated, but for now you will have to launch the game from its main directory.

EDIT: Thanks to celeron55's patch, this bug is fixed in the current dev release. I updated the init.lua file.
Last edited by ironzorg on Sun Dec 11, 2011 15:46, edited 1 time in total.
 

User avatar
RabbiBob
Member
 
Posts: 335
Joined: Sat Jan 28, 2012 22:40

by RabbiBob » Wed Feb 08, 2012 02:31

 

User avatar
RabbiBob
Member
 
Posts: 335
Joined: Sat Jan 28, 2012 22:40

by RabbiBob » Fri Feb 10, 2012 01:27

Iron, would you mind implementing a version number system? 0.0.1 or something? Thank you
 

User avatar
Death Dealer
Member
 
Posts: 1379
Joined: Wed Feb 15, 2012 18:46

by Death Dealer » Fri Mar 02, 2012 05:26

Wolfgang wrote:
ironzorg wrote:I don't think a sign will do the trick. I don't think you can really check that your automatically generated buildings are not turned to a pile of dust by some griefers.
Well, there is one way: make a server mod that disallow harvesting of groups of blocks (= the buildings), but even you will probably need to destroy an annoying watchtower that spawned out of nowhere on the space you wanted to build a giant castle.


Exactly. If a player made the annoying watchtower I'd have to build somewhere else. But if it is a automatically generated building, not claimed by any player it is pickaxe time. At the moment it is usually easy to tell if the structure is a generated dungeon or something else. (Unless it is a already vandalized building). So some sign might help. Then again first griefer steals sign or changes sign on player's building to


locked signs:D
and would anyone please compile a working version of this?
Last edited by Death Dealer on Fri Mar 02, 2012 18:54, edited 1 time in total.
Keep calm and code python^_^
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Sat Mar 24, 2012 12:55

Great mod +1, Now we need to have a building swap similar to what people are doing with maps.
 

User avatar
IPushButton2653
Member
 
Posts: 666
Joined: Wed Nov 16, 2011 22:47

by IPushButton2653 » Sun Mar 25, 2012 02:35

I can't even get the mod to work >.<
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Mon Mar 26, 2012 09:37

It generates them in sparse clusters, it may be hard to find one, but when you do you find a few more.
 

Next

Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 16 guests

cron