Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Michael Black, posted on January 23, 2001

Image Description, by Michael Black

Today's "Blob Map" made me search through my Way Back files for this little guy. It's a program that I onced used to genereate political boundaries for a map after the terrain was generated.

The black area in this shot is a bay or an ocean and the colors are countries or territories.

The source code is in MFC and is very simple (probably 100 lines). If anyone would like to see it, I can put up a link.

-Michael Black

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

January 23, 2001, 04:06 PM

Looks cool! I'd be interested in seeing that code. I don't know much about algorithims like these and I'd probably learn a lot from it.


January 23, 2001, 05:03 PM

Looks like this blob map stuff could be really interesting for terrain texturing ! ;-)


Mark Friedenbach

January 23, 2001, 05:06 PM

Reminds me of the game RISK.


January 23, 2001, 05:18 PM

Looks alright. For that detail level you could have omitted the "count" dialog box and shrunk the image and fit say 4 different runs on one image.
How hard would it be to make it colour the map using only 4 different colours? I know it can be done. Perhaps you could search for the algorithm to do that on the net.
It would have been even more interesting if it demonstrated that algorithm as well.


January 23, 2001, 05:29 PM



January 23, 2001, 10:00 PM

.. certainly a handy piece of code .. but is it just me, or are all the "blobs" leaning to the left?

Amitt Mahajan

January 23, 2001, 11:54 PM

the sad thing is I actually tried to click the ok button on that message box...pathetic.


January 24, 2001, 01:59 AM

thats okay, I still have to remind my mom often, too often not to click on those ads that do that...

BTW, just noticed google took off their logo, go look... strange, hope that doesnt stay like that..


January 24, 2001, 02:13 AM

OK, here is the source code to the above program. It's pretty simple, so I hope you'll excuse the lack of comments in the code! :)

There are basically 2 steps.

1. seed phase: starting in the middle and going out, each square has a % chance of being the same color or changing.

2. glob phase: make sure each splotch of color is at least MinSize pixels.

It's old, it's MFC, and it's skanky; but maybe there's something you can yank from it!


January 24, 2001, 06:47 AM

thanks 4 da source ;) all landscape-engine coders know what i'm saying ;)

Francis Shanahan

January 24, 2001, 09:38 AM

NICE, reminds me of a game I used to play on my Atari 128xe. I remember it was called something way out there like "Global Thermo-Nuclear War" or something like that. Does anyone remember that game?


January 24, 2001, 10:21 AM

You managed to get the regions to affix themselves to the coast? I'm impressed. Gotta download the code. You say there is a minumum region size, so how does it determine how big the countries on the borders are?


January 24, 2001, 12:41 PM

Thanks for posting the source. I thought you might be using a kind of flood-fill algorithm, but I don't see any recursion there in the code where I guessed it might be... I don't understand your algorithm yet. :-)

[Note to moderator: I accidentally posted an "alert" for the above (parent) message. It is obviously about as on-topic as it could be, and I apologize for any inconvenience! Slip o' the index finger...]


January 24, 2001, 12:48 PM

They're all Socialist countries.


January 24, 2001, 02:16 PM

And I pressed space two(!) times to get rid of the message box :P


January 24, 2001, 10:56 PM

Hehe, I don't have trouble like that...

Then again, dialog boxes in Linux look nothing like in Windows, so it's hard to make that mistake. :)

This thread contains 16 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.