Original Post
Hello,
I am currently working on a 2d RPG, with an "open world" concept, therefore I have no loading screens and load/unload maps without the user knowing. As seen in the picture below I have 9 maps loaded at one time, and if the user enters a new map (as in the pic, I unload the bottom and right hand maps and load the respective maps in the top and left side). The green rectangle is the view point of the user (the tiles drawn to the screen) and the blue is representing witch AI-units that are considered active (where I run path finding etc).
[attachment=10051:game_tile_engine.png]
The problem that I am having is in regards to the AI-units, I cant figure out how to handle which are active and which are not, how to load and unload them. For the tiles this problem was easily handled, as the tiles are static and do not move around. So I could just store them in a two 2d-arry. But the AI-units are dynamic and move around, how should I store them?
Having a list of all loaded units (for all 9 maps) is to slow, because that is a rather big list to go through every update to see if the unit should be active or not.
I am developing this game in C#(XNA), how would I approach this in regards to a fast way of finding out witch units should be active? speed is of a higher concern then memory. I have tried to explained all parts as simple as I could, but as I have been working on this for a while I have probably forgot something, if so, just ask!
I am currently working on a 2d RPG, with an "open world" concept, therefore I have no loading screens and load/unload maps without the user knowing. As seen in the picture below I have 9 maps loaded at one time, and if the user enters a new map (as in the pic, I unload the bottom and right hand maps and load the respective maps in the top and left side). The green rectangle is the view point of the user (the tiles drawn to the screen) and the blue is representing witch AI-units that are considered active (where I run path finding etc).
[attachment=10051:game_tile_engine.png]
The problem that I am having is in regards to the AI-units, I cant figure out how to handle which are active and which are not, how to load and unload them. For the tiles this problem was easily handled, as the tiles are static and do not move around. So I could just store them in a two 2d-arry. But the AI-units are dynamic and move around, how should I store them?
Having a list of all loaded units (for all 9 maps) is to slow, because that is a rather big list to go through every update to see if the unit should be active or not.
I am developing this game in C#(XNA), how would I approach this in regards to a fast way of finding out witch units should be active? speed is of a higher concern then memory. I have tried to explained all parts as simple as I could, but as I have been working on this for a while I have probably forgot something, if so, just ask!