backstory: I have created a simple 64X64 randomly generated tile map for the game I am working. Currently I am dealing with room sizes of 45 X 30 tiles. The games run fine on both of my machines without any significant lag.
When the player reaches the edge of a room it generates another room by destroying all of the tiles in the current room and re-drawing it. I also have each room saved as a long string in another world array. The array based on where the player is will expand as needed and shift the rooms as needed through the array as well.
While I am going to keep this engine for another game I have lined up to work on I have decided that the current project needs to be different. I want to be able to have (within reason) a limitless room. I am trying to figure out how to approach this so that there is simply one room since the npcs in my game will have basic AI but will not be able to go in between rooms by themselves.
1. Would approaching this with figuring out a certain distance from player and creating tiles based on that distance work. Then destroy the tiles that are too far away from the player as the player moves throughout the room? Almlost like a view distance that goes further than the actual view screen otherwise dealing with half tiles could be kind of messy or when the player is halfway in between other tiles. I would likely have it draw tiles the view distance + maybe 2 tiles further out while destroying all other tiles in the room.
2. Would I need to physically make the room in construct huge, or could I just deal with the basic room itself and draw objects and have them move while the player stays stationary. I like this approach and it is something that I have coded in XNA. One of the problems is maintaining NPC position with this method but I think I could overcome that.
Any ideas or input would be greatly appreciated.
Develop games in your browser. Powerful, performant & highly capable.