Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Critter combined tree #113

Draft
wants to merge 10 commits into
base: develop
Choose a base branch
from
134 changes: 134 additions & 0 deletions assets/behaviors/creatures/combinedCritter.behavior
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
selector: [
{
guard: { // Implementation of territorial Critter

// For DistanceSquared is A System Needed
// Orientation in "LocationChangedSystem"

// Looks for a Territory Existing
componentPresent: "Behaviours:Territory", // Needs Component
values: [
"N Territory exists"
],

child: {
selector: [
{

//Is the Territory still in Range?
guard: {
componentPresent: "Behaviors:Territory", // Needs Component! (Include in Territory)
values: [
"V distanceSquared < maxDistance"
],

child: {
selector: [
{
// Checks for an Player in Range
guard: {
componentPresent: "Behaviours:FindNearbyPlayers", // Only for Players or for Nemesis aswell?
values: [
"N charactersWithinRange nonEmpty"
],

// If there is a Player in Range we get hostile -> Has to be changed for Nemesis?
child: {
sequence: [
set_target_nearby_player, // Could be for Nemesis aswell?
{
"lookup": {
tree: "Behaviors:hostile"
}
}
]
}
}

}
]
}
}
},
//
{ // Back up sequence for when out of territory
sequence: [
set_target_territory,
move_to
]
}
]
}
}
},
// First Guard fo Selector for Territory End.
{
guard: { // Implementation of scared Critter

componentPresent: "Behaviors:FindNearbyNemesis",
values: ["N nemesisWithinRange nonEmpty"],

child: {
sequence: [

{ sleep: {time: 0.1f }},
"flee_from_nemesis",
{ lookup: {tree: "Behaviors:flee" }}

]
}
}
},

/**
Here would be Implementation for Base Needs

ToDO
For now not implemented
Hungry, Thirsty, Sleep -> Metal Renagade (Citizens)
Got Hurt -> Deer behaviour
*/

//Implementation Start for Aggressive Critter
{
guard: {

//Checking if Critter is Hungry and Prey is around
componentPresent: "Behaviors:FindNearbyEntity", // Implementation ??? // Could Be Nemesis aswell? Else another Component?
values: ["H hungerEntity < 25"],

child: {
lookup: {tree: "Behaviours: aggressiveCritter"}
}
}
},

// Implementation for Friendly Critter
{
guard: {

//Checks if Nearby Player has Item in Hand
componentPresent: "Behaviours:FindNearbyPlayers",
values: [
"N characterWithinRange nonEmpty"
],

child: {
sequence: [
check_luring_item_in_use,
{ sleep: {time: 0.1f}},
followCharacter,
{lookup: {tree: "Behaviors:follow"}}
]
}
}
}, // Furthest Outside Selector

{
lookup: {
tree: "Behaviors:stray"
}
}
]
}
132 changes: 132 additions & 0 deletions docs/AI_Tree_Concepts/Chaser.drawIo
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<mxfile host="65bd71144e">
<diagram id="ajuhjo6TS9aHFvpaHqaE" name="Page-1">
<mxGraphModel dx="1953" dy="1436" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1800" pageHeight="1600" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="25" value="" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=#F5F5F5;fontSize=15;fontColor=#ffffff;fillColor=#60a917;strokeColor=#2D7600;opacity=50;" parent="1" vertex="1">
<mxGeometry x="180" y="260" width="460" height="880" as="geometry"/>
</mxCell>
<mxCell id="30" value="-&amp;gt; get Health Nemesis&lt;br&gt;-&amp;gt; Deal Damage&lt;br&gt;-&amp;gt; animation.&lt;br&gt;return new Health value" style="shape=card;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="190" y="910" width="140" height="170" as="geometry"/>
</mxCell>
<mxCell id="29" value="-&amp;gt; Get Position Nemesis&lt;br&gt;-&amp;gt;Move_Toward Vector?&lt;br&gt;-&amp;gt; return distance between?" style="shape=card;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="430" y="920" width="140" height="150" as="geometry"/>
</mxCell>
<mxCell id="2" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=15;fillColor=#eeeeee;strokeColor=#36393d;" parent="1" vertex="1">
<mxGeometry x="370" y="510" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="3" value="&lt;font style=&quot;font-size: 15px&quot; color=&quot;#000000&quot;&gt;?&lt;/font&gt;" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#ffff88;strokeColor=#36393d;" parent="1" vertex="1">
<mxGeometry x="400" y="290" width="40" height="40" as="geometry"/>
</mxCell>
<mxCell id="4" value="&lt;span style=&quot;font-size: 15px&quot;&gt;Nemesis Visibile?&lt;/span&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="320" y="330" width="200" height="90" as="geometry"/>
</mxCell>
<mxCell id="5" value="Chaser (Wolf)" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" parent="1" vertex="1">
<mxGeometry x="500" y="200" width="140" height="60" as="geometry"/>
</mxCell>
<mxCell id="6" value="" style="shape=flexArrow;endArrow=classic;html=1;fillColor=#050505;gradientColor=#191919;strokeColor=#666666;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="390" y="539.7099999999999" as="sourcePoint"/>
<mxPoint x="450" y="539.7099999999999" as="targetPoint"/>
<Array as="points">
<mxPoint x="410" y="539.7099999999999"/>
<mxPoint x="420" y="539.7099999999999"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="7" value="" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="13" target="8" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="400" y="810" as="sourcePoint"/>
<mxPoint x="540" y="597.9999999999998" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="8" value="Attack" style="ellipse;whiteSpace=wrap;html=1;fontSize=15;fillColor=#fa6800;strokeColor=#C73500;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="240" y="900" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="9" value="" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="5" target="3" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="420.0000000000002" y="410" as="sourcePoint"/>
<mxPoint x="420.0000000000002" y="440" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="10" value="&lt;span style=&quot;font-size: 15px&quot;&gt;Nemesis in Range?&lt;/span&gt;" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="320" y="620" width="200" height="90" as="geometry"/>
</mxCell>
<mxCell id="11" value="" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="13" target="12" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="410" y="810" as="sourcePoint"/>
<mxPoint x="490" y="790" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="12" value="Chase" style="ellipse;whiteSpace=wrap;html=1;fontSize=15;fillColor=#fa6800;strokeColor=#C73500;fontColor=#000000;" parent="1" vertex="1">
<mxGeometry x="480" y="900" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="13" value="" style="rounded=0;whiteSpace=wrap;html=1;fontSize=15;fillColor=#eeeeee;strokeColor=#36393d;" parent="1" vertex="1">
<mxGeometry x="370" y="740" width="100" height="60" as="geometry"/>
</mxCell>
<mxCell id="14" value="" style="shape=flexArrow;endArrow=classic;html=1;fillColor=#050505;gradientColor=#191919;strokeColor=#666666;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="390" y="769.71" as="sourcePoint"/>
<mxPoint x="450" y="769.71" as="targetPoint"/>
<Array as="points">
<mxPoint x="410" y="769.71"/>
<mxPoint x="420" y="769.71"/>
</Array>
</mxGeometry>
</mxCell>
<mxCell id="15" value="" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="4" target="2" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="590" y="330" as="sourcePoint"/>
<mxPoint x="429.9999999999998" y="340" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="16" value="" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="2" target="10" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="429.9999999999998" y="469.9999999999998" as="sourcePoint"/>
<mxPoint x="429.9999999999998" y="519.9999999999998" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="17" value="" style="edgeStyle=none;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="10" target="13" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="429.9999999999998" y="579.9999999999998" as="sourcePoint"/>
<mxPoint x="429.9999999999998" y="629.9999999999998" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="19" value="" style="rounded=0;whiteSpace=wrap;html=1;labelBackgroundColor=#F5F5F5;fontSize=15;fontColor=#333333;fillColor=#f5f5f5;strokeColor=#666666;opacity=50;" parent="1" vertex="1">
<mxGeometry x="640" y="260" width="210" height="110" as="geometry"/>
</mxCell>
<mxCell id="20" value="Stray" style="rounded=0;whiteSpace=wrap;html=1;fontSize=15;" parent="1" vertex="1">
<mxGeometry x="680" y="280" width="120" height="60" as="geometry"/>
</mxCell>
<mxCell id="21" value="Default" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;labelBackgroundColor=#F5F5F5;fontSize=15;fontColor=#000000;opacity=50;" parent="1" vertex="1">
<mxGeometry x="710" y="340" width="60" height="30" as="geometry"/>
</mxCell>
<mxCell id="22" value="" style="edgeStyle=none;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;exitX=0.867;exitY=-0.002;exitDx=0;exitDy=0;exitPerimeter=0;" parent="1" source="25" target="20" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="570" y="300" as="sourcePoint"/>
<mxPoint x="745" y="330" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="23" value="Confi&lt;br&gt;(Nemesis)" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;" parent="1" vertex="1">
<mxGeometry x="210" y="470" width="60" height="90" as="geometry"/>
</mxCell>
<mxCell id="24" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=2;fontSize=15;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="260" y="490" as="sourcePoint"/>
<mxPoint x="420" y="490" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="27" value="Confi&lt;br&gt;(Range)" style="shape=note;whiteSpace=wrap;html=1;backgroundOutline=1;darkOpacity=0.05;" parent="1" vertex="1">
<mxGeometry x="210" y="700" width="60" height="90" as="geometry"/>
</mxCell>
<mxCell id="28" value="" style="endArrow=none;dashed=1;html=1;dashPattern=1 3;strokeWidth=2;fontSize=15;" parent="1" edge="1">
<mxGeometry width="50" height="50" relative="1" as="geometry">
<mxPoint x="260" y="720" as="sourcePoint"/>
<mxPoint x="420" y="720" as="targetPoint"/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>