A PHP city (it gets better after the break):
Basically I was bored one day and decided to play around with ImageCreate and ended up making this “crate” demo (click the image for some other experiments).
And then everything got a bit silly and I made this:
It has a map, side and front elevation view, a river, bridges, a central business district where the buildings are higher. Oh and it randomly reconfigures itself when you reload it – click the image for a demo :)
Yes. I am mad.
Source – Basic – Source – Advanced
#1 by krushan sonwane on April 15, 2009 - 3:49 am
i am using your code
#2 by user24 on April 16, 2009 - 10:33 pm
Glad to hear it! What are you using it for?
#3 by svinjo on April 19, 2009 - 8:58 am
It looks cool but it when I click the image in the post I get Fatal error
#4 by svinjo on April 19, 2009 - 9:00 am
Clicking the second image produces Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 24 bytes) in /home/u24/puremango.co.uk/crate_city.php on line 154
#5 by user24 on April 20, 2009 - 3:52 am
Fixed – I moved servers last week and didn’t get this code working with my new server – thanks for pointing it out :) I’ve also made the source available now, and fixed a few PHP_NOTICE errors that I was getting in rare circumstances.
#6 by Ed on November 21, 2009 - 5:52 am
Very nice procedural river.
I think this could be extended to make something truly awesome – different types of buildings, perhaps? Roads/infrastructure, etc. I’d love to see what it looks like from ground level :)
Glad to see someone else abusing PHP and GD :)
Ed
#7 by Simon on November 24, 2009 - 1:54 pm
Bahahaha that’s so awesome.
#8 by baltaz on June 22, 2010 - 8:09 pm
Nice job!
I’m not even going to ask “Why PHP???” (you probably did it for fun / the challenge), but I gotta give you credit for getting this done in PHP!
#9 by JC on June 22, 2010 - 10:56 pm
Nice work. Instead of random cities after every refresh, can you make a static city? What about roads? Send me an email if you can, as we would like to talk more about this with you.
#10 by alpaton on March 10, 2012 - 9:47 pm
good work. i will use this for my browsergame, if you allow