Hiya
We need advice on what parts of 2D Toolkit to use ie best tool for the job advice please:
1. we need to make a tile based level with lots and lots and lots of tiles. Lots of them. It's a big level.
2. we need to be able to render some of the tiles either invisible or just hide them. This would need to also remove any collision within that space for the removed tile.
3. we need to query the kind of tile it is - is it a tile that can be destroyed? This isn't too vital, we could maintain separate lists for destructable tiles and solid tiles.
4. A nice-to have would be to change the image of that tile, for example, progressive damage to it.
That pretty much sums up our total needs. Thanks for any advice.
2d toolkit is going to make this easy ...
The tilemap system is what you need. Basically 2d arrays where each grid location holds a sprite of a particular id, which you can change programmatically. You can have multiple layers, and paint vertex colours (not per layer yet though).
1. Get 2.1 beta 2, and check the tilemap demo included in that, it's fairly sizeable. The editor chunks the resulting meshes to your size specifications, and defaults to a good 'batchable' size for each bit of mesh. If it's so big that you'll need to be streaming meshes in and out, well Unikron can comment on that, and practical limits to the system...
3. Use
GetTile and
GetTileAtPosition to get the ID of the sprite at a tile grid or world location respectively. Then use that ID in
GetTileInfoForTileId to get the structure that holds the metadata. Each tile type (sprite ID) has built-in string, int, float and prefab (no bool) which you set in the editor, under Data tab. The beta 2 demo also shows the use of the prefab system.
2 & 4. The sprite at a particular tile location can be changed to another using
SetTile, and cleared using
ClearTile. Call
Build after all changes are complete. Any changed collide will be automatically rebuilt (so Cleared tiles will have no collide) but I understand collide changes are relatively expensive. Your collision is set up on the sprites themselves in the Sprite Collection editor.
The system can also read in
Tiled .tmx maps if you want to use that editor for some of its advanced auto-edging features, or if you are thinking of procedurally generating maps then some people around here have done that as well.