I've been working on for the last few weeks... trying to make a grid style world in Pygame.
Terr-aria or Rimworld or Dungeon keeper come to mind, thought I'm trying to do this Map style, or overhead... so Rimworld would likely most closley represent what I'm trying to do.
At game start... a world is created, and it has a list of 'cubes'. Cubes are 32x32 and they are the blocks that make up the grid. From there they can contain 'stuff'.... ie: grass, tree, fire, an npc, etc. I have to imagine Terraria does this similar to this - as it has to keep track of what is in a space.
The entire world is 1000x1000 or 100,000 cubes.
I only want to render around 714 of them at a time - the view window, or camera I guess you would say.
I am having a heck of a time figuring out how to pick out the 714 cubes I should be seeing. I guess it boils down to .... I only want to render the cubes in the camera, but.... still update logic for the surrounding area. Looping 100,000 cubes every game frame seems to be a bit much.
Has anyone done something similar?
My other issue is addressing the cubes... I wasn't sure if on creation they should be given their X, Y co-ordinate,
or should they just be id'd..... 1, 2, 3, etc.
Hoping someone might be able to explain how they would tackle this.