Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006370
Share on other sites

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);
//..

Link to comment
https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006840
Share on other sites

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 ;)

Link to comment
https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1006997
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/190677-php-game-map/#findComment-1007005
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.