2012-11-14

Queries

Queries are not mine idea. I "stole" it from my colleagues at work who got it from other places (that's how I learn about AI most of the times, via other people or recently at conferences).

Queries can be used to find any object or group of objects that match some predefined conditions. For example there can be query to list all doors in room we're currently in and sort them from closet to furthest. There can be query to find all enemies in front of us. There can be query to find anything that scaries us, so we could run away from it.

Query tests all given objects (it can be done for list of objects provided by other system or gather all objects in room, requester is, or do something else) by processing query elements on them.

Query elements can be broken into two categories:
  1. Conditions - if condition is failed, object is no longer considered.
  2. Weights - they do not throw away object, but just add "weight" value that tells how important is given object. It is used to find most interesting of few or sort many of them.
There are also passes. If in first pass no object is found, second pass (with different elements) is done and so on. As many passes as there were created.

I am still extending functionality of queries and more options are coming, but basics are there. It checks type of object, distance to it and wheter it is alive or not and if it is thinking object or not (AI or item basically). And there is two extra elements. Rating and Rating Rules. They work with Tagging and Rating systems and can be used to determine if we're scared of an object, if it is enemy or how much we like something or dislike.

Where querries are used? At the moment just for AI but not only by AI behaviours but also for actions/attacks. Attacks need to have enemy and if it would not be provided by AI, it would be found with query. And due to telegraph and possible enemy movement, target might be no longer valid when actual strike happens. That's why in moment of strike, query is used to verify if enemy is still valid.

No comments:

Post a Comment