Python terrain generation

Post Reply
User avatar
benajamin
Member
Posts: 48
Joined: Sat May 14, 2011 16:14

Python terrain generation

by benajamin » Post

Hi,
I found the genmap.py script and had a quick play with it. I'd like to do more, but need some help:

1. I'd like to be able to place signs in order to test my algorithm for generating place names. Could you please tell how to add such things? The wiki would be a good place to have the data values, etc.

2. genmap seems to use an old format that gets converted, it would be nice if it used the new format. Could you update it?

3. This might be asking a lot, but it would be great if minetest could be set to ask a python script to generate new sectors. It wouldn't matter if the performance sucked because it would just be for prototyping and if you like the results, it would be easier to re-implement in c++!

Thanks again for sharing your game, I hope that I can make something cool enough that you want to include it.
Ben

P.S. Have you thought about using a database to store sector data? See http://www.haxney.org/2011/02/minecabin ... chunk.html

User avatar
benajamin
Member
Posts: 48
Joined: Sat May 14, 2011 16:14

by benajamin » Post

So I figured out that signs are block number 14, but just setting a block 14 doesn't make it a valid sign somehow because it doesn't have any message and I can't add one in game.

User avatar
celeron55
Administrator
Posts: 532
Joined: Tue Apr 19, 2011 10:10
GitHub: celeron55
IRC: celeron55

by celeron55 » Post

Here, I just wrote this for you:

https://bitbucket.org/celeron55/minetes ... format.txt

I hope you get something awesome done.

A database won't be used, it's not needed when a proper format is made (which is planned), it just adds to the complexity of building and using the game on exotic platforms.

EDIT: Well, actually, I will have a look at SQLite some day, probably. You will hear about this in somewhere between 1 week and 6 months I guess. :-D

User avatar
benajamin
Member
Posts: 48
Joined: Sat May 14, 2011 16:14

by benajamin » Post

The "node metadata" you mention is the "XXX/ZZZ/meta" file? I placed a sign near (0,0,0) as displayed in-game and there is no 000/000/meta file. I think I need a bit more help in getting started here. Sorry to be a pain.

Ben

User avatar
celeron55
Administrator
Posts: 532
Joined: Tue Apr 19, 2011 10:10
GitHub: celeron55
IRC: celeron55

by celeron55 » Post

Phew, I spent all day updating this one. So, here it is, a genmap.py script that does format 17 and places signs on the map.

https://bitbucket.org/celeron55/minetes ... /genmap.py
Direct link to the most recent one (same as above at the time of posting): https://bitbucket.org/celeron55/minetes ... /genmap.py

I might look into adding support for running external programs for generating map - but some other day.

User avatar
benajamin
Member
Posts: 48
Joined: Sat May 14, 2011 16:14

by benajamin » Post

Wow!!! Thanks for all the hard work!

User avatar
benajamin
Member
Posts: 48
Joined: Sat May 14, 2011 16:14

by benajamin » Post

Quick question: what range of numbers are valid seeds? Minecraft seems to use a 64 bit signed integer - is Minetest the same?

Fisherman
Member
Posts: 10
Joined: Fri Apr 22, 2011 14:13

by Fisherman » Post

It seems so. Grepping for seed in the src dir yields
src/map.h: u64 seed;

User avatar
benajamin
Member
Posts: 48
Joined: Sat May 14, 2011 16:14

by benajamin » Post

Wait, wouldn't u64 specify an *unsigned* 64 bit integer, rather than a *signed* one?

bahamada
Member
Posts: 13
Joined: Sun May 15, 2011 18:07

by bahamada » Post

its unsigned long long

User avatar
benajamin
Member
Posts: 48
Joined: Sat May 14, 2011 16:14

by benajamin » Post

I have created a demo of my algorithm for creating place names. The script NameDemo.py uses the minetest world generation functions from gentest.py and the naming algorithm functions in MK_Names.py to create a field of signs with generated names on them. The field of signs show a 2D slice through the 3D set of possible names, so there are many more possibilities than the demo shows. The demo includes a language approximating Japanese, but this can be easily changed (and you could have multiple in-game languages - though this would allow occasional name collisions and for places to have different names in different languages).
The names are actually complicated and chaotic encodings of the in-game coordinates, so there are functions to go from coordinates to a name and from a name to coordinates. Names will not repeat so long as the coordinates remain within some limit. This limit can be varied, but larger limits require longer names. The range of syllables to choose from in the language also has an impact on name length. Minetests world size limit of 31000 m and a reasonable distance between place names should combine to give a reasonable name length.

0. Install python if you don't already have it.
1. Download the scripts from: http://www.mediafire.com/file/zgsvqr7di ... meDemo.zip
2. Extract the files (and maybe set the execute permissions if on Linux).
3. Run $ ./NameDemo.py (This will creat a new world folder).
4. Copy (or link) into wherever your Minetest world folder belongs.
5. Run Minetest and enjoy the signs.

I'll be happy to answer questions about how the algorithms work when I get time, but be warned that I'll be pretty busy for the next few weeks. My next project will be to make a terrain generator with villages and roads (and probably rivers too, since they are similar to roads) that is compatible with the "generate as you explore" style of Minetest.

Anchakor
New member
Posts: 2
Joined: Thu Jun 23, 2011 00:15

by Anchakor » Post

I had some ideas about Minetest related to this, please read: http://mud.cz/?p=36

marvalis
Member
Posts: 16
Joined: Mon Jun 20, 2011 13:15

by marvalis » Post

Just wanted to say, awesome work guys.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 15 guests