Edit: a little searching does help, found the answer I was looking for in this thread.
I have an idea how its done. I would be using arrays. what I was is something like a 1000x1000 pixel chunk. in that chunk I will spawn objects and such. I only want to load the chunk if I am near it (camera view) and remove all objects out of the chunk when I am not near it.
for example:
00000
00000
00000
00000
00000
is my chunk array. from top left to right 0,0 0,1 0,2 0,3 0,4 0,5 next row 1,0 1,1 and so on.
so what I want to do is if camera is in chunk 2,2 in the center of this array, it wall call all objects reaching out to the touching chunks.
now like I said, I have an idea how this works and i could be way off and not even close to how a chunk works. so please tell me, am I close or is there a better method on how this works?