fantomel Posted February 2, 2010 Share Posted February 2, 2010 Hello i`m trying to build a game from scratch but i`m kinda of lost on the part of creating the map. does anyone has an idea on how to create the map :-)? Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/ Share on other sites More sharing options...
Mchl Posted February 2, 2010 Share Posted February 2, 2010 Generic questions will result in generic answers like the one below: $map = new Map(); You need to provide us with more details as to what are you trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1005588 Share on other sites More sharing options...
fantomel Posted February 3, 2010 Author Share Posted February 3, 2010 Generic questions will result in generic answers like the one below: $map = new Map(); You need to provide us with more details as to what are you trying to do. Sorry i was in hurry yesterday my internet connection at home is down .. and i didn't had time to post the right questions:D sorry again. ok so.. here it goes i`m building a simple browser based game like travian tribalwars ikariam... and i don't have any idea how should i build a map like those games have you can check on devana.eu an example of map i`m not sure what other details should i provide but i will wait for the next reply:-) thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006370 Share on other sites More sharing options...
Andy-H Posted February 3, 2010 Share Posted February 3, 2010 The site you linked too uses AJAX, take a look... http://devana.eu/devana/func.js Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006448 Share on other sites More sharing options...
ignace Posted February 4, 2010 Share Posted February 4, 2010 To create something like http://devana.eu/devana/imgs/map.jpg You would use: create table world_map ( id integer not null auto_increment, tile_image varchar(255), x_coord integer, y_coord integer, primary key (id)); $user_xcoord = $_GET['xcoord']; $user_ycoord = $_GET['ycoord']; // add proper validation so user can not go out-of-bound $user_xcoord_min = $user_xcoord - 2; $user_xcoord_max = $user_xcoord + 2; $user_ycoord_min = $user_ycoord - 2; $user_ycoord_max = $user_ycoord + 2; $query = "SELECT * FROM world_map WHERE (x_coord BETWEEN $user_xcoord_min AND $user_xcoord_max) AND (y_coord BETWEEN $user_ycoord_min AND $user_ycoord_max)"; $result = mysql_query($query); //.. Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006840 Share on other sites More sharing options...
JonnoTheDev Posted February 4, 2010 Share Posted February 4, 2010 You would probably be better creating something like that with Flash if it is in your skillset. Online games are Flash / Shockwave based. Javascript sucks for creating games. Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006849 Share on other sites More sharing options...
Mchl Posted February 4, 2010 Share Posted February 4, 2010 You would probably be better creating something like that with Flash if it is in your skillset. Online games are Flash / Shockwave based. Javascript sucks for creating games. You know all Palm WebOS apps are created in JS? Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006901 Share on other sites More sharing options...
ignace Posted February 4, 2010 Share Posted February 4, 2010 You would probably be better creating something like that with Flash if it is in your skillset. Online games are Flash / Shockwave based. Javascript sucks for creating games. You know all Palm WebOS apps are created in JS? That's why he said games Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006997 Share on other sites More sharing options...
RussellReal Posted February 4, 2010 Share Posted February 4, 2010 use an image map and create the area elements with javascript that would be the simplest alternative.. and flash would be the next easiest, where in flash it would be way easier to moderate whether the land is passable or not flash instructions would be simple, create each possible grid square.. E.G Water Boulder House Grass Sand and then instead of images you compile a list of number values corresponding to the tiles.. then you just send that to flash or to javascript then with javascript send it to flash.. you put the tiles next to eachother building the map, and you add onclick events or whatever. would be easier in the long run to use flash. and would be faster loading of the next map in flash aswell as you'd only be sending numeric values instead of an actual image. Well, anyway hope I helped. Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1007005 Share on other sites More sharing options...
fantomel Posted February 8, 2010 Author Share Posted February 8, 2010 thank you everyone for you replies to this post and for the advices they really helped me out on this part Quote Link to comment https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1008867 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.