.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Scenarios, Maps and Mods (http://forum.shrapnelgames.com/forumdisplay.php?f=146)
-   -   new map generator (http://forum.shrapnelgames.com/showthread.php?t=30337)

paradoxharbinger February 23rd, 2007 03:31 PM

Re: MapGen alpha release!
 
yes, the maps only have dom2 terrain types right now, but they work with dom3. there are a few bugs that i am working out right now, but i should have them set to rights by this weekend, so you may want to wait until i get the next release out before downloading.

actually, i was wonderring if there is any interest in an option that will make maps that are dom2 compliant or if everyone has moved on to dom3.

DrPraetorious February 23rd, 2007 05:09 PM

Re: MapGen alpha release!
 
I suspect that anyone who hasn't moved on to dom3 won't be reading this forum http://forum.shrapnelgames.com/images/smilies/happy.gif

paradoxharbinger February 26th, 2007 01:35 AM

Re: MapGen alpha release!
 
i'm fairly sure i've fixed the terrain problem. next i will try and get the sea level function working properly, then release v0.51

paradoxharbinger February 27th, 2007 02:33 AM

version 0.51 alpha release
 
version 0.51, see the changelog for details. the sea level and province terrain bugs have been fixed. the changelog also has a few things that i hope to implement in 0.52 listed.

cheers

paradoxharbinger February 27th, 2007 02:16 PM

Re: version 0.51 alpha release
 
there was a small error in the change to the heightmap algorithm. taking down attachment in post above, will recompile and repost v0.51 tonight

paradoxharbinger February 27th, 2007 08:23 PM

Re: version 0.51 alpha release
 
ok, here it is. fixed, with a few debugging commands thrown in (detailed in changelog, not yet added to site).

DrPraetorious February 28th, 2007 12:26 AM

Re: version 0.51 alpha release
 
I get the application configuration error again when I try to run the newest version http://forum.shrapnelgames.com/images/smilies/frown.gif

I don't think my machine supports the debugging options (I run into that a lot when I try to cross-compile.)

paradoxharbinger February 28th, 2007 03:29 AM

Re: version 0.51 alpha release
 
oh crap, i may have sent out a debug build rather than releases build, try this

paradoxharbinger February 28th, 2007 03:34 AM

Re: version 0.51 alpha release
 
the debugging options that i put in have no functionality in them that are not in the other script commands or elsewhere in mapgen. they just do things that will help me identify problem areas, like labeling the provinces with their province number in the image and outputting a little extra text to the .map file.

drP i am sorry, you will need this .tga for the provnum command. the above attachment now has it included

DrPraetorious February 28th, 2007 07:39 PM

Re: version 0.51 alpha release
 
1 Attachment(s)
The latest version freezes during the "generating terrain-map" step, at least with the script file I was using before.

Debug output is attached.

paradoxharbinger February 28th, 2007 07:53 PM

Re: version 0.51 alpha release
 
it could conceivably take a very long time to generate the terrain for the settings you have. here's a run down of how terrain generation works. mapgen starts by scattering 'seeds' on the map, which must be a certain distance apart, this is the first parameter of the tsize command. it keeps placing seeds until it determines that no more can be placed, which is determined by counting how many times it tries to put a seed on the map, when it has tried and failed enough times, it stops trying. it could take a very long time if every time it tries to place a seed, it gets to the point where it is just about to quit, and then it finds a good spot for a seed, so it starts trying to place another one, which almost doesnt get placed, but just manages to, etc. this is bound to happen with very large maps with relatively small tsize parameters, so i would advise increasing them. i will take a look at the code as well, but i think that if you increase the tsize parameters, you will be fine.

DrPraetorious February 28th, 2007 08:11 PM

Re: version 0.51 alpha release
 
Ah, okay, I'll just let it run then. Suffice to say that it's taking a lot longer than the previous version (which went really fast after the topography was done.)

Does setting the number of provinces low also work, or do I need to specifically set tsize?

paradoxharbinger February 28th, 2007 09:31 PM

Re: version 0.51 alpha release
 
number of provinces have no affect on terrain generation, but terrain does affect province generation.

are you using the same settings you were before? i cant think of any reason it should take much longer on the whole, unless you got really unlucky.

DrPraetorious March 1st, 2007 02:00 AM

Re: version 0.51 alpha release
 
It keeps freezing. I've been letting it run for, like, six or seven hours.

Yeah - same settings as before. I also tried moving the water and mountain limits up and down.

paradoxharbinger March 1st, 2007 03:29 AM

Re: version 0.51 alpha release
 
wow, crap. you have the seeds file for that one?

paradoxharbinger March 1st, 2007 04:47 AM

Re: version 0.51 alpha release
 
drP dont worry about that seed file, there is definitely a bug in there

paradoxharbinger March 1st, 2007 05:43 AM

Re: version 0.51 alpha release
 
ok, it's fixed now. made sure it worked, generated a map with your script.

paradoxharbinger March 1st, 2007 05:13 PM

Re: version 0.51 alpha release
 
i'm going to post releases at the top of this thread from here on out, which will eliminate having to delete old releases and make it easier to find

paradoxharbinger March 4th, 2007 04:21 AM

Re: new map generator
 
just a quick update on progress, mapgen has two new commands. one which allows the filenames of the output to be set, and one which will run in batch mode, so that you can run the program once and get multiple maps. i have also started tackling the issue of getting sprites back into the maps.

paradoxharbinger March 4th, 2007 04:29 AM

Re: new map generator
 
btw, this a ways off, but i was wondering what everyones thoughts were on how cave provinces might be handled?

DrPraetorious March 4th, 2007 10:51 AM

Re: new map generator
 
By altitude?

I think you should be able to set which terrain types will be in different altitude ranges, and which will be seeded (with what frequency.)

For example -
lowterrain: ter;
where ter would default to sea but could be anything. If it's set to "plains" then low altitude is simply ignored. Myself, I think I'd set it to "farmlands" in order to have a lot of contiguous civilization.

highterrain: ter;
where ter would default to mountain but could by anything. If it's set to "plains" then high altitude is simply ignored.

tchance: ter chance;
Defaults to 70/10/15/15/30/0/0 (according to debug output) but can be set to anything - including a value for water and mountains if you just want those scattered around willy-nilly.

Gandalf Parker March 4th, 2007 02:43 PM

Re: new map generator
 
On my maps I consider any province with one entrance (surrounded by castles) to be a cave. It just makes sure that there are caves someplace on the map.

Or squeeze a tiny province in-between the mountainous edges of two meeting provinces and declare that a cave.

The other possibility is to create small provinces at the side of the map in the border of it. Make those "caves". It gives you another level to the map. A neighbor arrow would run off to the side of the map connecting to one of the caves. It also allows for tunnel systems and underworlds.

paradoxharbinger March 5th, 2007 04:02 AM

Re: new map generator
 
@ drP
this is one of the features that i want to put in, but, rather than looking simply at altitude, terrain types will be placed by proximity to water, which really just ends up going a step beyond looking at altitude. the thing i've been struggling with is how to implement it in a way that users can modify. i was playing with the idea of using cubic splines to describe the probabilities of terrains being placed with respect to water proximity, but i've been coming to realize, that it would probably net little gain, and would be quite difficult to implement and also would slow things down quite alot, not to mention that it would be fairly complicated for the user who had no idea what the hell i was talking about with splines.

anyway, i like your idea with the three groups of terrain, close-, mid-, and far-proximity could work out pretty well and i think would be a good compromise to the exactness that splines offer. the only extension would be to define how close each of the thresholds are.

so, here are some thoughts on how this might work out:

farm close:high chance, mid:medium chance, far:low chance
waste close:low chance, mid:medium chance, far:high chance
forest close: medium chance, mid:high chance, far:medium low chance
plain close, mid, far:high chance
swamp close:high chance, mid:medium chance, far:very low chance

@gandalf

im not sure what you mean by surrounded by castles, but i see your meaning with the one entrance (neighbor?). this might work once i get impassable borders going with small mountain ranges (not large enough to contain a province) and rivers.

i think that i would like to keep caves in the map, ie not putting them off to the side, maybe cave provinces could be borderless, and just have an icon on the map representing the entrance and possibly closer cavern provinces could be considered neighbours. this could mean that caverns are not dependent on a special case of mountainous terrain, which would present it's own special difficulties in determining where they occurred and forcing them to occur so that there are caves. this might be worked so that based on how close the cave entrance is to normal province borders will determine which provinces may be entered from the cave. so that if a cave entrance sits right on a junction of three borders, an army within the cave may enter any of the three provinces. on the other hand if it is to far within the borders of some province, an army in the cave may only enter that one province. going this route could present problems with caves that do not have exits to above ground, though. perhaps, it might be necessary to have an entire second layer to the map for the underdark.

paradoxharbinger March 5th, 2007 04:04 AM

Re: new map generator
 
completely forgot what i was originally going to post. new map command to turn province borders on/off completely. saw a discussion of this over in ballbarians thread and stuck it in since it wasnt going to be a painful process to implement.

DrPraetorious March 5th, 2007 11:13 AM

Re: new map generator
 
The immediate problem is that if you set the water-content very low it never comes out convex.

If you could seed the water - instead of using altitude at all - you could set the water frequency low and have a few lakes.

For maps with more water the altitude works fine, but for maps with no water it'd be nice to have a similar effect with farmlands going into mountains, or forests going into wasteland, stuff like that.

paradoxharbinger March 5th, 2007 01:15 PM

Re: new map generator
 
the problem there is that you will never be able to get realistic looking coastlines. i am working on the lake issue though.

Gandalf Parker March 5th, 2007 01:34 PM

Re: new map generator
 
Im sorry. I meant surrounded by mountains. If I have a small province on one of my generated maps that has only one way in and surrounded by mountains then I make it a cave. On my larger maps that tends to give me 3-5 cave provinces.

paradoxharbinger March 6th, 2007 04:45 AM

Re: new map generator
 
sprites are nearly finished, there are just a few tweaks that i have to make to finish it up, so look for version 0.52 in the next day or two. right now i'm testing with some sprites that ballbarian posted, which are looking pretty good right now.

paradoxharbinger March 9th, 2007 01:28 AM

MapGen v0.52 RELEASE
 
mostly image functionality updates this time. sprites are in, borders may be turned on/off. also commands to name the files and run a batch of maps.

AN IMPORTANT NOTE: i am not distributing any sprites with mapgen at this time. i was testing with some borrowed from another game, but i do not have a set that i can distribute. unfortunately, i am a terribly sprite artist or i'd have made a set of my own. but hopefully kristoffer will allow for the dom3 sprites to be distributed with mapgen in the future. until then, though, you will have to find your sprites on your own. that being said, if you're an enterprising sprite maker that would like to have your sprites distributed with mapgen, with full credit going to you, of course, let me know.

DrPraetorious March 9th, 2007 02:01 AM

Re: MapGen v0.52 RELEASE
 
Thanks for the excellent work, PB. I'm going to start a bunch of MP games in early april using these maps.

This is low priority but would be cool.

If we could have high-site-frequency provinces that the mapgen new about, it could have sprites set to distribute (one per province I think would be ideal) in those provinces.

paradoxharbinger March 9th, 2007 02:12 AM

Re: MapGen v0.52 RELEASE
 
are you talking about the manysites terrain type, or the other new sites terrain types, or something like what ballbarian is doing? the magic site terrain types will make it in eventually.

Manuk March 12th, 2007 12:21 AM

Re: MapGen v0.52 RELEASE
 
Theres something I can't resolve. Castles and army icons look too big. When I want to tweak this by psize string the map lose shape. It looks confusing as province borders are set bigger but sprites do not.

paradoxharbinger March 12th, 2007 03:53 AM

Re: MapGen v0.52 RELEASE
 
yes, sizing the map properly can be a bit of a hassle. as of now, you would have to scale the psize, tsize, zoom etc with the dimensions of the map. to keep the same look/feel of the default settings, if you were to double the dimensions (for example) you would double all of the distance related arguments, except for zoom, which would be halved. think of the dimensions of the map as a window. changing the size of the window allows you to see more. zoom represents the distance from the landscape you are viewing. i originally had all of the settings dependent upon the zoom, but decided to change it so that terrain/province sizes were not too dependent upon heightmap. perhaps a command to scale arguments from default depending on map dimensions would help?

paradoxharbinger March 15th, 2007 04:41 AM

Re: new map generator
 
anyone out there created any interesting maps to share? i'm eager to see what everyone is using this thing for

paradoxharbinger March 15th, 2007 04:55 AM

Re: new map generator
 
btw: i am developing new algorithms for various aspects of the map generation which will lead to dramatically increased speed (i think) and greater control over terrain generation. i anticipate that things such as number of landmasses, number of oceans, island, island chain, peninsula, lakes, mountain and river borders will be able to be defined by the user through the scripting functionality. the wonderful this is that this increased functionality should actually decrease the running time of the map generation, which will mainly be achieved by making calculations less dependent on the dimensions of the map and more on the features that are being placed in it. i will have more on this later as i move through implementing the ground work for it.

DrPraetorious March 15th, 2007 08:58 AM

Re: new map generator
 
1 Attachment(s)
Actually, whatever you did last time, the speed is now very good.

OTOH, better control over the water is exactly what I need. I've attached a script file which gives reasonable results. I've found that by setting the water level down somewhat, the pthresh up quite high, and the water provinces the same size as the land provinces, I *mostly* avoid the problem I had before - a small number of water provinces with way too many neighbors.

The maps still require some cleanup. You can see a list of change in the file "cleanup.txt".

I've also attached the sprites that Frank made me, which make reasonably handsome terrain. The script I've included uses them.

Anyway, it takes a couple hours to make a good, ~400 provinces mp map, including the post cleanup. What you need to do is find all the provinces with >9 neighbors and fiddle with the borders.

Enjoy.

DrPraetorious March 18th, 2007 01:31 PM

Re: new map generator
 
Okay, here are the additional scripting commands I want:

I want three or four more "terrain types" named custom1 through custom4. They can have a default tchance of 0.

tchance ter #
Alters the chance that a given terrain is seeded.

tmask ter <bitmask>
Alters the bitmask associated with a given terrain. Should work for mountain and ocean as well.

terfeature ter <site #>
Anytime this terrain is assigned to a province, the site is also placed in that province.

obias ter <value>
I don't know how you're going to be placing wastes-far-from-ocean, but whatever value is used for that bias should be adjustable on a per-terrain basis.

Combined, these will enable me to do deserts (waste + desert site, usually not coastal), tundras (waste + tundra site, can be coastal) and jungles (forest + swamp + jungle site, often coastal.)

Thanks! The last map is working quite nicely.

Gandalf Parker March 18th, 2007 08:12 PM

Re: new map generator
 
I might have missed it someplace but other than some small spatterings in this thread, I dont see anyplace in the documentation that lists the commands.

Are there any that arent listed in the debug.txt?

paradoxharbinger March 18th, 2007 10:29 PM

Re: new map generator
 
@drP

like the ideas. i hadnt thought about expanding on the terrain types yet, but i'll keep it in mind so that i don't have to rework everything later.

btw, could you expound on tmask ter #? nt sure what youre looking for here

@gandalf

i didnt list the commands in the readme because i set up a web page listing them. i'm a bit lazy, so you'll have to forgive me. you can find most of the commands here.
the commands that i've added since v0.50 are in the changelog, i havent gotten around to updating the site on account of school sucking at my soul, but it'll be updated eventually.

DrPraetorious March 19th, 2007 09:56 AM

Re: new map generator
 
Well, right now, if a province contains a lot of forest, it's bitmask gets bitwise-or 96.

Well, suppose you don't want forests - you want magic-site-richness. Or smallness. Or waste+swamp.

You could go
#tmask forest 96

And anything that the mapgen assigns as "forest" would now be swamp+waste (mask 96) instead of forest (mask 128.)

There are any number of reasons why you might want to swap out the existing terrain types for other combinations; I'm working under the assumption that this would be easy to code - if not, don't worry about it.

paradoxharbinger March 19th, 2007 12:07 PM

Re: new map generator
 
so you want something like this?

int changebitmask(int mask, int oldmask, int newmask)
{
if( mask & oldmask == oldmask )
{
mask &= ~oldmask;
mask |= newmask;
}
return mask;
}

paradoxharbinger March 29th, 2007 03:37 AM

Re: new map generator
 
1 Attachment(s)
just wanted to give you all a quick update

one of the major hurdles for the next release has been leaped: generating a wrapping mesh, which i've attached a sample of. the image is a mesh tiled with itself in four colors so that the mesh boundaries are visible.

my intent with this new algorithm is to generate a large amount of regions (which will be the dual of this kind of triangulation) and then assign to each region terrain types, rather than using a heightmap.

the generation method is being radically changed to allow for much greater control of what is generated (see a couple of post up). it also means a heinous speed increase.

i'll keep you posted as things move along

Gandalf Parker March 29th, 2007 02:39 PM

Re: new map generator
 
So... within a single map you will get 4 areas with equal chance to develop all of the terrains? Increasing the possibility of 4 areas with a continent, ocean, etc.

Or is this to lead up to flip-flop mapping for the "equal starting positions" crowd?

paradoxharbinger March 29th, 2007 03:45 PM

Re: new map generator
 
perhaps i should not have posted that pic. it was mostly just a demo for setting up wrapping maps in general. the main challenge with the wrapping maps is that you have to make sure that they will tile when you lay them side by side. further, you have to do it in a way that that has no artifacts of wrapping it.

what im trying to do here is create a boatload of small regions and then start assigning terrains to them and thier edges.

paradoxharbinger March 29th, 2007 06:07 PM

Re: new map generator
 
1 Attachment(s)
aight, i put together a crude demo of what i'm going for, check the attachment

lch March 29th, 2007 06:53 PM

Re: new map generator
 
Somehow, those are not Voronoi cells anymore. But I guess I understood what you meant regarding the wrapping maps already, it's the same thing that is used in digital imaging for tiled wallpapers. Very nice.

Gandalf Parker March 29th, 2007 07:25 PM

Re: new map generator
 
Ahhh...
I had on my projects list (my super overloaded projects list) an idea to do a webpage tiling of the maps I randomly generate just to see if one accidentally comes close to being wrappable. That way I could spot one that was at least possible with slight effort.

paradoxharbinger March 29th, 2007 10:42 PM

Re: new map generator
 
hmmm... maybe i am doing the voronoi calculation wrong. the tringulation is delaunay, other triangles were removed from around the edges, so the borders do not appear so, but they are. i thought that to get the voronoi tesselation you drew a line from the center of a triangle to its neighbor's center. working from memory here, so would not be suprised if that isnt quite right.

edit: so hard to find good computational geom stuff on the internets, bu i think i figured the difference out, should be from the centers of the triangle's circumcircles. i think the triangle centers will suit my purpose fine though.

BandarLover March 30th, 2007 12:24 AM

Re: new map generator
 
Woa...suddenly had a flash back to high school geometry after reading that. And it still makes no sense now like it did then. http://forum.shrapnelgames.com/images/smilies/wink.gif

llamabeast March 30th, 2007 05:33 AM

Re: new map generator
 
Hey paradox, just to let you know I'm lurking here, and I'm really impressed by what you've got done! The latest demo is really good looking I think. Seems like an excellent system you're using. I'm impressed you managed to get the wraparound working too - it's not obvious after a brief think how you'd do that.

I like how the province borders are defined by the midpoints of the triangles. Cunning. One thing - the coastline goes along the edges of the triangles, which means that all the coastal provinces are half in the sea and half on land. Is that deliberate?


All times are GMT -4. The time now is 04:29 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.