Perception Changes

So, the original design for perception wasn’t too bad, but some aspects required re-thinking when it actually came to implementation: most notably, pings.

The placeholder design of pings didn’t take into account perception. A creature that was pinged would respond instantly via the InterpretPing() method. In order to make pings include the creature’s perception, I originally designed a sort of linear workflow.

• Ping Recieved
• Can I hear this Ping? If Yes, continue. If No, end.
• InterpretAudiblePing()
• Has Creatures behaviour changed as a result of ping? If No, continue. If Yes, end.
• Can I see this Ping? If Yes continue. If No, end.
• Visual Scan (lasts several seconds)
• InterpretVisualPing()

This idea would have worked, for the most part, but it was inelegant and clumsy. What if a creature could see, but couldn’t hear? What if the creature’s behavior changed in response to the noise but they hadn’t taken into account visual feedback?

Additionally, the Visual Scan part plays havoc with the Behavior tree. While I can manage “interruptions” by checking for them with a trywhile loop (that’s what allows creatures to be interrupted by death regardless of what state they’re in), it’s a lot harder to come back from one: the tree doesn’t have any function to ‘remember’ what it was doing before the interuption, so the creatures would have to decide what to do again. This means that a creature interrupted while eating might change behaviors rather than going back to eating. A minor thing, I suppose, but I find it annoying.

So after playing with that for some time, I reverted the code and started over with an entirely different system:

| ----------------------------------------------------------------------------|
|      Ping        |                    Can Hear?                             |
|    Recieved      |          Yes           |              No                 |
|------------------+------------------------+---------------------------------|
|          |  Yes  | InterpretVisualPing()  | Scan() => InterpretVisualPing() |
| Can See? +-------+------------------------+---------------------------------|
|          |  No   | InterpretAudiblePing() | //Do nothing...                 |
|-----------------------------------------------------------------------------|

This system ensures that creature’s will always respond to a ping in some form. So long as it’s within their sight or hearing range, the pings themselves can be both seen and heard.

The advantage of hearing is that pings can be responded to immediately, while sight provides additional information that isn’t encoded into the sound: attack damage, genetic compatibility, that sort of thing, which may cause the creature to adjust it’s response. Combining the two provides both advantages.

To better communicate the creature’s perception of the world, I’ve added a pair of spotlight effects to the selected creature: one for sight (blue) and one for hearing (red). I’m not entirely sold on it yet (may need to make the stuff outside their range less dark), but it looks okay.

Sight (blue) and hearing (red)

Sight (blue) and hearing (red)

Primum specium's hearing range

Primum specium’s hearing range

I’ve also added the Scan behaviour when a creature chooses a food source to approach. Scan doesn’t actually do anything: it’s simply a 4 second Idle with a little radar displayed above their head. Even knowing this though, the pause still makes them seem smarter and more… dignified, I gues? As if they’re thinking through the consequences of their actions (they’re actually writing Harry Potter/Doctor Who crossover fanfic’s in their head. True fact!) and making an informed decision. An informed decision which is still wrong half of the time, but then again I still haven’t fixed all the bugs yet.

I’ll post another post later today about all the other improvements I’ve been making while I procrastinated on perception… check back in another few hours!

Cheers,
Qu

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: