Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2012
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    World Map Generator

    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)
    Last edited by Tim Conner; 07-10-2012 at 11:02 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    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.

  • #3
    New Coder
    Join Date
    Jul 2012
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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....
    Last edited by Tim Conner; 07-10-2012 at 11:59 PM.

  • #4
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    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.

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    Image GD is easy to set pixels if you would like to start from there.
    The function is imagesetpixel, 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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •