Devana how a browser game is made

25Sep/103

the grid

The grid is the game's map. I didn't name it "map" because the game will eventually allow users to modify it to such a degree that they will be able to create other types of games in which the term "map" may or not be suitable. So I've named it "grid".

I've also created the install page of the game, where the admin account is created and the grid data is inserted into the database.

The grid data is taken from a png image where each pixel is a grid sector. The color coding is as follows:
blue [RGB: 0, 0, 255] is the blocked type of sector; [water]
green [RGB: 0, 255, 0] is the active sector; [available for building towns, or as I call them, "nodes"]

The grid table has the following columns:
x is the horizontal grid coordinate; on the image it goes from left to right passing through the 0 and imageWidth-1 values;
y is the vertical grid coordinate; on the image it goes from top to bottom passing through the 0 and imageHeight-1 values;

type is the grid sector type identifier;
-> 0 for the blocked type of sector [blue pixels]
-> 1 for the active sector [green pixels]
-> 2 will be for constructed nodes [towns]

id is the image tile identifier if the type is not 2; if the type is 2, then the id is the node id from the nodes table.

And here are the files so far: devanaFiles

Comments (3) Trackbacks (1157)
  1. I’ve tested it.. and it worked just fine with a 100×100 map :)

    Whats next ? ? ? :)

  2. Up next is the map view and the table structure for the nodes (towns).

  3. hello
    i use
    devana_v1-5-3
    and i have problem with this game
    please help me
    at register.php at this line

    if (!$config[3][1]) msg($lang['regClosed']);
    ————-
    when i deleted this line the register file can be open but i cant login
    please help me to start this game
    i waiting for your answer


Leave a comment

(required)

*
= 4 + 5