First notable implementation fragment for game/intelligent agent engine I'd like to show. It is a part of ant hive simulation. It's goal is to serve a playground for some swarm intelligence algorithms. Anyway, I'll need a good performance on large number of interacting agents.
ObjectLocator's purpose is to locate physical objects closest to specified one. It uses a tile array over the two-dimensional "world". The search is done over closest tiles in spiral manner.
Invoked to detect which agents should interact each with other, it notably reduces the closest/fittest agents search time (compared to one-to-one search). This implementation gives real-time performance for over 10000 uniformly spread interacting units (for 200x200 tiles). I may append performance charts later.