- Home /
optimizing game objects - deciding what way to organize my level.
Hi!,
i'm trying to decide how to organize the objects in the game i'm making, i'm building a game similar to prison architect in object complexity and density, but with multiple z-levels (like dwarf fortress)
for those who are not familiar with prison architect, it's basically a big grid where you build stuff and AI agents interact with what you build.
here is a pic http://www.otogami.com/uncroped/01/34/img13412.jpg
I did a bit of research, what i found is that having individual game objects for each tile is too expensive, on the other hand, building and texturing a mesh dynamically is a bit complicated over so many layers of objects (floor with dirt on top with items on top with objects on top) and for some things i will need the physics engine.
I think I come up with a compromise between game objects and meshes that should let me use the best of both worlds, but i wanted to know if this still means having too many game objects or not.
My aproach would be to render all the floor tiles with a mesh, and have AI agents and buildings (walls, doors, beds, etc) as game objects drawn on top of that mesh. would this be feasible considering ultra basic physics (square coliders) ? this is the kind of object density I'm expecting to have, but multiplied by at least 5 z-levels (when viewing one z-level the other objects would not render, but they need to still run their update functions)
https://introversion.co.uk/prisonarchitect/images/screenshots/large/prison-architect-1.jpg
Alternatively, I thought of representing all the objects that dont need physics as structs stored in an array with an update function, and i would iterate over each object in the array executing an update function and drawing it using a Quad (pretty much rolling my own game object system), but i'm not really sure if this would be lighter than using actual game objects.
Any thoughts on how to optimize this are welcome!
Your answer
Follow this Question
Related Questions
Unity 2D TileMap Rule Tile Carpet 1 Answer
Anyone knows how to refresh tiles? 0 Answers
TileMap won't show up in 2d object in heirarchy. 0 Answers
How to store tile data for placing tiles 2 Answers