I am working on a strategy game that uses a tile map consisting of 2D-hexagons. At the moment each tile is a game object, with a material which is determined programatically from a list at the map generation stage. While this works perfectly in terms of the logistics of programming, and the resulting game play, I obviously have a lot of draw calls that I suspect I may need to trim down when I get to finally testing it on the target iOS devices (~50 draw calls at the moment, without much else going on) and even more so when I start adding a bit more polish…but I won’t be in a position to test it on an iOS device for a few months (long story).
Can anyone help suggest any strategies might work for streamlining my game, whilst still preferably maintaining the functionality that comes with having game objects at each tile location to store all the important game info (terrain type, armies present, etc)? Having access to the inspector for each tile has been really helpful during the development phase so far.
I wondered about a few options:
Generating my entire map, and then combining the meshes of all my hexagon tiles, atlasing the patchwork of terrain textures that were programatically defined in the map generation stage. I would then have the problem of how to ‘explore’ the map. Currently I just switch the renderer to ‘enabled’ for a tile when it is explored - can I do this with mesh geometry instead? I imagine it will be a much more complicated process…
Some form of sprite manager? I started reading a thread about SpriteManager, and I wondered whether I may be able to apply something like that since my entire map is made of textures on 2D shapes.
Or anything else that anyone can think of?
Thanks,
Matt
For the record, I posted a similar question in the SpriteManager thread regarding that specific part of this.
It would be best to use the Mesh class to construct the tile map, and use an array to contain the tile info. It’s more complicated to create the mesh construction routines compared to using GameObjects, but if you’re sensible about the framework, it wouldn’t be any more complicated to actually use in your game code. e.g., make an Enabled function where you pass in the x/y array indices, and the appropriate tile would be enabled/disabled in the mesh. You could probably use an existing framework though (not sure about SpriteManager specifically).
Thanks, that sounds like a good option. I will have a look into the Mesh class and see if I can come up with a sensible way to apply it. Out of interest, do you know whether there is typically much of an overhead with numerous unrendered game objects? I appreciate that may a be a bit of a ‘how long is a piece of string’ type question! If it they don’t interact with physics, and don’t contribute to drawcalls, or have anything called in an update routine - then perhaps I could keep them behind the scenes and carry on using them in the game code?
I should add that I am currently using a the basic license, so I don’t have access to the profiler. I intend to upgrade when possible, but large unexpected life expenses have put that on hold for a while.