sploreg / goap Goto Github PK
View Code? Open in Web Editor NEWGoal Oriented Action Planning AI in Unity
License: MIT License
Goal Oriented Action Planning AI in Unity
License: MIT License
Thank you for the great examples! I am building a Rimworld/Prison Architect type game and GOAP is just what I was needing.
// if the key exists in the current state, update the Value
bool exists = false;
foreach (KeyValuePair<string,object> s in state) {
if (s.Equals(change)) { // <-- problem?
exists = true;
break;
}
}
am I missing something? This appears to be comparing whole KVPs, not just the keys.
if (s.Key.Equals(change.Key)) {
appears to work.
I see in line 135 of GoapAgent.cs as shown below code, but there is else condition at 170 which solves a similar problem. can you explain in which condition this is needed?
if (!hasActionPlan()) { // no actions to perform Debug.Log("<color=red>Done actions</color>"); fsm.popState(); fsm.pushState(idleState); dataProvider.actionsFinished(); return; }
I would suggest going backwards makes more sense when pathfinding to endState.
https://github.com/sploreg/goap/blob/master/Assets/Standard%20Assets/Scripts/AI/GOAP/GoapPlanner.cs#L93
That way you give the AI a higher chance of finding a solution that works instead of a predefined set of actions that give you the result.
In other words, you should match endState
with postEffects
and the action's postEffects
with next actions preConditions
or existing startState
.
endState
-> postEffects
-> preConditions
/startState
Though you want to make sure to always check against the startState
for every action because you could end the planning earlier since it might just be sufficient enough from where you are.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.