Great resource

Nov 19, 2010 at 4:49 PM
Edited Nov 19, 2010 at 5:17 PM


I just started trying this out, and wanted to say that it's great! Thanks for making this; I'm sure it'll help a lot of people out, myself included.

I was wondering if you planned on updating it for XNA 4.0. There are only a few changes needed.


I have a couple of suggestions, if you don't mind.

1. There is a line in Layers.cs, in the ConvertMapToLayerViewport method, that is unused:

Size mapDisplaySize = m_map.DisplaySize;

2. The TileArray class seems redundant. I don't understand why you don't just use a standard 2-D array in Layers. All the of the custom defined accessor operations could be defined in Layers directly. The only TileArray member that is even referenced in the custom accessors is just its layer (m_layer) anyway.

3.  You might consider changing the names of some of your classes, so that they don't conflict with class names people might already have or want to use. For example, Location, Rectangle, Layer, Tile, Map, etc, are all common names that people may very well want to use in another context. You could just prefix them all with "x", which would match well with your system name.

Nov 21, 2010 at 2:13 PM


Thanks for your feedback and encouragement! :)

Regarding xTile working on XNA 4.0, there's a discussion going at

As for the other comments:

1) Thanks, just taken care of

2) The TileArray implements a 2D tile indexer that performs a number of checks, including range checking, and validation of assigned tile in terms of size compatibility and also of ensuring that the refered tilesheet actually belongs to the same map structure. I could have worked without it of course but it helped me factor out the code better.

3) I see what you mean and I tend to like your suggested convention. I do however like to work with camel case so starting with a small letter "x" would somewhat contradict that. Having said that, both my system name and also the namespace is "xTile" so I am already breaking the camel case convention there. I'll think about it.


Nov 21, 2010 at 7:42 PM

Great! Thanks for your response.

For #2, I just meant that you could also directly put the array of Tiles as a member in the Layer class, and define accessors that do all the validation/bounds checking etc in there.

I.e. Layer could also be the wrapper for the array, rather than a separate TileArray class. You would just use layer[x][y] instead of layer.Tiles[x][y]. Not a big difference really, just wanted to throw some suggestions out there.