Log in

View Full Version : new map generator


paradoxharbinger
September 17th, 2006, 06:24 PM
MAPGEN RELEASE: v0.52

PLEASE NOTE: to run the mapgen, you have to install a couple of dll files from m$, which you can get here (http://www.microsoft.com/downloads/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en)

ALSO NOTE: as of v0.52, mapgen allows for sprites to be modded, but sprites are not being distributed with mapgen yet. hopefully, kristoffer will allow me to distribute the sprites that were used in the dom3 maps with mapgen, unil then though, i am afraid you are on your own with finding sprites to use.

i will post mapgen releases here at the top of the thread from here on out

changelog:
0.50
+ initial release

0.51
+ sea level is now adjustable
+ changed default sea and mountain levels to 115 and 165 respectively to reflect changes to heightmap algorithm
+ provinces are now marked with correct terrain types
+ output file which stores random number generator seeds (seeds.sds)
+ scripting command to turn comments on/off in .map file
++ verbose: yes/no;
++ default: no
++ data includes province number, province center point, neighbors and terrain types
+ scripting command to turn numbers on/off in image
++ provnum: yes/no;
++ default: no
++ mostly for my debugging purposes

0.52
+ scripting command to turn province borders on/off in map image
++ border: yes/no;
++ default: yes
+ scripting command to change output file names
++ filename: name;
++ default: test;
+ scripting command to generate a batch of maps
++ batch: number;
+++ number must be between 1 and 1000 inclusive
++ "_xxx" is appended to the filename, where "xxx" is the numerical id for the map
+ scripting command to use sprites in map image
++ sprite: name terrain distance distribution;
+++ name gives a path and file name for the sprite. the path may be relative to the folder MapGen is in
+++ terrain is a string for the terrain type to use this sprite in
+++ distance is an integer. this is the minimal distance that must be between this sprite and all others.
+++ distribution is an integer which will determine how often this sprite is placed for this terrain type
++ NO DEFAULTS. maps will be generated without sprites by default.
+ scripting command to turn province borders on/off
++ border: yes/no;
++ default: yes


to do
+ add lakes to heightmap
+ improve oceans in heightmap
+ improve terrain type algorithm to take distance to water into account
++ three levels
+ scripting command to load random number generator seeds
+ add a command for a palette of colors which will be used as background colors
++ use noise to give concentrations
+ cavern provinces
+ deep sea provinces

paradoxharbinger
October 12th, 2006, 07:51 PM
i am moving all discussion for my map generator to this thread, as the dom2 map section seems to be dead. you can find the link to the old thread in the post above. i've attached a screen of a current map.

The_Tauren13
October 13th, 2006, 12:13 PM
Sweet! Wrap-around maps!

Gandalf Parker
October 13th, 2006, 01:18 PM
Wrap Around maps, user added sprites for terrain, more color control. Excellent stuff.

Shovah32
October 13th, 2006, 02:27 PM
Excellent indeed. I was actually conserned about your MapGens future since dom3 has a built n RMG but yours is looking awfully nice.

paradoxharbinger
October 13th, 2006, 09:40 PM
thanks all for the encouragement.

changing the script command format again, trying to make it both easy to parse and easy to write a script.

the basic format for a command is:
command: argument argument argument...;

see here (http://paradoxharbinger.wikidot.com/scripting) for scripting commands

paradoxharbinger
October 13th, 2006, 10:05 PM
Post deleted by paradoxharbinger

Gandalf Parker
October 14th, 2006, 11:41 AM
You might want to allow for mixed terrains. I know that might be more of a pain than its worth but Id like to see something like a less packed trees sprite for forest/farm, or forest/plain

paradoxharbinger
October 14th, 2006, 12:20 PM
not sure wht you mean, are talking about making new terrain types?

Endoperez
October 14th, 2006, 01:32 PM
A province can be both forest and mountain. Or both mountain and farmlands. Plains is province with no terrains on it, so plains/other provinces are impossible. Other than that, all combinations can be set, in theory. Even swamp/farmlands etc.

paradoxharbinger
October 14th, 2006, 01:50 PM
might be something for future development. the way the mapgen works now, a province can have multiple terrain types, but they aren't blended together, which i think is what you are saying. that sort of thing would constitute new terrain types, such as forest/mountain, atleast as far as making the maps goes.

paradoxharbinger
October 16th, 2006, 12:46 AM
ok, the script parser is nearly done, been wrangling with it all weekend. there a few kinks to work out of it, but for the most part it is working. i will continue to update the sixth post down with modding commands as they are implemented. i envision using these scripts in place of a gui, so that i can make this a console app, and hopefully able to build on other platforms.

Agrajag
October 16th, 2006, 07:00 AM
paradoxharbinger said:
There a few kinks to work out of it, but for the most part it is working.


I think Bash.org said it best:
<W-ll-am> well its nearly working
<BoltBait> You are aware, code that ALMOST works looks NOTHING like the code that ACTUALLY works.
<W-ll-am> dont tell me that, its due tomorrow
http://forum.shrapnelgames.com/images/smilies/happy.gif

paradoxharbinger
October 16th, 2006, 09:02 AM
http://forum.shrapnelgames.com/images/smilies/happy.gif

well i think i know what the problem is, i just didnt have the time to look into it last night. we'll see.

Agrajag
October 16th, 2006, 10:14 AM
paradoxharbinger said:
well i think i know what the problem is, i just didnt have the time to look into it last night. we'll see.


Aye, that's the most annoying feeling there is*, trying to go to sleep late at night when you know exactly what the problem is with your code, but you also know that its going to take way too long to do before going to sleep and still being able to wake up tomorrow http://forum.shrapnelgames.com/images/smilies/happy.gif

*-Actually, it isn't that high up there, but its annoying!

Gandalf Parker
October 16th, 2006, 10:58 AM
nahh sometimes low-focus sleep-thinking is the best way to see an answer.

Ballbarian
October 16th, 2006, 11:02 AM
I do my best work when I am sleeping with my eyes open. /threads/images/Graemlins/icon10.gif /threads/images/Graemlins/icon10.gif

Gandalf Parker
October 16th, 2006, 02:13 PM
Actually my most impressive programming is done when I have a fever from something like the flu. Afterward even I am impressed by what I did.

paradoxharbinger
October 16th, 2006, 03:18 PM
not only did i have to go to sleep knowing that i might be able to fix the problem, but i have to wait until i get out of work today as well.

paradoxharbinger
October 16th, 2006, 10:38 PM
well, i got the scripts working, but somehow, something else is broken in the code that makes the .map file as a result. ah the wonders of technology. for now i'm just going to get the rest of the code up to date so that province borders actually change to the color the script tells them to, possibly some new screens tonight.

paradoxharbinger
October 17th, 2006, 02:31 AM
few bugs to work out with the pixel colors, didn't have quite enough time to finish that up and put some screens up

paradoxharbinger
October 17th, 2006, 06:13 PM
a few new commands defined in the sixth post.

paradoxharbinger
October 18th, 2006, 07:35 PM
got my copy of dom3 today, woot!

Ballbarian
October 18th, 2006, 09:08 PM
Congratulations!
Sadly, I sense that the progress on your map generator may suffer. I know all of my projects have. http://forum.shrapnelgames.com/images/smilies/happy.gif

Gandalf Parker
October 18th, 2006, 10:14 PM
Ditto. http://forum.shrapnelgames.com/images/smilies/happy.gif

paradoxharbinger
October 18th, 2006, 11:18 PM
yes, you're probably right, but not too much i hope. once i start a big sp game i can probably work on it between turns. btw, there was a utility for dom2 that would make a beep in multiplayer games when the next round started. does it work for dom3? or is there a similar utility in the works?

as far as the mapgen goes, not much progress in the past two days, had to give some attention to the girl friend, but hopefuly i'll get a big chunk done tomorrow night.

paradoxharbinger
October 18th, 2006, 11:52 PM
most of the commands i've outlined for the scripts are already implemented in the code, it's just a matter of having the scripts change the settings rather than just hard-coding them.

Gandalf Parker
October 18th, 2006, 11:58 PM
The only thing I can think of for a "beep" would be a batch file and telling it to run on postexec. Actually it would probably be easier to just play a wav or something. Like "HEY your turn is ready!"

paradoxharbinger
October 19th, 2006, 01:55 AM
same thing, i dont think i ever used that util, but then again i wasnt multi tasking so much back in the day either

Gandalf Parker
October 19th, 2006, 02:09 PM
I totally understand. I play solo games by logging across the net into my own linux server. Why? Because I dont feel the hostings on my desktop for one thing. And because on long games I can have it do things like beep, or email me, or page me, sms, IM, notify me in IRC, whatever I want for a reminder.

Altho I do miss the speech capabilities of having my Windows machine tell me. I understand though that if I add certain modems I can have my linux server speak. I can also have it phone me and talk to me. Heehee.
"*ring ring* Hello? OK I will be right there."
"Was that your wife?"
"No it was my computer telling me my turn was up"

Hmmm that would also be fun for security notices. http://forum.shrapnelgames.com/images/smilies/happy.gif

paradoxharbinger
October 21st, 2006, 01:18 AM
some of you may recall that the wastelands were not working. i finally got around to looking at that issue and it wasn't so much that they were broken as that they were extremely unlikely to appear, but i've fixed that. in the attached screen, the wastes are that greyish red color.

Gandalf Parker
October 21st, 2006, 12:35 PM
Looking good.
Abit busy and bright for my tastes but that is just my tastes. Besides, I can always drop the gamma or fuzz the image if I want to work one into a downloadable scenario map. Much easier to soften one than to get one thats too soft and try to brighten it.

paradoxharbinger
October 21st, 2006, 02:05 PM
the problem with how busy the map is, is not really a problem at all. you could construct a sprite that is really just a blob of sprites and use that. i will make a few for the plains and swamps and post a new screen. it won't be perfect, i have to do a little updating of the code that puts in the sprites before it will be, so you will probably see some stuff sticking out into the water, but it's an issue that's slated to be handled.

as far as the brightness goes, like i keep saying, you can change the colors an sprites to whatever you like

paradoxharbinger
October 21st, 2006, 02:30 PM
well here's a quick example. as you can see, the mapgen doesn't play too well with larger sprites, but that is something that is relatively easy to fix, my efforts have been focused elsewhere, but it only took a few miuntes make the map 'less busy'.

paradoxharbinger
October 21st, 2006, 03:06 PM
here's another sparse map, took out the forest sprites, never liked how they looked anyway. if someone could get me a few tree and mountain sprites to replace the ones i'm using, bout the size of the ones dom3 uses, i could use those instead. tried to draw a few, they looked terrible

paradoxharbinger
October 23rd, 2006, 10:35 PM
when i started this thing, i thought that it would be a great idea to have a gui for it, but now i'm kicking myself. i've started the droll task of removing all of the windows specific code and renderring the mapgen into pure c++ code with the hopes that i can compile versions of it in linux and mac as well. hopefully it won't be too bad, mostly changing the way i was handling file io. all of the options that would have been accessed through the gui will now be manipulated through the scripts.

Gandalf Parker
October 24th, 2006, 12:09 PM
Id appreciate that. My map generation pages are run automatically on a linux server every night. Id like to include a set of maps for your generator also.

Nerfix
October 24th, 2006, 12:35 PM
How odd, that map kinds of reminds me of Europe. O_o

paradoxharbinger
October 24th, 2006, 02:59 PM
any takers on donating a sprite set? also, does any one know of a windows application which can build apps that will run on linux or mac? it would save me the time having to look around and i'd appreciate it

Agrajag
October 24th, 2006, 05:41 PM
Well, I have some sprites, but I really doubt they will help you.
However, I have some free time, so I might try drawing a few sprites for you (though bear in mind I have absolutely no talent http://forum.shrapnelgames.com/images/smilies/happy.gif).
I'd just have to know if it treats sprites as mere pictures it pastes on the map, or does it tile them, or if it uses grayscale images and colors them.

paradoxharbinger
October 24th, 2006, 05:58 PM
here's how the sprites work now:
black is transparent
no pure white
all other colors 'pasted' to the map
the overall dimensions of the image are used for distance calculations, nothing fancy like looking at the actual image data. this helps for the clumping effect i was discussing earlier
24-bit uncompressed tga
sprites are blurred after they are placed on the map with a pass of the gaussian blur


not sure how specific i need to be, i think that covers all of the major stuff without getting too technical. if you have a set of colors to use for the background you'd like to see used with them, send those along too. i'm sure your sprites will be better than the crap ones i put together in a few spare seconds.

btw, i think i may have found a compiler to handle mac/linux apps, havent looked at it yet though.

Agrajag
October 25th, 2006, 11:27 AM
Well, I tried, but I cam up with really lousy sprites, so I'll spare you the horror :\

paradoxharbinger
October 25th, 2006, 01:59 PM
oh well, i guess that my crppy ones will have to do for now. perhaps i will start another thread to request sprites from some enterprising artists.

paradoxharbinger
October 25th, 2006, 05:56 PM
ok i did start a seperate thread for the sprites here (http://www.shrapnelcommunity.com/threads/showthreaded.php?Number=462854)

paradoxharbinger
October 26th, 2006, 06:14 PM
i think that i may have come up with an algorithm for the 'clumping' effect i was discussing earlier, so that you can just set a flag for it, much like telling the mapgen to create a wrap-around map, instead of having to muck about with the sprites

paradoxharbinger
October 27th, 2006, 01:05 AM
also, i may have an algorithm for blending terrain types together along the borders. once i get the non-windows build of this running, i will try and implement these algorithms.

paradoxharbinger
October 27th, 2006, 01:17 PM
the blending algorithm will be able to blend together more than 2 terrain types, i believe, so if you have an intersection of swamp, farms, plains and forests, any sprites associated with those terrain types might show up there. i think that this sort of behaviour will have to be restricted from occurring with water though, and possibly mountains.

paradoxharbinger
November 1st, 2006, 09:18 PM
fyi, started to put in the dom3 terrain types

paradoxharbinger
January 12th, 2007, 06:31 PM
fyi, i put a new site together, wiki format. in my oppinion much easier to maintain and develop, which means it is updated pretty often. plus forums, much more storage and no bandwidth limitations. so the old one has been pretty much abandoned, link to the new one in my sig.

paradoxharbinger
January 28th, 2007, 12:01 AM
i am getting very close to releasing an alpha windows version of mapgen. but in the meantime, i'm going to post a few maps for all of you to play around with. right now there are no sprites, but the maps are playable.

this first is a 1600x1200, 294 provinces (176 land, 118 sea), wrap around.

as always, any comments are deeply appreciated.

DrPraetorious
January 28th, 2007, 03:40 AM
I actually like the clean, crisp colors on maps like this, but I've always had a certain minimalist aesthetic with maps.

Certainly, given the amount of time I expect to spend staring thoughtfully at these, it'll be nice to have variety.

FYI - on a map like this, this is how many start sites fit:
Minimum Distance , Minimum Neighbors , # of starts total (water)
4 , 4 , 10(2)
4 , 6 , 5(1)
5 , 4 , 9(1)
5 , 6 , 5(1)
6 , 4 , 8(5)
6 , 6 , 5(1)
7 , 4 , 6(3)
7 , 6 , 4(2)

Anyway, I think it looks cool, but has a bit too much water to be well-balanced, unless the number of start sites is quite low. Of course, as just a map to play on, it's great.

Thanks for the great work!

--TNDP

Agrajag
January 28th, 2007, 04:47 AM
I like it, it looks neat, and should be very easy to edit if you want something with more flavour.
My one criticism would be that some water provinces have tiny little islands floating in them, that are a bit too small to be considered a province, and yet bigger than what you see in other maps, which gives those provinces a bit of a "dirty" feel to them.

paradoxharbinger
January 28th, 2007, 01:47 PM
@ DrP
i'm not sure what your table means, at least the minimum distance column, provinces to pass through to reach one start site from another? in any case, start sites are not something that the algorithms account for at present. something may be able to be implemented that looks for possible start locations and then removes neighbors, provinces that were next to the removed one could then be grown into the gap. perhaps reducing the number of overall provinces could be a quick fix here.

@ Agrajag
personally, i like to see little islands floating about. it would be pretty sweet if we had an island terrain type. i think it would be possible to remove them, though fairly expensive in terms of processing time.

i'm posting these without the sprites so that if someone does want to add some sprites and such to spice them up, the are more than welcome to.

here's another wrapping map. more provinces, but about a 4:1 land:water ratio. 1600x1200, 491 provinces (384 land, 107 water)

DrPraetorious
January 28th, 2007, 04:14 PM
Paradoxbringer - yes, that's it exactly.

I don't think the RMG needs to know about start sites - but the parameters can be varied so that you get the number of start sites you want. A high water:land ratio on a map with a lot of start sites will tend to put more than 2 in the water, which is a problem because they can't be occupied.

paradoxharbinger
January 28th, 2007, 08:26 PM
i think that it may be possible to give mapgen the desired number of start sites. and after having thought about it, it is probably also possible to constrain the number of neighbours to start sites and provinces between. i will have investigate.

paradoxharbinger
January 30th, 2007, 07:51 PM
alright, so i'm finishing up putting in the script functions that i want to see in the alpha, and i'd like to know what kinds of province generation algorithms you all think are important, because if i keep going on like this, i'll sit on it untill i get all of the algorithms i want in there. so here are some options:

(1) simple: all provinces are about the same size (likely to included anyway)
(2) water / land size: all water provinces are about the same size as other water provinces and all land provinces are about the same size as other land provinces (already included)
(3) distribution: give a size for small, medium and large provinces and specify the distribution of province sizes for land and water provinces (lots of arguments)
(4) start sites: give the number of land and water startsites, number of provinces around the start sites, and the number of provinces between start sites (not likely for the alpha, maybe if there is a lot of demand)
(5) anything else you can dream up

paradoxharbinger
February 1st, 2007, 05:28 PM
no takers? then i will just go for the first two for now

paradoxharbinger
February 17th, 2007, 02:37 AM
working on finishing the mapgen alpha, which as of now is just making sure that the province generation algorithms work, and i made this map, thought it was interesting and that i'd post it.

two main islands, they look fairly balanced. 45 land, 12 water, 800x600

paradoxharbinger
February 19th, 2007, 03:05 AM
ok, here is the alpha release of mapgen. the readme pretty much covers everything you need to know to use it. as far as i know, this thing is stable, but if you start trying to make enormous maps on your pre-pentium machine, i'm not making any promises, but any self-respecting pc ought to be able to run this no problem. if something goes awry, give me some feed back and post the debug file so i can try and figure out what happened. also, please provide feedback in general including but not limited to features you think are missing, default parameters, and improvement areas.

edit: removed attachment, new zip further down

Ballbarian
February 19th, 2007, 09:26 AM
Not working for me paradox. Is script.spt supposed to be blank? I am using WinXP and I get an "application configuration is incorrect" error.

paradoxharbinger
February 19th, 2007, 12:35 PM
yes, script.spt can be blank, i am not sure what the error you are getting is. mapgen was built on an xp machine. i may have built it with some kind of odd setting though and forgot, i will have to check it out, anyone else getting this error?

DrPraetorious
February 19th, 2007, 12:42 PM
I get the same error:

"The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."

Likewise, I am running WinXP SP 2.

paradoxharbinger
February 19th, 2007, 03:41 PM
i did try the old build on a pc at school and had no problems running it, so i'm not exactly sure what the problem is, i'm assuming it was the build properties that i had set in vs, which weren't getting me anything anyway, so i changed them all back to default. if this does not work, i may have to use another compiler. is the old build working for anyone?

also a note on scripting, as there seems to be a bit of confusion. default settings are programmed into mapgen, thus script.spt may be empty and it will generate a map with the default settings. if you want to modify the defaults, edit script.spt with the scripting commands here (http://paradoxharbinger.wikidot.com/scripting) .

edit: removed attachment, new zip further down

DrPraetorious
February 19th, 2007, 03:44 PM
I get the same error with this attachment, as well.

paradoxharbinger
February 19th, 2007, 03:48 PM
well, looks like i will have to try some other compiler than visual studio. will try and have another build up tonight.

paradoxharbinger
February 19th, 2007, 05:24 PM
ok, i think the problem is stemming from the fact that vs is linking with some libraries that are not installed on your pc, but were on the pcs that i was testing on. those of you having problems, you dont have vs on your machines do you?

edit: looks like i did not remove all references to windows libraries in the code. will have a new build to try momentarily.

Ballbarian
February 19th, 2007, 05:33 PM
I won't be able to try the 2nd attachment until I get home tonight, but I do have visual studio 6.0 installed on my pc.

DrPraetorious
February 19th, 2007, 05:33 PM
I don't have virtual studio, no.

paradoxharbinger
February 19th, 2007, 05:44 PM
ok, i think i caught all of the windows refs, so give this a whirl. the next thing i can try is removing all of the std::cout's and fstream and go to good old printf. hopefully it will not come to that.

edit: removed attachment, new zip further down

Manuk
February 19th, 2007, 06:20 PM
in win2000, at work it generates the map ok. but they are not wrapped.

typed this on script.spt:

wraparound: wraptype; xy

paradoxharbinger
February 19th, 2007, 06:25 PM
to make a wrapping map, use this:

wraparound: xy;

DrPraetorious
February 19th, 2007, 06:39 PM
I'm still getting the error with the latest version. This is bizarre - virtual studio can't compile programs that run without libraries?

Ballbarian
February 19th, 2007, 06:44 PM
Ok, tried it on a pc at work. Generates the same error. This pc also has visual studio 6.0 installed on it.

paradoxharbinger
February 19th, 2007, 07:48 PM
i looked into the error a bit, and it seems that vs auto links (or something) some dll, cant recall the name at the moment. i saw plenty of pages describing the problem, but nothing describing how to fix or avoid it short of installing the dll on the machine.

DrPraetorious
February 19th, 2007, 08:23 PM
If it's a freely available .dll I'll install it if needed to use your mapgen.

paradoxharbinger
February 19th, 2007, 10:19 PM
ok, i think i've found the dlls that need to be installed to run this heap. apparently m$ made it so that apps built with vs2k5 cannot be run on pcs that do not have the proper dlls installed, but m$ has made them available, the installer is here (http://www.microsoft.com/downloads/details.aspx?FamilyId=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en) . there does seem to be a workaround for this, which, if i understand it correctly, just means that mapgen would be packaged in an installer with these dlls, which would be installed on your pc when you install mapgen. this is something i will have to look into further, i would rather a no-strings-attached sort of deal.

DrPraetorious
February 19th, 2007, 11:04 PM
That fixed it.

Thanks!

Making maps now..... http://forum.shrapnelgames.com/images/smilies/happy.gif

DrPraetorious
February 19th, 2007, 11:21 PM
A few RFEs -
* control for the frequency with which different terrains are seeded. At the moment, these maps have no mountains, which is a game balance issue.

* border mountains. Not sure how to do this, as border mountains don't get seeded like other terrains.

Anyway, it works great, it's amazingly fast. Nice work!

paradoxharbinger
February 19th, 2007, 11:24 PM
sweet.

im going to remove the other attachments, and post a new zip with an updated readme in it.

paradoxharbinger
February 19th, 2007, 11:35 PM
as far as how terrains are seeded, oceans, land masses and mountains are determined strictly by a height map, so everything below x is ocean, everything above y is mountains. rivers are created in a similar manner. the other terrains are sort of 'grown' in the space in between.

try using the tlevel command

the default is tlevel: mountain 120;

so try using a lower number

impassable terrains, border mountains and the other dom3 terrains are something that i intend to work on after i get the sprite functionality in.

well i'm glad that the thing is working, though i'm quite annoyed that it can't be simply copied to another machine.

DrPraetorious
February 20th, 2007, 02:26 AM
Oh, I get it. That sets the water level! Okay, that'll work fine.

I think I found a bug in one of the maps it generated (attached). Provinces 10 and 11 appear to have their terrain assignments reversed. There are a few other terrain reversals.

If I had to guess, I think that the script is numbering provinces wrong whe the center (white) pixels have the same y-coordinate. That's just a guess though.

Thanks for the awesome tool!

paradoxharbinger
February 20th, 2007, 03:03 AM
that may be. i will check it out.

btw, can you post the debug for this map? i'd be interested to see ho long it took to generate it

DrPraetorious
February 20th, 2007, 03:07 AM
Oh, sorry, I overwrote it already.

This one is about the same size - took 1 minute and 14 seconds, it says. Gah, that's just for the last part.

Total time is about 15 minutes, counting all the steps.

paradoxharbinger
February 20th, 2007, 03:20 AM
well i took a look at the one you posted, the centers are very close to having the same y coordinate, but they differ by 1. they may have had the same y-coord before the province centers were adjusted, but i cant tell without the debug, so if you see it again, make sure you save it.

speaking of which, first priority is making debug as verbose as i can to address any issues anyone finds

DrPraetorious
February 20th, 2007, 03:30 AM
Yeah, okay, take a look at this map - 99 and 100 (I believe) have their province stats reversed.

100 definitely shouldn't be a forest, and 99 should be, in any case. Actually, it looks a lot of the provinces in the 99+ range have their terrain assignments scrambled.

paradoxharbinger
February 20th, 2007, 03:37 AM
yeah that whole area of the map is a mess, i think it may have to do with the provinces getting renumbered. if it's what i think it is, its a fairly easy fix.

Manuk
February 20th, 2007, 09:10 PM
Sorry Paradox, couldn't get the scripts right.

tried this:
wraparound: xy;
dimension: 2000,2000;
pcount: 175 25;

to get less water than default(too much water provinces)
and got that image(see attach)

paradoxharbinger
February 21st, 2007, 12:19 AM
@manuk

the pcount command is used to specify exactly the number of provinces to generate, so what you typed would create 175 land provinces and 25 water provinces. if you are looking to decrease the total amount of water on the map, try lowering the sea level, use:
tlevel: sea num
right now, sea level is at 38 by default, try lowering the number. or you could use psize to define the relative size of land and water provinces and it will pack as many on as will fit

but the dimensions are messed up because of that comma between the 2000's. the arguments are not separated by commas, just spaces. the syntax is like this:
command: arg1 arg2 arg3 ...;

or in the event that no arguments are required, e.g. verbose:
command;

if this doesnt get you where you need to go, lemme know

@ drP

i'm pretty sure i know where the problem is, i just haven't had time to straighten it out yet. also i am adding in a feature that will allow map regeneration, so if you get a nicely shaped map, but want to change some other settings, you can reuse the random number generator seeds.

Manuk
February 21st, 2007, 08:04 AM
tried with this script:

wraparound: xy;
dimension: 2000 2000;
tlevel: sea 20;

tried with psize and pcount, but still it's even water and land and the map look like islands. no change.

DrPraetorious
February 21st, 2007, 11:35 AM
Manuk - try setting the sea level all the way down to 0.

That gives you just a few lakes.

paradoxharbinger
February 21st, 2007, 12:54 PM
hmmm... try lowering the sea level and zooming in. right now, zoom is not relative to map dimensions. try zoom: .75;

paradoxharbinger
February 21st, 2007, 01:03 PM
btw, mapgen works differently than the dom3 map generator. dom3 looks like it creates terrain around provinces, ie the provinces are created first and then terrain is stuffed in and around them. mapgen does it in reverse order, terrain is created and then provinces are stuffed into the terrain. i did this because i thought it would lead to a more natural result. if you've ever seen a big map made with dom3, there are usually billions of small mountain ranges and forests, because they put these things along province borders. as a result it looks like chaos.

DrPraetorious
February 21st, 2007, 01:56 PM
As a rule it produces nice output.

However, I think that the topography (that produces oceans and mountains) is a little off.

It never produces cliffs (so no coastal mountains) and it seldom produces large, unbroken blocks of land. It looks like post-glacial terrain (lots of narrow lakes) even with the water-content set to the minimum.

It'd nice to make maps, for example, with one, roughly circular lake in them. Maybe just a few different fractal algorithms? The code that generates the land maps in Civ IV is freely available (as python code) if you want to take a look at some alternative fractal math.

This is something of a nitpick, obviously, and I'm not suggesting it should take priority over the other features you have planned. If you set the water content very low you get nicely balanced maps.

Keep up the good work!
--TNDP

DrPraetorious
February 21st, 2007, 03:47 PM
Actually, that's an idea.

If the difference in the "height" of two adjacent province-centers is >X, you declare the border between those two provinces to be a mountain-border. It's impassable and both provinces get the mountain-bordered terrain. How would that work?

paradoxharbinger
February 21st, 2007, 05:15 PM
that would be a good place to start for part of, but you have to ensure that it makes sense with how the map looks. at least one of the provinces would have to be mountain terrain. there might be more conditions that have to be satisfied for the image to make sense with what map file says.

btw, adding a new layer to the heightmap for lakes should not be too difficult, and may actually be able to replace one of the others. in that case, there would be little time cost for adding it, meaning maps would only take slightly longer to generate. this is on the back burner for now.

paradoxharbinger
February 21st, 2007, 05:58 PM
that problem with the oceans is kinda bizarre, should not be acting that way.

DrPraetorious
February 21st, 2007, 06:42 PM
Actually, I was wrong about the no coastal cliffs (or I just needed to move the mountain limit a bit.)

This is a map without about the right ratios of land:water, but the water is heavily fragmented.

It's still playable, but it'd be nice if all that water was in one or two seas.

Manuk
February 22nd, 2007, 05:50 PM
there is something about changing switches. I made a map and played it including all nations of that era. some terrain are exactly what they are meant to be. Like theres provinces of two colors that are plains and forest at the same time or something like that.
But others are of some color and the terrain is nothing to do with that color.
Tried to make less water provinces and i think it worked but the map looked like there was a lot of water provinces that were in fact normal provinces (plains?), lots of capitols were in sea provinces (for what they looked in the rgb picture) but they were something else instead.

PS the wrap around and the province shapes look perfect. colors look fine.

paradoxharbinger
February 22nd, 2007, 08:14 PM
yes, drP came across that bug, im fixing it for the next release, which will probably be this weekend

Ragnarok-X
February 23rd, 2007, 02:40 PM
sorry but the initial post doesnt tell if this generator works for Dom3 as well. Does it ?

paradoxharbinger
February 23rd, 2007, 03:31 PM
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
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
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, 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
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
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
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
oh crap, i may have sent out a debug build rather than releases build, try this

paradoxharbinger
February 28th, 2007, 03:34 AM
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
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
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
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
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
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
wow, crap. you have the seeds file for that one?

paradoxharbinger
March 1st, 2007, 04:47 AM
drP dont worry about that seed file, there is definitely a bug in there

paradoxharbinger
March 1st, 2007, 05:43 AM
ok, it's fixed now. made sure it worked, generated a map with your script.

paradoxharbinger
March 1st, 2007, 05:13 PM
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
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
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
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
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
@ 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
@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 (http://paradoxharbinger.wikidot.com/scripting).
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
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
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
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
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
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
aight, i put together a crude demo of what i'm going for, check the attachment

lch
March 29th, 2007, 06:53 PM
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
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
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
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
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?

lch
March 30th, 2007, 08:02 AM
paradoxharbinger said:
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.


That's right, the question is whether you used the incircles or circumcircles for that. I just judged by my eyesight and most cells look quite fine, but you can spot that some are a little bit off, some are even so far off that it can't come from rounding errors / computer precision. (see Attachment)


paradoxharbinger said:
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.


Yep. The vertices of the Voronoi cells are the centers of the circumcircles from the triangles of the Delaunay triangulation: you get the Voronoi cells if you draw in the perpendicular bisectors of the sides of the triangle towards their collective intersection point. This point could even be outside of the triangle surface, if it is obtuse angled. In the same way, the vertices from the Delaunay triangulation are the intersection points of the perpendicular bisectors from the Voronoi cells.

There is quite some information about it on Wikipedia, and they got lots of links regarding Voronoi diagrams and Delaunay triangulation, too.

paradoxharbinger
March 30th, 2007, 02:04 PM
@ich

oh there are plenty of links to applets and half assed descriptions of how to do it, but go looking for a detailed description and all i've ever gotten is cryptic source code, if that

i dont like the very short edges that you get with voronoi, so im sticking to the segments between the triangle centers

@llamabeast

those regions are not necessarily provinces, they are meant to be the building blocks of the provinces. im thinking that province edges could be either the gray or red lines, depending on the terrain that has been placed. but im pretty sure that im sticking to rivers on the triangle edges, using the others would make it too chaotic. and yes, getting the delaunay triangulation to wrap was rough.

lch
March 30th, 2007, 09:43 PM
Oh, you don't want the cells to be the finished provinces, okay, you're free to do that. Otherwise I'd assume that you get strange effects because I'd assume that the game interprets the provinces as being voronoi cells, so that mouse-clicks on the map can be efficiently calculated to the province they're meant for, by only saving and using one point per province instead of a whole polygon.

I still guess there's quite alot of good software around, but either you'll have to program the stuff yourself or use some library which does tons of other algorithmic geometry stuff aswell (like CGAL), yeah.

paradoxharbinger
March 30th, 2007, 10:26 PM
actually i think the game just gets the closest point. otherwise youd have to calculate the voronoi every time the map is loaded and store all the vertexes in addition to the province centers.

lch
March 31st, 2007, 09:50 AM
Yes, of course it only has to calculate the closest white points of the map, that's what I meant regarding that it does not have to save and use the whole polygons. But it can only do this because that is exactly the defining attribute of voronoi cells. http://forum.shrapnelgames.com/images/smilies/wink.gif

paradoxharbinger
March 31st, 2007, 03:45 PM
hmmm... never thought about it like that.

paradoxharbinger
April 5th, 2007, 09:53 PM
just wanted to post a little demo of the river algorithm im working on

Smauler
April 16th, 2007, 09:15 AM
Firstly, great work, paradoxharbinger http://forum.shrapnelgames.com/images/smilies/laugh.gif. Unfortunately, I'm having a few problems with scripting. For example, my script: script.spt file contains<font class="small">Code:</font><hr /><pre>pcount: 100</pre><hr />and results in<font class="small">Code:</font><hr /><pre>script: ./script.spt ... success

pcount: 1000 ... success</pre><hr />
That's a bit quirky, but it seems to work when you realise it adds about a factor of 10 to you pcount. However, I can't get some other stuff to work at all:
<font class="small">Code:</font><hr /><pre>pcount: 10
filename: test2</pre><hr />results in:
<font class="small">Code:</font><hr /><pre>script: ./script.spt ... success

pcount: 10

filename: test22 ... failed</pre><hr />
The pcount isn't increased, and the filename is, and it fails. Changing the pcount to a higher value dousn't help. Just
<font class="small">Code:</font><hr /><pre>filename: test2</pre><hr />results in:
<font class="small">Code:</font><hr /><pre>script: ./script.spt ... success

filename: test22 ... success</pre><hr />

Anyway, I'm a bit confused - seems as if if I put two variables in, it gets screwed. It's a little screwy with one, too. I've tried other scripting variables, with the same result. I tried switching to Unix style line breaks to see if that would fix it (I was clutching at straws here http://forum.shrapnelgames.com/images/smilies/tongue.gif), but same again. I may try downloading again, see if that fixes it.

Oh, my verion numbers are off too. In the title bar MapGen claims it's v 0.52.03082007, and in the program it claims it's 0.51.03082007.

If I'm doing something unbelievable stupid, feel free to point and laughhttp://forum.shrapnelgames.com/images/smilies/eek.gif, but I can't figure it outhttp://forum.shrapnelgames.com/images/smilies/confused.gif


edit : And one last thing - I'm using Dominions 2... please don't drop support for it... pretty please?

paradoxharbinger
April 16th, 2007, 12:15 PM
odd... could you attach a zip with all of the output please?

the version number may just be that i forgot to change an output line, that's no biggy. you're using th most recent right?

as far as dom2 goes, we'll see. it is probably just a mater of leaving out the dom3 terrain types, but i havent gotter quite as far as adding in the dom3 types yet.

@ all
sorry for the lack of updates, finals week is rolling around, so i've been bogged down with school related work.

paradoxharbinger
April 16th, 2007, 02:09 PM
one thing ive spotted is that you dont have semi-colons (;) after your command, that might throw it off. the scripting isnt very robust as far as error checking goes, so it's best to follw the rules to the letter, so commands look like this:

command: arg1 arg2 arg3;

colon after the command, arguments seperated by spaces, and a semicolon at the end of the argument list

edit: just checked, leaving off the semi-colon at the end will result in duplicating the last character, and if you have a command after one that does not have a semi=colon i can only imagine all of thew odd things that could happen. moral of the story is stick to the rules

Smauler
April 16th, 2007, 04:48 PM
I think my eyesight must be going - completely missed the semicolon at the end. I just tested it, and it works fine now. I'll probably play around with it more tomorrow. Thanks.

Gandalf Parker
April 28th, 2007, 04:48 PM
Here is a first effort of mine (well the first Im willing to show)
a Mid-Sized Wrapped Map
http://www.dom3minions.com/RandomMaps/Midsized_Wrappable.jpg
and it can be downloaded here..
http://www.dom3minions.com/RandomMaps/Midsized_Wrappable.zip

Its a 168 provinces and wraps both top-to-bottom and east-to-west. Its not very nice to water nations Im afraid.

Im eagerly waiting for things like sprites, and bunching up continents abit.

Id like it if the dom2title would use the map name. If I run a batch of 12 MidMap then I get MidMap_001 thru MidMap_012 but in the game start menu they all show up as PHMAP.

Will the seed be recorded in the .map file?
If I redo the map with the same seed but turn off features, will it affect the order that randoms get used? In other words, is everything that can be randomized using the seed even if its not turned on so that the end result will look the same even if that feature is turned off on the next run?

Gandalf Parker

Gandalf Parker
April 28th, 2007, 11:24 PM
OK after a day of playing with paradoxharbinger's MapGen I have come up with something I like. Its 2000x1500 pixels.
1055 provinces of 895 land and 160 water
land players have a ratio of 49 prov each for 18 players
water players have a ratio of 53 each for 3 players

Its a fully wrapped map. That means the top connects to the bottom and the sides connect to each other.

Here is a view of it
http://www.dom3minions.com/RandomMaps/Max_001.jpg
and here is the download link if you want the map
http://www.dom3minions.com/RandomMaps/Max_001.zip

Gandalf Parker

paradoxharbinger
April 29th, 2007, 12:03 AM
@ gandalf

the sedds arent recorded in the map file, that would be the .sds file i believe, its been so long i forge the extension. i also forget whether i actually implemented the bit that would load those seed files, probably not. but the maps will regenerate exactly as they first did. the point of using them was to generate as small file that could be easily sent, over dial-up say, instead of a monstrous image file.

the PHMAP, business, yeah that needs to be fixed, i'll take care of that as soon as possible, as well as getting the seed file to load up, that is really just a matter of deciding how i want to implement it, which is conflicting with a few things that have alrady been in place for a while, so needs a bit of planning.

as far as sprites go, they are working, i just do not have a set that i can distribute. and being a programmer rather than an artist, i dont really have the talent required to create a set, if i did you would probably rather i hadnt. so if any intrepid artists out there would like to donate some sprites for inclusion, all credit given to you, feel free to get in touch with me.

@ all

my semester has finally ended. ive been on hiedous because of the craploads of work all of the profs want to stuff into the last couple weeks, so apologies. that being said, i'm gearing up to start my summer job, which means all of the time i needed to spend for school after getting home from school can start to be allocated back to personal projects (mapgen, unit maker).

so i have been able to get a bit of work done (see above) in moving over to a new generating method, most of the groundwork is pretty much done, which means that all of the line segments know which other line segments they are connectedd to and all of the triangles and polygons know who their neighbours are, which is a good bit of what needs to be done. the next bit is getting things generate in a convincing manner, which actually the easier part, in my experience. any how, ive already got what i think is a pretty good river algorithm put together.

so for the next update, which may be the last incarnation of mapgen before it moves on to new the new algorithms, should include regenerating from seed files, the fixed map names and possibly some better script checking. small details to be sure, but after that, bigger better things.

ive said that the new algorithms would be alot faster, and they seem to be a lot faster. if that proves to be true, i'm looking at migrating the code from c++ to c# and then using mono (pending some testing, mentioned in the unit maker thread) to get the multi-platform release going.

alright i think that covers everything, im sort of on vacation now, so that release with the fixes might be out sometime next week, we'll see how work goes.

Gandalf Parker
April 29th, 2007, 01:03 AM
Hmmm thats not what I was hoping from seeds. I was hoping for something like DomMap had. One seed number which defined the map. I could run a full color map for display, then a subtler one for play, and one for it again as blank provinces or borders only for special game progression displays.

lch
April 29th, 2007, 10:24 AM
I have now got this program working under Linux via wine, too. You have to download http://www.sweetpotatosoftware.com/files/microsoft.vc80.crt.zip and unzip and move the DLL files and the manifest file into the MapGen directory, then it works:

<font class="small">Code:</font><hr /><pre>~/446398-MapGen_0.52.03082007 $ wine MapGen_0.52.03082007.exe
fixme:actctx:FindActCtxSectionStringW 00000000 (null) 2 L"msvcr80.dll" 0x347acc
ParadoxHarbinger's MapGen
Version 0.51.03082007
Copyright 2007, Jason Makay

generating height-map..........done
generating terrain-map.............done
generating province-map.........done
generating sprite-mapdone
saving image...done
saving map...done
saving seeds...done
freeing memory...done</pre><hr />
Tested with MapGen 0.52 and wine 0.9.35 and wine 0.9.29. For an explanation of the error message and why the native DLLs do not work yet, look at the wine mailing list (http://www.winehq.com/pipermail/wine-users/2006-May/021621.html): It's the function loading/check mechanism that gives trouble.

Because this is a C++ program which uses the Windows API and makes calls to the MSVC DLLs this program will never work with Mono (unlike the Unit editor written in C#), you'll have to use wine.

paradoxharbinger
April 29th, 2007, 10:25 PM
@gandalf

well the seeds can be loaded and the options can be changed via the scripts, if that's what your getting at.

Gandalf Parker
April 29th, 2007, 11:44 PM
lovia thaded?

paradoxharbinger
April 30th, 2007, 12:03 PM
oh, my bad that got screwed up, should say reloaded, not used to having to avoid the goofy pad thing on laptops.

paradoxharbinger
May 18th, 2007, 02:06 PM
well, been a while since i posted, here's a quick update on goings-ons. im creating a gui in c# so that for those uninterested in such things, scripting will become uneccessary. i believe it was ich who mentioned that installing mono will allow for people on the major systems to run c# apps, so this will hopefully also solve the crossplatform dilemna. not much else other than that, more info when it's available

paradoxharbinger
June 5th, 2007, 03:49 PM
Kristoffer O has kindly supplied a zip file for all of the sprites in the game, so i will hopefully be able to have a quicky update out sometime soon that will have the sprites put in, as well as a few other minor fixes.

also news on a brand spanking new full blown overhaul should be coming along shortly

Ballbarian
June 5th, 2007, 04:16 PM
Just fyi, I think the zip only includes unit sprites. I don't have time to look more at it now, have to get back to work. ( I Hope that I am wrong!)

Kristoffer O
June 5th, 2007, 04:35 PM
Currently unit sprites. Others are easily made.

Gandalf Parker
June 5th, 2007, 06:01 PM
Well the mapping sprites have been causing a problem with getting some generators done.

paradoxharbinger
June 5th, 2007, 06:03 PM
i'd deeply appreciate a zip with the map sprites in it.

paradoxharbinger
July 7th, 2007, 10:58 PM
just a quick note.

sorry for lack of promised update, had a lot of familial health issues this month.

anyway, as a bit of compensation, i've attached a pick of my first crack at an island algorithm, let me know what you think.

Gandalf Parker
July 7th, 2007, 11:04 PM
Well I dont think Id play that map. Too much water for the land. But it does look as if the island routine worked all right.

Ballbarian
July 8th, 2007, 03:31 AM
Looks really promising p!

paradoxharbinger
July 13th, 2007, 10:31 PM
here is the first half of my second attempt, the skeletons of the islands. imagine if you will the red lines being at the center of the particular bits of land.

llamabeast
July 27th, 2007, 12:38 PM
How is this coming along paradox? Looking forward to seeing future progress!

Gandalf Parker
August 18th, 2007, 04:15 PM
OK, my ADD has shifted back this direction. The blitz games on my server have slowed down and besides offering new game settings Im thinking there is a real desire for blitzes on wrapped maps.

I have a script which I am playing with. The colors seem fairly comfortable to me. The script runs a batch of 100 maps or about 50 provinces (the size I use in my blitz games) and wrapped both X and y. Running a hundred maps usually gives me one or two that I consider good. Maybe someone can help me tweak my settings.

The problems I have is
A) I want the terrains to be abit more grouped. The water together more.

B) I also DONT want the terrains too grouped. Not have all of the forest and mountains grouped to where someone might start somewhere and be stuck with only one terrain for the provinces surrounding their castles (all food bonuses, or all resource bonuses, or all wasteland).

Here is the script I have so far....
<font class="small">Code:</font><hr /><pre>
border: yes ;
filename: Blitz ;
batch: 100 ;
verbose: yes ;
pixel: 50 70 50 * * ;
pixel: 130 130 250 water water ;
pixel: 0 0 205 water ;
pixel: 255 250 205 waste ;
pixel: 124 252 0 farm ;
pixel: 139 90 43 mountain ;
pixel: 162 205 90 swamp ;
pixel: 102 205 0 plain ;
pixel: 34 139 34 forest ;
tchance: plain 50 ;
tchance: mountain 40 ;
tchance: forest 30 ;
tchance: water 50 ;
tchance: farm 10 ;
tchance: swamp 3 ;
tchance: waste 3 ;
tlevel: mountain 140 ;
tlevel: sea 110 ;
pthresh: 5 ;
nbdist: 10 ;
tsize: 50 40 ;
psize: 25 35 ;
zoom: 1.25 ;
wraparound: xy ;
pcount: 40 10 ;
dimension: 2000 1600 ;
</pre><hr />

So how can I get it to be abit more continent and seas, instead of all islands and rivers?

Gandalf Parker

paradoxharbinger
August 19th, 2007, 08:57 PM
once again, i must apologize for my extended absence (getting kind of old, huh?).

i hope that all of you are not too annoyed with me, when i started this project, it was meant to be a way for me to learn a new programming language in an interesting way. after a while it became a way for me to improve my algorithm techniques and even after that, a way for me develop some interesting algorithms of my own, so sometimes i just get derailed into something completely unrelated.

anyway, i have been making some progress. i've recently gone in an entirely new direction with some of the new algorithms, which turns out to be a double win, because even as the algorithms have become more simple, the desired results have also become so much easier to achieve.

i've attached a screen to show what i am now working with. it is a contrived example, but the beauty is that such a result would not be difficult to randomly generate. blue is water, red is land and green is the coast line.

i am going to combine this with the grids to make the edges more jagged. hopefully more on that soon.

@gandalf
unfortunately, seems that the old mapgen is rather more inflexible than i thought, i suppose i never imagined all of the ways people would try to use it, though i tried, but that's what public testing is for, right? in any case, my suggestion would be to try raising the water level. in truth, i haven't looked at that code in so long, i can barely remember how it works, and it was such a mess that it gave me head aches when i went back to try and fix the naming issue that you mentioned. my programming style has advanced quite a bit since i wrote that stuff and to think that i wrote that atrocious code makes me shudder.

Gandalf Parker
August 19th, 2007, 09:02 PM
Been there, done that.
Looking at code I wrote years ago either has me laughing or amazed that I wrote it.

Gandalf Parker
August 22nd, 2007, 02:51 PM
Very strange. Apparently the secret to getting continents and oceans lies in the ZOOM command. I thought that was zoom like it is in Dom3 but apparently it ties into the code.

Setting zoom to 5.00 got me provinces with very dot-scattered edges. And setting it to 0.25 got me provinces and oceans and also took away the mixed-terrain provinces.

I guess that after I run the maps then I will need to include a fix to the zoom in my script that fixes things like map name and description.

paradoxharbinger
August 22nd, 2007, 03:50 PM
yeah, zoom is a little odd. if i remember correctly, this is approximately how it works: imagine you are standing over a map, looking down at it, zoom determines how close your face is to the map. it can dramatically affect how things actually look. i cant remember all of the things i tied it into, nearly everything i expect, but i do recall that it did not lend itself very well to several applications, such as growing terrains.

Gandalf Parker
August 22nd, 2007, 04:26 PM
Actually thats how I thought it worked. But apparently it has a big affect on how provinces are drawn, and how they are grouped.

Its a good thing to have found. I can get maps that are alot like Dom3s as far as continent/ocean. Or ones as scattered as I was getting before and thinking I was stuck with it.

The problem I have now is that the settings I had randomly stumbled upon for getting a decent spread of terrains (especially mountains) are no good. I have to start over changing numbers until I stumble on a working ratio.

Can you give me an idea of pthresh, tsize, psize, and some which might be in the program but I dont know it?

paradoxharbinger
August 22nd, 2007, 06:10 PM
i think if you scale your old values in proportion to how you scaled the zoom that will set you up. if not, i can start messing around with the old mapgen a bit to figure it out.

DrPraetorious
August 22nd, 2007, 07:07 PM
No no no, this is good. We *want* the maps to be more clumped http://forum.shrapnelgames.com/images/smilies/happy.gif.

paradoxharbinger
September 8th, 2007, 11:38 PM
work is progressing, i have something now that allows for the overall land percentage to be more or less specified. i have to run some tests to figure out a few constants in my algorithms, but things are looking good. maybe some screens soon.

paradoxharbinger
October 12th, 2007, 07:24 PM
ok, land percentage can be closely specified, close enough that no one ought to be able to tell the difference anyway. you can also specify whether the generator should try and put water or land in the center of the map. don't mind the dots, theyre for debug.

screens:

http://paradoxharbinger.wikidot.com/local--files/screenshots/10.12.2007%205.53.50%20PM.gif

http://paradoxharbinger.wikidot.com/local--files/screenshots/10.12.2007%205.54.30%20PM.gif

http://paradoxharbinger.wikidot.com/local--files/screenshots/10.12.2007%205.55.08%20PM.gif

http://paradoxharbinger.wikidot.com/local--files/screenshots/10.12.2007%205.56.04%20PM.gif

http://paradoxharbinger.wikidot.com/local--files/screenshots/10.12.2007%205.56.49%20PM.gif

http://paradoxharbinger.wikidot.com/local--files/screenshots/10.12.2007%205.59.08%20PM.gif

http://paradoxharbinger.wikidot.com/local--files/screenshots/10.12.2007%205.59.33%20PM.gif

DrPraetorious
October 12th, 2007, 08:53 PM
Those look cool. Kinda TRON. Keep that look as an option in the final version http://forum.shrapnelgames.com/images/smilies/happy.gif (you'd have to swap borders and province centers I think).

Keep up the good work, and thanks for the update PB!

paradoxharbinger
October 27th, 2007, 07:31 PM
so, finally been working on some graphical stuff, as i think i am fairly satisfied with the landmass generation algorithm. now, one of the nice things about c# is that it has a fairly good graphics library (at least for my purposes). what this means for you, is that you get to use textures in the maps. here is an example screen:

http://paradoxharbinger.wikidot.com/local--files/screenshots/10.27.2007%206.21.15%20PM.jpg

lch
October 27th, 2007, 08:55 PM
Now we're talking.

Ballbarian
October 28th, 2007, 04:37 AM
Lookin' good ph! http://forum.shrapnelgames.com/images/smilies/happy.gif

paradoxharbinger
November 5th, 2007, 08:42 PM
terrain types (plains, farms and such) are coming along. still a few quirks to work out, but the groundwork is done. here's a new screen:

http://paradoxharbinger.wikidot.com/local--files/screenshots/11.5.2007%206.35.17%20PM.jpg

* the mossy looking stuff is the texture i used for plains, no other terrain types in there yet, so it's just water, bare land and plains at the moment.

llamabeast
November 8th, 2007, 07:41 PM
This is looking really exciting PH. Keep up the good work.

Gandalf Parker
February 15th, 2013, 06:58 PM
[NECRO]
another in my effort to provide an ARK for worthy projects while we still can.
ParadoxHarbinger (http://paradoxharbinger.wikidot.com) do you plan to migrate this to the new Dom3 forum?
Do you mind if I do it?
Are there updated links to the source code of this project?
What is the DRM of this project?

For anyone that is curious I do have some wrapped maps created with this program. I have not gotten the tiling to work (filling in with images such as mountain and forest) but of course that could always be done manually.
http://www.dom3minions.com/maps.htm
at one time I had planned to add it to the daily automated new-maps feature of the site and run map in all sizes. But using this program tends to involve knowledge of math that HB considers basic and I consider far beyond me. :)