/*Código do Google Analytics*/

Thursday, July 9, 2009

Creator Tip: How awareness works with buildings



DVDMaster at the official Spore forums has made a discovery about how the awareness system of NPC creatures works with buildings in the adventures. Check the picture above. Numbers 1, 2 and 3 are buildings created separately. As should be expected, most of the creatures on the picture are able to see one another, with exceptions: A can see only B, because the buildings are on the way, for instance. But let's move to another example:



Here the building 4 is only one building, despite having the same shape of the two buildings from the previous example put together. There should be no change, right? Wrong!

Now the creatures B and E can't see the C and D guys, and vice-versa. In fact, C and D can't even see each other, despite being side by side!

DVDMaster has thought of an explanation for that, and his finding has been confirmed by the developers:



Imagine there's an invisible box around each building, and that these boxes actually hide stuff that's behind them or inside them. It would explain why the C and D creatures are practically blind in the case shown.

This happens because the game computes a bounding box that encases each building and uses it to determine awareness. The line-of-sight checkings are expensive, and Spore uses this solution in order to avoid taxing the machine's processor.

This means that if you're planning to build interior spaces, you should create floors, walls and ceilings separately, or any creature put inside it won't be able to interact with objects or other creatures.

5 comments:

David Smelser said...

I like your drawings more than mine (grin).
--DVDMaster

djmegavolt said...

Thanks for that, a real little gem of info, and nice diagrams too. Makes perfect sense.

Bits and Widgets (Gibbinater) said...

Did you know that if you disquise a gate as a building like building 4, then the awareness issue goes away? C and D will be able to see each other like that.

David Smelser said...

Yes using disguised gates fixes some problems (C&D see each other).

But can creates problems in the process:
C&D now see A;
NPCs take paths around building, but often try to walk through disguised gates (this can screw up follow AI rules);
Disguised gates do not animate
The range you can scale buildings and disguised gates are different.

captain cupcake said...

nice theroy