.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)

lch March 30th, 2007 08:02 AM

Re: new map generator
 
1 Attachment(s)
Quote:

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)

Quote:

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

Re: new map generator
 
@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

Re: new map generator
 
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

Re: new map generator
 
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

Re: new map generator
 
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

Re: new map generator
 
hmmm... never thought about it like that.

paradoxharbinger April 5th, 2007 09:53 PM

Re: new map generator
 
1 Attachment(s)
just wanted to post a little demo of the river algorithm im working on

Smauler April 16th, 2007 09:15 AM

Re: new map generator
 
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/image...ies/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/image...s/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

Re: new map generator
 
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

Re: new map generator
 
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

Re: new map generator
 
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

Re: new map generator
 
Here is a first effort of mine (well the first Im willing to show)
a Mid-Sized Wrapped Map
http://www.dom3minions.com/RandomMap..._Wrappable.jpg
and it can be downloaded here..
http://www.dom3minions.com/RandomMap..._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

Re: new map generator
 
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

Re: new map generator
 
@ 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

Re: new map generator
 
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

Re: new map generator
 
I have now got this program working under Linux via wine, too. You have to download http://www.sweetpotatosoftware.com/f...t.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: 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

Re: new map generator
 
@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

Re: new map generator
 
lovia thaded?

paradoxharbinger April 30th, 2007 12:03 PM

Re: new map generator
 
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

Re: new map generator
 
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

sprites coming soon
 
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

Re: sprites coming soon
 
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

Re: sprites coming soon
 
Currently unit sprites. Others are easily made.

Gandalf Parker June 5th, 2007 06:01 PM

Re: sprites coming soon
 
Well the mapping sprites have been causing a problem with getting some generators done.

paradoxharbinger June 5th, 2007 06:03 PM

Re: sprites coming soon
 
i'd deeply appreciate a zip with the map sprites in it.

paradoxharbinger July 7th, 2007 10:58 PM

quicky update
 
1 Attachment(s)
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

Re: quicky update
 
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

Re: quicky update
 
Looks really promising p!

paradoxharbinger July 13th, 2007 10:31 PM

Re: quicky update
 
1 Attachment(s)
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

Re: quicky update
 
How is this coming along paradox? Looking forward to seeing future progress!

Gandalf Parker August 18th, 2007 04:15 PM

Re: quicky update
 
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

Re: quicky update
 
1 Attachment(s)
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

Re: quicky update
 
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

Re: quicky update
 
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

Re: quicky update
 
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

Re: quicky update
 
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

Re: quicky update
 
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

Re: quicky update
 
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

Re: quicky update
 
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

Re: quicky update
 
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/...53.50%20PM.gif

http://paradoxharbinger.wikidot.com/...54.30%20PM.gif

http://paradoxharbinger.wikidot.com/...55.08%20PM.gif

http://paradoxharbinger.wikidot.com/...56.04%20PM.gif

http://paradoxharbinger.wikidot.com/...56.49%20PM.gif

http://paradoxharbinger.wikidot.com/...59.08%20PM.gif

http://paradoxharbinger.wikidot.com/...59.33%20PM.gif

DrPraetorious October 12th, 2007 08:53 PM

Re: quicky update
 
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

Re: quicky update
 
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/...21.15%20PM.jpg

lch October 27th, 2007 08:55 PM

Re: quicky update
 
Now we're talking.

Ballbarian October 28th, 2007 04:37 AM

Re: quicky update
 
Lookin' good ph! http://forum.shrapnelgames.com/images/smilies/happy.gif

paradoxharbinger November 5th, 2007 08:42 PM

Re: quicky update
 
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/...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

Re: quicky update
 
This is looking really exciting PH. Keep up the good work.

Gandalf Parker February 15th, 2013 06:58 PM

Re: new map generator
 
[NECRO]
another in my effort to provide an ARK for worthy projects while we still can.
ParadoxHarbinger 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. :)


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.