View Full Version : World Map Generator
07-10-2012, 11:52 PM
I am new to php and I would like to learn how to make a World Map Generator something basic. And have some variables to set on how it looks. Any Ideas how this might be done? It would be just a couple simple colors. Thanks
Edit: Something like this http://donjon.bin.sh/scifi/world/ It be just a simple picutre(2d)
07-11-2012, 12:25 AM
Heh, nothing simple about it!
Best I can think of is creating a splined system where you determine how much of each type of "land" you should have, and basically use GD to create a new image, creating each pixel as a grid point. Of course, then you have to calculate where land should meet water, how much it should meet with, etc etc etc. Nothing simple about it.
07-11-2012, 12:53 AM
OH...:( Hmm.... Would you know of any examples changing a pixels color? I might try somethign like a 10 by 10 pixel square to figure it out...
Edit: For land meats water I could place on land pixel then say only pixels can be created around that using a for statment then inside of that if it was placed next to water counts it as a land if it was not delete it....
07-11-2012, 03:47 PM
Unfortunately, GD is something I've been meaning to learn but haven't, and I could definitely use a good tutorial on it too... never quite found one that explained it well enough for me to understand beyond the applied principle.
07-11-2012, 10:19 PM
Image GD is easy to set pixels if you would like to start from there.
The function is imagesetpixel (http://ca.php.net/manual/en/function.imagesetpixel.php), and it does have some examples for you.
If you want to set actual images in place, its a simple matter of following the same logic as setting a pixel. But instead you use merging to overlay other images ontop of an existing image. Works exactly the same, so long as each part image is proportioned the same as every other part, thinking like a matrix style for the setting of them.
GD takes some practice, but its a relatively painless process once you've learned it.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.