Area Effects

Started by
0 comments, last by GameDev.net 17 years, 11 months ago
Trying to revamp the method that i used to represent area effects, zones of influence, ect... in a tiled game. The regions are dynamicly created and moved, and tend to center around characters of the game [like for example, an aura in diablo 2]. General types of influence i'm attempting to support: Increment/pulse influence, where everything in a region is effected at certain time steps. Continuous influence, consider these increment influences with tiny time steps, things that effect everything that occurs within a certain radius of the influence emitter. On/Off influence, something that turns on when something enters an area, and off when it leaves [or the area is removed]. The old way i excecuted this particular effect i was never pleased with, and was a list of effects, and regions that were cycled through for nearly everything. This worked well for small groups with 2 or 3 region effects active at a time, but as the number gets larger, this method falls appart pretty fast. Any ideas on a better way to do this? [i'm thinking i'm just going to be storing each type seperately, and am likely going to have to use the check-everything approach with continuous and on/off influences, but i'm open to ideas]
Advertisement
Instead of checking every object against every area, you should make the areas check for objects within their radius. If areas are relatively small compared to maps, then this will be more effient. All you have to do is to store each object's id at the tile they are staning on, so when an effect wants to effect it's area, it can do the scan. For timed effects, you have to scan at certain intervals, for on-off effects you have to scan on movement near the center of the area (and when the center is moving).

Viktor

This topic is closed to new replies.

Advertisement