Advertisement Jump to content
Sign in to follow this  

Unity Sim City style grid structure?

This topic is 2479 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm feeling really naive about this subject and so I figured I would see if you guys could help me.

I'm wanting to create a style of game that features a grid like system much like Sim City, in which there are hundreds of cells in two directions. The game engine I'm currently using is Unity3D, but it really shouldn't have much of an impact.

The way I figured this would be done is to generate these millions of objects in a nested loop, and having a hash table to store references to the objects. The objects would then have to be batched together into larger meshes for rendering so that you're not dealing with millions of draw calls.

The problem I see is how can I take these large combined meshes and figure out which particular cell my raycast hits when I click on a piece of geometry, so I can change the model out, etc, and then recombine the mesh once I'm finished. The other problem I see is... is it inherently bad to have every single cell loaded into memory? That seems like it would be a huge consumer of memory.

How am I thinking about this wrong? So many older games like sim city and diablo and stuff use grid like systems that contain all sorts of information... but how do they do it efficiently?

Please help me feel less stupid!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!