Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am working on a game, and need to make a 2d map that isnt based on tiles. An example of something similar to what I want is all those racing games like "bike race" where the map is just somewhat a line. While I have made tile based 2d games before, both using map editors and programming myself, I have no idea where to begin to make a map type like that. Are there any programs that are used to make such maps? If not, how might I go about it? Just draw the line in an image editor, and program objects to go over that image, and then set up collision detection on the line so that players can't go through it?

share|improve this question
What language are you trying to make this game with? – Savlon Mar 13 '13 at 6:05
"Just draw the line in an image editor, and program objects to go over that image, and then set up collision detection on the line so that players can't go through it?" Sure. Does that design meet your requirements? Line segment collision is easy. And writing a tool to author line segments isn't that hard. Do you have a more specific question or are you just suffering from design paralysis? – Tetrad Mar 13 '13 at 7:45

Well usually for something like that I would imagine most people use a polygon based (maybe curves) line (see canvas rider/line rider). That could be made in a vector editor or a custom editor. Then, intersection tests would be performed with your bike/etc and the line under the bike.

And, if you wanted to have a graphical background, simply make the line invisible and just do collision detection while drawing the background instead

share|improve this answer

It's quite simple really. Just store an array of coordinates for the height map. (For instance [x][y] , where X is the offset from the start, and y is the height). You can simulate pretty much any map with that but if you need smooth curves it would require some fiddling with it. I can tell you how if you want to.

share|improve this answer

The big advantage with tiles based map is that it makes collision detection with the world fairly easy: you look at the position and bounds of the object, and if it crosses the boundaries of the tiles it is supposed to be in, there's a collision. In a more complex setting, tiles have walkable and blocked content, in which case you need a little of bit wizardry to detect whether the object tile and the world tile are overlaps to collision. However what you are suggesting is some sort of huge singleton tile map. Instead of a line indicating the world limits, you can use a stencil, with one color walkable and the other blocking. A simple xoring with your object stencils should indicate if a collision happens, and where (handy for sparks). This solution is also valid in a regular tile map. The advantage of a single tile is that graphists can design unique maps, at the cost of a larger memory space used by the map.

Yet another solution is to store the circuit limits as vectorized lines, and use vector calculus to check collisions. This solution is actually compatible with a tile based map, but require some more modeling work to get it right. That's perhaps what you are talking about. The difficult parts are:

  • locate which bits of the map needs to be tested for collision. The main idea is to partition the map in small pieces, and use dichotomic search to locate which parts are relevant. Some popular partitioning algorithms are KD tree, quad tree, and BSP. You will have to figure out a way of doing region selection for some of them. R-tree is another solution, which is build around the idea of region selection, but I think that it's a bit harder to implement.

  • compute the intersection between the map lines and the object. As suggested in another answer, a good solution is to model the object as a set of triangles, and compute the intersection of the lines with each of them. There's plenty of literature on the topic.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.