Game-World Pattern Mining (2013 Archive)
The page is a historical archive of a 2013 description of how pattern mining can be applied to discover movement patterns and behavior patterns in a virtual-avatar Unity3D game world. The ideas sketched here underpinned Shujing Ke's PhD thesis work, performed during this time-frame.
- 1 Simple Game-World Patterns
- 1.1 METHODOLOGY
- 1.2 When I am near Lake [some specific character], my happiness level [generally] increases
- 1.3 When I am near some [any] other character, my novelty goal is [generally] more strongly fulfilled
- 1.4 Leaf blocks and wood blocks are often found near each other
- 1.5 When Bob comes near a battery, Bob often picks up the battery
- 1.6 When Bob comes near a battery, the battery often disappears from my sight
- 1.7 When a character moves from a lower point to a higher point, a ladder object is sometimes involved
Simple Game-World Patterns
This page gathers some relatively simple examples of patterns that we'd like an early version of a pattern miner to be able to mine from an Atomspace built up from the Unity3D game world...
Along with a conceptual description of each pattern, is supposed to be added a formalization of the pattern in Atom syntax, and a discussion of additional concepts/processes that might be desirable to optimally support that pattern.
The methodology being followed on this page is to reduce each pattern to a form that has only ONE free variable, by introducing ancillary concepts or predicates that make any other complexities (that otherwise would require more than one free variable) go away.
This requires some creativity sometimes, but, it seems to be a worthwhile process, in that the ancillary concepts and predicates seem like ones worth having form more general reasons. This seems not a bad heuristic for building in some common-sensical concepts and predicates, i.e.: Build in ones that will make commonplace/commonsense patterns in the world as simple and straightforward as possible!
When I am near Lake [some specific character], my happiness level [generally] increases
This can be expressed as
Implication AtTime Evaluation near I Lake $T AtTime Evaluation SubjectiveMomentIncrease happiness $T
which has only one variable, time…
The ancillary predicate, SubjectiveMomentIncrease, can be defined as
Equivalence AtTime Evaluation SubjectiveMomentIncrease $X $T AtTime Evaluation ScaledIncrease $X subjective_moment_lag subjective_gain $T
Equivalence AtTime Evaluation ScaledIncrease $X scale_value gain_value T AND AtTime Evaluation IsTVStrengthOf $X $S1 T AtTime Evaluation IsTVStrengthOf $X $S2 ExecutionOutput - T scale_value Evaluation FuzzyGreaterThan $S1 $S2 gain_value
- the parameter subjective_moment_lag tells: over how many seconds does something have to increase, to feel subjectively to the agent like "at this moment it's increasing."
- the parameter subjective_gain tells: how much increase does there need to be, for a truth-value increase to feel to the system like an increase?
- the predicate IsTVStrengthOf should be self-explanatory …
- the predicate FuzzyGreaterThan is defined so that, for instance ...
FuzzyGreaterThan x y <s> is f(x-y) where f(infinity) = 1 f(z) = 0 if z<0 f(0) = 0 For z>0, f(z) = tanh(gain_value * z)
When I am near some [any] other character, my novelty goal is [generally] more strongly fulfilled
A straightforward version (with only one variable, time) would be
Implication AtTime ThereExists $Y Inheritance $Y GameWorldCharacter Evaluation near I $Y $T AtTime Evaluation SubjectiveMomentIncrease NoveltyFeeling $T
A simpler version would be
Implication AtTime Evaluation NearCategory GameWorldCharacter $T AtTime Evaluation SubjectiveMomentIncrease NoveltyFeeling $T
Here I have introduced the ancillary predicate NearCategory defined via
Implication AtTime NearCategory $C $T AtTime ThereExists $Y AND Inheritance $Y $C Evaluation near I $Y $T
and also the category GameWorldPerson with obvious semantics.
Leaf blocks and wood blocks are often found near each other
Most straightforward, logic-ish version
A straightforward rendition of this pattern would be:
Implication AND Inheritance $X block Inheritance $X leaf ThereExists $Y AND Evaluation $Y block Evaluation $Y wood Evaluation near $X $Y
A different, complementary approach would be to add a process that auto-creates a concept RegionContains X for common X in the game world.
The semantics would be, e.g.
Equivalence Evaluation RegionContainsCategory $C $R Evaluation Some Implication PhysicalPartLink $X $R Inheritance $X $C
(and this semantics could also be explicitly encoded in the Atomspace via Scheme)
Then the needed pattern looks like
Implication Evaluation RegionContainsCategory LeafBlocks $X ThereExists $Y AND Evaluation RegionContainsCategory WoodBlocks $Y Evaluation Near $X $Y
There could then also be a process that creates RegionContainsCategory X relations pertaining to regions that contain a lot of X (according to some appropriate heuristics -- e.g. the relations could be made for maximal connected regions containing a lot of X)...
The advantage of the region-based approach is that there are going to be fewer interesting regions than blocks, so the search for patterns becomes easier/faster...
It also occurs to me that a simpler version of this pattern would be, merely
AND Evaluation RegionContainsCategory LeafBlocks $X Evaluation RegionContainsCategory WoodBlocks $X
That avoids the nasty ThereExists and has only one variable ... though it relies utterly on the ancillary Region nodes...
I suspect this is the way to go. It's a good illustration about how building up a reasonable domain ontology of concepts, makes the patterns that need to be mined simpler in expression, which makes mining more tractable.
When Bob comes near a battery, Bob often picks up the battery
PredictiveImplication AND Inheritance $X battery Evaluation near $X Bob Evaluation PickUp Bob $X
This one is pretty easy, assuming we have a predicate for PickUp, grounded in observations in the game world....
When Bob comes near a battery, the battery often disappears from my sight
A simple rendition would be
PredictiveImplication AND Inheritance $X battery Evaluation near $X Bob Inheritance $X UnknownLocation
This relies on the ancillary concept UnknownLocation, which we could build in, and which would be defined like
Equivalence Inheritance $X UnknownLocation NOT Evaluation know I Evaluation LocalWorldLocation $X $Y
Implication Evaluation Some TruthValueStrength $X Evaluation know I $X
Here it's assumed that
- Some is a GroundedPredicateNode implementing a fuzzy truth value function
- LocalWorldLocation is a GroundedPredicateNode tied in with the SpaceMap
When a character moves from a lower point to a higher point, a ladder object is sometimes involved
One rendition, with a single variable, would be:
AND Inheritance $X GameWorldCharacter HebbianLink Ladder Evaluation EverydayTimeScaleIncrease ExecutionOutput HeightOf $X
Note that, here, the temporal association is wrapped up in the HebbianLink...
We need the HeightOf predicate, which is simple enough
The predicate EverydayTimeScaleIncrease may be defined via
Equivalence AtTime Evaluation EverydayTimeScaleIncrease $X $T ThereExists $L AND Evaluation EverydayTimeScale $L AtTime Evaluation ScaledIncrease $X $L everyday_timescale_gain $T
where the gain may be 1, and the predicate EverydayTimeScale is a fuzzy time distribution that is True for time-values $L that are on the everyday scale, e.t.
Evaluation EverydayTimeScale $L <1> if $L is between one second and one day Evaluation EverydayTimeScale $L <.001> if $L is one microsecond Evaluation EverydayTimeScale $L <.001> if $L is a decade