Saturday, March 20, 2010

Obstacle in range

Used http://stackoverflow.com/questions/1073336/circle-line-collision-detection article as reference for line-circle intersection.

Following code extracts the part of line that is inside a circle:

Fast closest object search

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.

Hello, Collective!

This blog was created to share/track some ideas/implementations from my programming hobby. Other stuff that conquers my attention will also come here. I'll try to keep it updated at least once in a week, to keep track on progress. Any source code published here can be used as freely as you like (doomsday machines excluded).
And yep, I am a MBTI fan, ENTP in nature :)

P.S: Would appreciate a hint to how and where can I host some applets.