- Home /
Managing thousands of entities (for an RTS-like game)?
Greetings. I'm trying to set up a grid for something like an RTS I'm trying to develop. Thing is, we know Unity has got a limit on the about of GameObjects it can support, so using GameObjects for the terrain tiles is impossible - I shall be needing large game boards with sizes of potentially 500x500 tiles, and maybe even more.
This made me look at the LineRenderer as a possible solution, but I seem to be failing at the first step there, experiencing the same problems as this user from a long time ago. And even if I'd managed to do that, I've got no idea how I would have tackled tracking the thousands of units (and probably terrain types) meant to occupy these tiles.
In any case, what I am wondering is what the best way to do this is. GameObjects are out of the equation; and the LineRenderer doesn't look good. Please, dear Unity experts, help me out.
Oh, and, if it isn't completely obvious, I'm using the Unity Indie version.
Thanks in advance for your time and for helping me out in my time of need.
Answer by dorpeleg · Nov 11, 2013 at 03:36 PM
Just have one big plane made of 500x500 quads.
Then, using a script, you can change the UV's for each quad (as long as all your "terrain types" are in one big atlas (similar to minecraft, only flat).
There is no game that hold thousands of units, unless they are groups and in that case, every group will be a game object.
Thank you. Now, this would be a perfect solution if:
I can get the UVs for each quad after changing them. Can I do that? I need to know what terrain type is currently in use after all.
I can procedurally generate the mesh, because I'd like to use game boards of variable sizes. I am guessing that this is possible. Is it really?
It should be possible to get the UVs of each quad. Getting the UVs after changing might be a bit hard (but I think possible). You might want to think about storing each quads info (UVs or whatever) during the creation and not after.
Procedurally generated mesh is defiantly possible and also not very hard once you get the hang of it.
Fantastic. I'll go along with this approach then, and hopefully I'll manage not to screw up. Thanks a lot for the information.
Your answer
Follow this Question
Related Questions
Transform does not move GameObject 1 Answer
Modular hexagon terrain 0 Answers
Grid Increment by Rotation 2 Answers
Creating an Object with a string C#! How? 1 Answer
Change mesh to to GameObject 1 Answer