almightyegg Posted September 14, 2007 Share Posted September 14, 2007 In my game I want it a user to be able to mine for ore...but I have no idea how to make a random map image (with walls and such) AND have ore hidden in random places...which are only revieled when you own the compass and you can only see the map when you own the map...but it still needs to know whether you can move North, South, East, West etc... an example image of a random map might be something like: the dark green is walls, the black is where you can walk and the blue is where you can mine. Can this all be done in PHP??? ps also there would be another square colour which would be the users position.... Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/ Share on other sites More sharing options...
MadTechie Posted September 14, 2007 Share Posted September 14, 2007 Can this all be done in PHP??? yes it can, readup on Image Functions and rand Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348524 Share on other sites More sharing options...
almightyegg Posted September 14, 2007 Author Share Posted September 14, 2007 I was afraid you'd mention GD >.< I've tried downloading it before but I've never gotten it to work Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348533 Share on other sites More sharing options...
almightyegg Posted September 14, 2007 Author Share Posted September 14, 2007 hmmm....GD is confusing.... #!/bin/sh echo " There is no \"configure\" script in this distribution of libpng-1.2.20. Instead, please copy the appropriate makefile for your system from the \"scripts\" directory. Read the INSTALL file for more details. Update, July 2004: you can get a \"configure\" based distribution from the libpng distribution sites. Download the file libpng-1.2.20.tar.gz or libpng-1.2.20.tar.bz2 " it says that when trying to run configure....I hae no idea what to do?!?! can anyone point me in the right direction??? Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348539 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 Is the game in real-time, if so it'll need to use dhtml (js, css & html), otherwise if it's turn based then using the image functions (gd) will be ok but server heavy... However php would be used to generate the play zone... Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348540 Share on other sites More sharing options...
almightyegg Posted September 14, 2007 Author Share Posted September 14, 2007 my game is text based using PHP.... Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348542 Share on other sites More sharing options...
MadTechie Posted September 14, 2007 Share Posted September 14, 2007 on a game i wrote awhile back i created a few static maps for the low level players, after this was working i created the random ones, i assume your creating the same basic thing a MUD (Multi User Dungeon), Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348548 Share on other sites More sharing options...
almightyegg Posted September 14, 2007 Author Share Posted September 14, 2007 erm....If you mean what I think you mean...yes.... It's only a small part of my game though...not all based around this... So how do I download GD?? Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348553 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 What os / server? Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348557 Share on other sites More sharing options...
MadTechie Posted September 14, 2007 Share Posted September 14, 2007 windows or *nix? if *nix then what flavor (version) latest versions are here Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348559 Share on other sites More sharing options...
almightyegg Posted September 14, 2007 Author Share Posted September 14, 2007 hmm...is that my operating system or what my server is run by or what?? if it is my operating system then I'm windows... else wise I don't know Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348562 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 What's your server (is it own or a host?) If own then this should be of help: http://www.libgd.org/FAQ_PHP#How_do_I_get_gd_to_work_with_PHP.3F And you'll probably not need to dl and compile yourself: From 4.3.x, PHP includes its own version of gd, bundled in each PHP release. Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348568 Share on other sites More sharing options...
MadTechie Posted September 14, 2007 Share Posted September 14, 2007 create a file (below) phpinfo(); upload to the server and run, you probably have the GD Lib installed, Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348569 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 Your server is 'Apache/1.3.37 ', so i'm presuming it's a host running a linux os, no phpinfo though... Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348572 Share on other sites More sharing options...
almightyegg Posted September 14, 2007 Author Share Posted September 14, 2007 http://www.lordoftheabyss.com/info.php That's the info that came up Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348575 Share on other sites More sharing options...
MadTechie Posted September 14, 2007 Share Posted September 14, 2007 GD is installed gd GD Support enabled GD Version bundled (2.0.28 compatible) FreeType Support enabled FreeType Linkage with freetype GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348577 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 Yep... http://72.232.76.68/phpinfo.php Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348578 Share on other sites More sharing options...
almightyegg Posted September 14, 2007 Author Share Posted September 14, 2007 so how do I use it? Sorry I'm such a newb...I normally just concentrate on raw PHP :-\ Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348582 Share on other sites More sharing options...
hostfreak Posted September 14, 2007 Share Posted September 14, 2007 http://php.net/gd is a good place to start. Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348587 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 Here's a quikie... <?php header("Content-type: image/png"); $w = 230; $h = 45; $im = ImageCreate($w, $h); $white = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 200, 100, 100); $red = ImageColorAllocate($im, 255, 50, 50); $green = ImageColorAllocate($im, 50, 255, 50); $blue = ImageColorAllocate($im, 50, 50, 255); // DRAW BACKGROUND ImageFilledRectangle($im, 0, 0, $w, $h, $red); ImageFilledRectangle($im, 10, 10, 25, 25, $blue); # Output the image to the browser ImagePng($im); ?> Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348588 Share on other sites More sharing options...
almightyegg Posted September 14, 2007 Author Share Posted September 14, 2007 Wow, there's about 1 billion functions in GD Thanks for all your help guys, just for future reference, when requiring help for GD, do I use PHP help or another board??? Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348592 Share on other sites More sharing options...
MadTechie Posted September 14, 2007 Share Posted September 14, 2007 Use the PHP Help (you may want to add GD in the subject, ie changing colour via GD) Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348598 Share on other sites More sharing options...
phat_hip_prog Posted September 14, 2007 Share Posted September 14, 2007 Thought I might now do a quick tut for my site so here's most basic draw functions and output formats... <?php header("Content-type: image/png"); $w = 230; $h = 45; //$im = ImageCreate($w, $h); $im = imagecreatetruecolor($w, $h); $white = ImageColorAllocate($im, 255,255,255); $black = ImageColorAllocate($im, 200, 100, 100); $red = ImageColorAllocate($im, 255, 50, 50); $green = ImageColorAllocate($im, 50, 255, 50); $blue = ImageColorAllocate($im, 50, 50, 255); // DRAW BACKGROUND ImageFilledRectangle($im, 0, 0, $w, $h, $red); ImageFilledRectangle($im, 10, 10, 25, 25, $blue); # Output the image to the browser ImagePng($im); //imagejpeg($im); //imagewbmp($im); //imagexbm($im); /* bool imagearc ( resource $image, int $cx, int $cy, int $width, int $height, int $start, int $end, int $color ) bool imageellipse ( resource $image, int $cx, int $cy, int $width, int $height, int $color ) bool imagefill ( resource $image, int $x, int $y, int $color ) bool imagefilledarc ( resource $image, int $cx, int $cy, int $width, int $height, int $start, int $end, int $color, int $style ) bool imagefilledellipse ( resource $image, int $cx, int $cy, int $width, int $height, int $color ) bool imagefilledpolygon ( resource $image, array $points, int $num_points, int $color ) bool imagefilledrectangle ( resource $image, int $x1, int $y1, int $x2, int $y2, int $color ) bool imagefilltoborder ( resource $image, int $x, int $y, int $border, int $color ) bool imageline ( resource $image, int $x1, int $y1, int $x2, int $y2, int $color ) bool imagepolygon ( resource $image, array $points, int $num_points, int $color ) bool imagerectangle ( resource $image, int $x1, int $y1, int $x2, int $y2, int $color ) bool imagesetpixel ( resource $image, int $x, int $y, int $color ) */ ?> Quote Link to comment https://forums.phpfreaks.com/topic/69367-solved-odd-question/#findComment-348602 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.