   Tile based game question @ the server level
Tile based game question @ the server levelTwo types of obstructions (Things you can collide with)1) Static - Rock,Wall,Lightposts, (always stay in the same spot)2) Dynamic - Players, npcs (always on the move)Is it better to keep these things in two seperate objects when searching for possible collisions?For example I'm using a dictionary object that represents a zone in my game world.  The dictionary object has a list of both static & dynamic obstructions.  The problem is when I want to just search for players I have to also loop through the static objects, thus increasing the loop time.What do you think?  Seperate them into different tables? One table for static obstructions and one for dynamic obstructions?Luzarius   
  I'm not sure exactly what a "Dictionary" object is - I assume, some sort of associative array.If you have a large world and/or many objects, it's likely that you'll want to arrange objects spatially somehow.The easiest way of doing this is using some kind of block map and then when testing for collisions, only check blocks with overlap with the object.You could choose to make the block 10x10 tiles for instance (Ideally, make it bigger than the biggest object, so that an object can't be in > 4 blocks at once).Then have a list of objects within each block. When an object moves, consider which block(s) it's now in, and update this as necessary.This is inherently pretty scalable because you'll never have to collide-test every object in the world.----Other people will suggest using quadtrees etc, but they are really much more complicated to implement. Go with the simplest solution.Mark   