.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


All times are GMT -4. The time now is 03:32 PM.

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