On entering proximity
Second, you can parse your world into grids and quickly check to see which grid section a person is in. That way, when you search for proximity, you only need to search your own grid cell and those immediately around it (to allow for straddling edges). Depending on the size of your city and how many people are in it, this is a massive optimization.
Also, remember to not check for an interaction every frame.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
I do thank you for your reply as it was quite useful. The project moves on... :)
Quote: Original post by TheUnnamable
An idea, but I'm not sure about it: make a grid from your world and store the ID's of folks in the cell where they are. And then check all folks in range in the neighboring cells. Then decide to do anything with them.
Uh... isn't that what I said above?
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
haha jk (sorry InnocuousFox couldn't resist) :P