<< Back to Map Development Forum   Search

Posts 1 - 30 of 37   1  2  Next >>   
Generate your connections automatically, too!: 12/29/2011 21:31:08


Matma Rex 
Level 12
Report

The most boring part of making a map, now - automated and painless! (Sort of.)

After my centerpoint generation tool, I now present another - a connection generating one.

As the previous one, this tool will need your e-mail and password to work. This data is not used for any malicious purposes.

Please note that due to nature of the task (and my laziness), finding out which territories connect may take a long time. A couple of minutes at least even for little map, and when I tried it on a 264-territory map, Bulgaria Big, it took over 3 hours. (But, it worked perfectly!, as you can see.)

It can probably be sped up quite a bit, some of the work it does is redundant - I'll have to think about it.

Also, don't expect correct results when dealing with territories with holes or multipart ones.


Executable file for Windows: http://dl.dropbox.com/u/10983006/tmp/connection_uploader.exe

Source code: https://github.com/MatmaRex/Warlight-Tools

Generate your connections automatically, too!: 12/30/2011 07:26:52


Perrin3088 
Level 44
Report

I presume it won't work for connections that are not actually touching as well..
over water, etc.

Generate your connections automatically, too!: 12/30/2011 11:04:37


Moros 
Level 50
Report

Lol, there must be a way to automatically make oversea connections, just a script that detects yellow lines going from one territory to the other, and makes a connection between them. But nah, I'm lazy... Btw, when Benelux is finished, I'll try it with this tool, I think I can make my computer do it in roughly a day. The centerpoints I'll rather do by hand, since a lot of my territories have holes in them. But.., I'm also nearly done with a small map with all territories shaped like circles, so I'll try your centerpoint creator on that map today to make all centerpoints perfectly centered.

Generate your connections automatically, too!: 12/31/2011 16:13:43


Richard Sharpe 
Level 59
Report

Rex, ran your program. It did indeed take forever (over 5 hours) but worked decently.

http://warlight.net/SinglePlayer.aspx?PreviewMap=8218

The centerpoints were also generated by your program which doesn't handle islands very well. Had I cleaned it up in between executing the programs I am sure the connections would have been complete. Still worked quite well though.

Generate your connections automatically, too!: 12/31/2011 16:33:45


Matma Rex 
Level 12
Report

Glad to see it works.

When a territory consists of multiple "chunks" (where a chunk is a visible path or a hole in "outer chunk"), both of my utilities choose only one chunk out of them all, and treat it as if it was the entire territory - I simply didn't implement anything better. There is a kind of logic as to which one is chosen, but you might just as well assume it's random. This is on my long-term to-do list :)

Generate your connections automatically, too!: 2/12/2012 13:32:50


Moros 
Level 50
Report

Does the tool delete connections already there? Such as island-mainland connections that wouldn't be made by the generator.

Generate your connections automatically, too!: 2/12/2012 18:48:57


Matma Rex 
Level 12
Report

It does not delete anything. Deleting connections via API is currently not possible, actually.

Generate your connections automatically, too!: 2/17/2012 07:23:26


Flesius9517
Level 50
Report

I used this to 386-territory map (http://warlight.net/SinglePlayer.aspx?PreviewMap=10427), and it took less than 200000 milliseconds!

Generate your connections automatically, too!: 2/17/2012 19:47:32


Matma Rex 
Level 12
Report

E4TCD1, I'm glad to have been helpful :D

This means one of two things: you have a pretty good computer, or you are using simple shapes for territories.

I can't talk about the first, but I see you're only using straight lines for your territories (no beziers etc.) - this saves a lot of computation, even if the territories are otherwise detailed :)

Generate your connections automatically, too!: 2/17/2012 19:54:38


Moros 
Level 50
Report

I thought your program just ignored beziers and only calculated with the centerpoints!

And nice map by the way :)

Generate your connections automatically, too!: 3/8/2012 21:16:36


Ironheart
Level 53
Report

matma rex in the first bit about file what file does it mean

Generate your connections automatically, too!: 3/8/2012 22:30:10


Moros 
Level 50
Report

The Inkscape file you're working from.

Generate your connections automatically, too!: 3/9/2012 08:18:28


Ironheart
Level 53
Report

i typed it in it said try again

Generate your connections automatically, too!: 3/9/2012 16:36:23


Moros 
Level 50
Report

Are you sure you typed it like this?
C:\Users\My Stuff\Maps\Map.svg

You need to give the exact location of the file.

Generate your connections automatically, too!: 3/9/2012 18:20:44


Matma Rex 
Level 12
Report

Moros is right - either type in the full path of file, or copy both the file and my program into the same folder.

Generate your connections automatically, too!: 3/10/2012 04:04:36


Flesius9517
Level 50
Report

It's not worked perfectly... Connection missing between Yakimovo and Medkovets (Montana Province)

Generate your connections automatically, too!: 3/10/2012 09:24:16


Moros 
Level 50
Report

Yup, it doesn't work correct with multi-part territories, or those with holes in them, you have to do those manually.

