Fractal random map generator

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

GregorR
Posts: 51
Joined: September 26th, 2005, 9:19 pm
Location: Portland, OR
Contact:

Fractal random map generator

Post by GregorR »

I've made a little fractal map generator (well, OK, modified one to spit out Wesnoth map files ;) ) that I thought would be handy.

Basically, a program called worldgen outputs relatively realistic GIANT Wesnoth-style maps, then a program called chunk takes little segments out of it. That way, you can create one big consistant map for a campaign, then use little bits of it for scenarios. Or, of course, you could just make one map and use only one chunk *shrugs*

It doesn't put any villages etc on the map, that's up to you. It makes a pristene, pre-human pre-elf pre-dwarf pre-orc pre-other-sorts-of-civilization world ;)

It also creates a .gif file (legacy from the original program), which makes a handy reference.

Enjoy, and please post comments :)
Attachments
gwswg-1.0.tar.gz
Gregor's Wesnoth World Generator
(335.15 KiB) Downloaded 853 times
GregorR
Posts: 51
Joined: September 26th, 2005, 9:19 pm
Location: Portland, OR
Contact:

Post by GregorR »

Of course, everybody loves screenshots, and I didn't post any, so here they are ...

It's the included example world, and a few selected areas from it in the Wesnoth editor.
Attachments
The generated world.
The generated world.
exa.jpg (223.21 KiB) Viewed 9715 times
Screenshot A
Screenshot A
exa_a.jpg (174.58 KiB) Viewed 9713 times
Screenshot B
Screenshot B
exa_b.jpg (253.55 KiB) Viewed 9714 times
scott
Posts: 5243
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

Wow. Is that last one a wesnoth map?
Hope springs eternal.
Wesnoth acronym guide.
ryn
Posts: 196
Joined: August 23rd, 2004, 4:01 am
Location: Israel

Post by ryn »

scott: the way I understand it, exa is the whole world of which exa_a and exa_b are pieces. Therefore, no.
2B |! 2B = 3F
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

Why are there always forests between hills and grass?
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Disto
Posts: 2039
Joined: November 1st, 2004, 7:40 pm
Location: Cambridge, UK

Post by Disto »

There aren't though....
Creator of A Seed of Evil
Creator of the Marauders
Food or Wesnoth? I'll have Wesnoth
Jormungandr
Art Contributor
Posts: 85
Joined: June 11th, 2005, 2:22 pm

Post by Jormungandr »

This is pretty cool. Do you have any plans to expand it with either more command-line parameters, or to use more terrain types (I note swamps are lacking)?

And I'm pleased to see that the editor can actually load a 1000x1000-hex map without choking too horribly. :P
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Elvish Pillager wrote:Why are there always forests between hills and grass?
Yeah it looks like it's a simple height map with mountains > hills > forest > grass > sand > shallow > deep

I think if you're starting with a height map (and almost all map generation does start like this) it's best to just divide into mountains > hills > grass > shallow > deep and then worry about things like vegetation and snow afterwards using a different approach.

That's the way Wesnoth's current map generation algorithm does it.

The main nice thing about this map generator is that it does use a fractal algorithm. I think it'd be good to make that an option for the current generator -- to use a fractal height map generator rather than the 'hills' approach that is currently used.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
GregorR
Posts: 51
Joined: September 26th, 2005, 9:19 pm
Location: Portland, OR
Contact:

Post by GregorR »

scott wrote:Wow. Is that last one a wesnoth map?
It's a .gif file representing a /huge/ Wesnoth-style map.

Elvish Pillager wrote:Why are there always forests between hills and grass?
As mentioned by others, it's a heightmap, so it's a pretty strange algorithm to make forests out of. There aren't always, but when there are it's because I translated "higher" into "forest"

Jormungandr wrote:This is pretty cool. Do you have any plans to expand it with either more command-line parameters, or to use more terrain types (I note swamps are lacking)?

And I'm pleased to see that the editor can actually load a 1000x1000-hex map without choking too horribly. Razz
Yes, of course. This is just a proof-of-concept. It would be nice to make one that diverged a bit from the pure 'heightmap" style, and hence could support other terrains, etc.

And no, the editor can't load a 1000x1000-hex map, that's why I made the chunk program :-P


Anyway, I personally think that the nice thing about this is that it generates a very large map, so you could easily, for example, have one scenario on just an island, and then later come back and have a siege of that island on a larger map that also includes some of the mainland.
Anyar
Posts: 191
Joined: July 25th, 2005, 9:18 pm
Location: MI

Post by Anyar »

GregorR wrote: And no, the editor can't load a 1000x1000-hex map, that's why I made the chunk program :-P
Oh, it can. Took about a minute to load on my ibook. Hmm... I might try a 2000x2000 map...
User avatar
Tomsik
Posts: 1401
Joined: February 7th, 2005, 7:04 am
Location: Poland

Post by Tomsik »

I think you can load as big map as long you have enough RAM.
Jormungandr
Art Contributor
Posts: 85
Joined: June 11th, 2005, 2:22 pm

Post by Jormungandr »

tomsik wrote:I think you can load as big map as long you have enough RAM.
That's what it looks like to me, at least. Loading said 1000x1000 map took a minute or two, and about 300M of RAM on my machine.

Though, if you do this (and I can't think of a reason why you would want to, other than general curiosity) and then try to edit the map, the editor hangs for a while (as it recalculates transitions?).
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Yeah, it seems the transitions engine isn't very scalable to huge maps.
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
GregorR
Posts: 51
Joined: September 26th, 2005, 9:19 pm
Location: Portland, OR
Contact:

Post by GregorR »

Here's version 1.1. Now, rather than each level representing one terrain, each level has several different types of terrains, then it "grows" them to be consistant. It's not great ... but it's significantly better.

Also, for the lazy, it lets you add villages (optionally).

By the way, is there any way to turn a Wesnoth map file into a (possibly gargantuan) image file of the map?

Also, does anybody know of a C pseudo-random number generating function that's both decent and Free Software (GPL, MIT, whatever). It would be nice to put the randomizer in the program itself, so the same random seed will generate the same map on GNU/Linux, Windows, Mac OS X, Solaris, etc, etc, etc.
Attachments
gwswg-1.1.tar.gz
Version 1.1 of Gregor's Wesnoth World Generator
(292.48 KiB) Downloaded 561 times
Quensul
Art Contributor
Posts: 303
Joined: January 2nd, 2005, 1:06 am
Location: Pittsburgh, PA

Post by Quensul »

GregorR wrote:By the way, is there any way to turn a Wesnoth map file into a (possibly gargantuan) image file of the map?
Not sure if this is what you want, but Wercator is in a usable state - it can take a BfW map and render an ink-and-parchment version; see my signature for the thread in the forums, or go to http://gs295.sp.cs.cmu.edu/brennan/wercator/ for a web version. If you're planning on doing really huge files, I would recommend (1) only rendering the ink (i.e. no parchment, no frame) and postprocessing the parchment in, and (2) installing it locally, but see the forum thread and/or the Downloads page of the Wercator site for caveats. If you do want to render monstrous large maps via the Web interface, please run them after normal business hours (US Eastern time), since it's my office machine. :-)
GregorR wrote:Also, does anybody know of a C pseudo-random number generating function that's both decent and Free Software (GPL, MIT, whatever). It would be nice to put the randomizer in the program itself, so the same random seed will generate the same map on GNU/Linux, Windows, Mac OS X, Solaris, etc, etc, etc.
Well, there's the GSL - it has a wide variety of random number generators available. I've been pretty happy with it for numerical simulation foo.
Author of Wercator
Post Reply