Original Post
I'm certain influence maps will be useful in the game I'm working on, but I don't have much experience with them so I'd like to mine this forum for some tips... The game world is tile based and about 256 tiles wide and tall. One problem I'm going to solve with an influence map is this: an AI entity needs to decide where to build his house. This is what I have in mind: I will define the influence map as a byte array in two dimensions. The map is populated by iterating through all the map features that factor in, such as buildings, terrain etc. and incrementing the map in a radius of maybe 10 tiles from each map feature. The question is: how do I work with the data? The AI entity wants to build his house on the highest scoring tile, but, if it's unusable (maybe someone is standing there) he wants the second highest scoring tile. But iterating through the whole map to find the best tile would be wasteful, so what is the best approach of storing the influence map 'results'? Should I use a kind of high-score sorted list for this? Suppose I use the high-score list. Another problem then, is how to update the map after a new building has been placed. The most efficient way is to just update the tile positions that are affected rather than recomputing everything. But the high-score list would then be affected also. Is there a smarter way than iterating through the map and recompiling the high score list? Thank you...