2
\$\begingroup\$

My question is this: How do I make a gamemap from the drawings on my spritesheet?

The tutorial I have followed for making a java 2D game uses this technique to make a gamemap: in photoshop I create a new document with each pixel representing a tile in the game map. Each tile is assigned a unique hexadecimal color value and from there it is a breeze to load the .png file into the game.

However, now that I have a complete map filled with all the basic tiles, it's still a very empty map. I want trees, bushes, flowers on my grass tiles. seaweed, water lilies, driftswood and whatnot on my water tiles. All sorts of scenary that is simply a must to make a simple game map. Many of these "scenery" objects I intend to design bigger than 1 tile (structures, for example). And not necessarily entire tiles either (some will have transparent parts). I'm at a complete loss and don't even know what to expect for an answer.

Am I supposed to draw a tree (with a mass of 8 tiles) as 8 seperate tiles? Am i supposed to draw even larger objects (20x20 warehouses) on top of basic tiles? What I really hope to learn is how the gamemaps have been made in the Pokemon games for gameboy, for instance.

My current thoughts are to design a new class in my projects resembling the Tile class, this one Scenary. Like Tile it will contain an array of every single scenary object in the game, each with a unique color code to be represented as a pixel in a .png document. The pixel representing the start-point of the scenary and the individual scenary object should contain information about how to render from its start position.

If not entirely ridiculous this method can't possibly the right way to go. The Scenary class could, unlike the Tile class, have potentially hundreds of objects in its array.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Very unclear to me. What do you mean by layers? What do you mean by gamemap? You want to create a tiled environment? I don't get the part where you say "a pixel is a tile". Could you a bit more precise on what you want to achieve and you have experienced so far? \$\endgroup\$
    – nathan
    Commented Nov 21, 2013 at 19:51
  • \$\begingroup\$ Your method seems okay. RPG Maker takes a similar approach, where you can select and "paint" a group of tiles in one click. Try their software out and see how you like the usability of it. \$\endgroup\$
    – ashes999
    Commented Nov 21, 2013 at 20:22
  • \$\begingroup\$ @nathan "a pixel is a tile" - well I'm looking for a way to actually construct a gamemap or level or what u want to call it with the "pieces" on my spritesheet. I do this, in another document, by using a specific colored pixel to represent to a specific tile (8x8 pixels) on the spritesheet. And I'm looking to modify that tactic to also design the scenary of a map in a more efficient manner than hardcoding it (nearly impossible). \$\endgroup\$ Commented Nov 21, 2013 at 20:46
  • \$\begingroup\$ @ashes999 I really, really can't figure out what this software is actually offering me. There is no presentation except for the common consumer "Make your own game, no programming, easy2use, blablabla" How on earth to I encorporate this tool with my code? Keep in mind that my goal is to learn coding, not creating a game. \$\endgroup\$ Commented Nov 21, 2013 at 22:07
  • \$\begingroup\$ @user2651804 I don't mean download it as a tool. Download it to see how someone else who had the same problem as you solved that problem. They have two things: tiles (graphics) and separate per-tile data on whether it's solid or not. Give it a try. \$\endgroup\$
    – ashes999
    Commented Nov 21, 2013 at 22:33

2 Answers 2

2
\$\begingroup\$

Using a bitmap as map format where one pixel is one tile might be a quick hack to substitute a proper map editor, but when your maps become more complex (multiple layers, objects, zones, map properties etc.), you will soon feel the need for a proper WYSIWYG editor. You could either develop such an editor yourself which reuses your graphic engine and exports into your own map format, or you could use an existing editor and adopt its map format. Unless you have some really exotic requirements for map editing I would recommend you to do the latter - it will save you lots of time. I can recommend Tiled.

Large objects like warehouses are usually made of modular tiles which fit together in different ways. Here is a town tileset I made for the open source game The Mana World and here is a screenshot of it in action. As you can see the building tiles can be combined in different ways to form large or small buildings.

When we developed The Mana World, our graphic engine used three layers:

  • Ground (drawn before drawing the sprites)
  • Fringe (drawn together with the sprites in order of y-coordinate)
  • Over (drawn after the sprites)

A 3x2 tile tree consisted of 6 tiles, two on each layer, to make sure they overlap the players properly when they stand in front or behind them. Later we added support for "oversized tiles" on the fringe layer: Tiles with the normal width but several tiles high. This was mostly for the convenience of our mappers, because they could now place a tree with two clicks on one layer instead of six clicks on three. This improved productivity and greatly reduced the amount of mapping errors. As a side-effect we barely use the over-layer anymore because most map designs can be done using only ground and fringe with oversized tiles.

\$\endgroup\$
1
  • \$\begingroup\$ There are some broken links in this answer. \$\endgroup\$ Commented Jun 10, 2020 at 13:50
0
\$\begingroup\$

from what i can figure from your question here are two possible answers

  • a) draw your objects into a similar tile sheet and assign color values to them. then save them into a new map and just load maps on top of each other. The flaw here of course is that you will have to count individually where each tile'pixel' goes--unless you code your self a simple map editing tool, then you can make the map as one layer by layer and save it as individual layers or even a conglomerate of layers(aka one huge image).
  • b) create your objects separately in their natural format and save their coordinates in your world in a different format. then easily load them up with your map and render them appropriately

Although once your maps start becoming more complex you will face scalability issues. Where you will need to go back and refactor what you have been working with for so long(which sometimes can take more time than if you would have gone with a more flexible solution from the start).

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .