# How can I create tiles that scale to multiple resolutions?

I am trying to create a multiplayer version of the popular Flash game N in Java. However, I'm not sure how to create a tileset that will scale up. Are the tiles for N pre-drawn or are they defined with mathamatical formulas in code?

I do see how they would scale up in Flash if they were pre-rendered. So if anyone has any ideas how I should go about creating the tileset, or how they are created in the game please let me know.

You can check out the game here.

• Doesn't really matter how they did it, it matters how you want to do it in your game. Asking "How to make tilesets using formulas" would be a better question for the site than this one. Mar 28, 2012 at 14:21
• Agreed; I tweaked the question title and content a bit to be a little more in-line with what I think you were actually asking anyhow.
– user1430
Mar 28, 2012 at 15:12

The creator of N actually put together a few tutorials explaining a little of the technology they used.

Tutorial A is about the collision detection used (separating axis theorem) but may be useful to you.

http://www.metanetsoftware.com/technique/tutorialA.html

Tutorial B explains more about the tile shapes used and from the looks of it, they are just a tileset. Some sample source code can be found at the bottom of the page.

http://www.metanetsoftware.com/technique/tutorialB.html

If you want to create tilesets that scale to many resolutions, you can look into creating your tiles from a vector graphics format (like SVG, which you did tag your original question with) rather than a raster format like PNG, et cetera.

You can, at load time (or possibly as a build step if you have a fixed set of known resolutions), load the vector graphics data, create geometry for it using your rendering API, and render out the tileset to a texture which then you can then use in your game as you would any normal tileset -- this way you save yourself the cost of re-rendering a bunch of tile geometry that likely never changes.

This also has the advantage of allowing you to use both pre-defined tiles in SVG and tiles that you design mathematically via some formula or script for procedurally generating them -- the script or formula just needs to produce the same style of point/triangle/whatever data that you're feeding to the tileset pre-renderer from SVG. Or, if you'd like to do just eschew pre-defined tiles entirely you can build them all procedurally.

As Byte56 commented, even though you are attempting to create a game in the style of another, you don't have to do things exactly the same way that game did, so long as it looks and functions similarly enough for your needs, any technique is appropriate.

There are a few questions on SO about rendering SVG (more if you hit up your favorite search engine).