Generate your connections automatically, too!: 3/10/2012 17:28:09

Grzechooo 
Level 30
Report

It's written in original post, isn't it?

Generate your connections automatically, too!: 3/10/2012 21:58:34


Ironheart
Level 53
Report

moros i did it manually i just need a name making one.

Generate your connections automatically, too!: 3/10/2012 22:11:37


Perrin3088 
Level 44
Report

E88's example is not a holey or multi territory connection..

Generate your connections automatically, too!: 3/11/2012 12:59:08


Matma Rex 
Level 12
Report

E88B3EC, thanks for report, I fixed the connection in map version 1.0.1 (currently pending public). I wonder why it didn't work, but I don't have time to investigate now.

Generate your connections automatically, too!: 3/22/2012 22:01:34


Nate
Level 18
Report

I tried to use the tool which worked great until i got to the upload part and the it won't upload is says It didn't work and to report the error any ideas?

Generate your connections automatically, too!: 3/29/2012 16:57:17


Matma Rex 
Level 12
Report

Uh, try reporting the error. Did you take a screenshot? What did it sey? (Apart from mthat it didn't work.) I can't fix it if I don't know which part fails.

Generate your connections automatically, too!: 3/29/2012 18:53:30


Nate
Level 18
Report

okay here is what itt says word for word

Starting up, be patient...

This tool will allow you to automatically create
connections on your map.

It will have to ask you for your e-mail and password. This data
is not remembered or used for any malicious purposes,
it's simply required to confirm that it's your map
and you have the right to edit it.

It will also need the map's id. You can get it
by clicking "Get Link for Sharing",
the id is the number displayed at the end of public link.

Enter the name of file to work on:
> C:\Users\Living Room\Documents\Nate's Files\Warlight Maps\Map 5.svg

And now the map's and your data: [warning - your password will be visible]
Map id: North America (Medium)
E-mail: *********
Password:
***

Working... this may take some time. Go have a cup of tea or something.
This map appears to have 408 territories.
Loading data...
Press enter to exit.|oooooooooooooooooooooooooooooooooooooooo | ETA: 00:00:00

It says a whole lot of other stuff as well but i can't copy it fast enough before the program closes. However it used to get to the part where it uploads and then it says ** it didn't work there might be a problem with your connection please report it. Can you help please

Generate your connections automatically, too!: 3/29/2012 19:13:09


Moros 
Level 50
Report

It closes as soon as you press ENTER.

Generate your connections automatically, too!: 3/29/2012 19:17:28


Nate
Level 18
Report

I know that but i go back to check my map and it still has connections missing here is the map you should recognize it click here
Ex. the Central Mountains of Virginia and Southwestern Virgina Mountains are still not connected even though i used the tool.

Generate your connections automatically, too!: 3/29/2012 22:02:41


Matma Rex 
Level 12
Report

Oh, but it did add some connections? Then it worked, mostly. It's not perfect, unfortunately, and you might've hit a corner case - just add the connection yourself.

Generate your connections automatically, too!: 3/29/2012 22:08:19


Perrin3088 
Level 44
Report

Matma, it's a similar issue that E88 reported earlier...

Generate your connections automatically, too!: 3/31/2012 16:48:41

[16] Jasper 
Level 52
Report

This program running for several hours was something that really amazed me. As such, I decided to take a look at your source code and see how you did this. Though I don't really know ruby, I was able to make up a lot out of what I saw. I hope you don't mind me taking a moment to post my findings here.

First off, let me say that the way you reduced the problem to collision detection of bounding boxes. It is a very sound strategy and is likely to generate rather good results.

The first thing that stood out in my opinion was the fact that you are lazily generating the bounding boxes, even though you know up front that you are going to need them for each and every territory. Though this does work, just calculating the bounding boxes first removes a point where you can make mistakes (the laziness). I should add that my lack of knowledge when it comes to ruby made sure that I didn't really understand how you were doing the laziness, but I got the intention.

The other part is the actual collision detection. It is a very simplistic algorithm running in O(n^2). Because collision detection is so important in things like games, there are lots of efficient algorithms for this, including some that are still rather simple and can be implemented easily (especially when you can make some assumptions about the input, like you can with warlight maps). However, it is not entirely clear if making a more efficient solution here is actually going to improve your solution (especially since n < 3500). However, with the change suggested above, where you make the determining of the bounding boxes static instead of dynamic, it will be possible to have a progress bar for each of the two, which will make it easy to test which of the two is your bottle neck in real world examples.

I hope you can do something with my comments, but I won't be offended if you don't. I just thought I would share my findings with you.

Generate your connections automatically, too!: 3/31/2012 19:38:59

RvW 
Level 46
Report

Didn't study the details, but my gut instinct says that going from O(n^2) to O(n log n) will very likely be faster, even for small n.
Remember, even if it's ten times as slow for n = 5, it will still be near-instantaneous, whereas reducing the running time by 50% for n = 100 or n = 1000 will save you hours, which will be very "noticeable". ;)

Posts 1 - 30 of 37   1  2  Next >>