Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
GOAPInterface.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31#pragma once
32#ifndef DVD_AESOP_ACTION_INTERFACE_H_
33#define DVD_AESOP_ACTION_INTERFACE_H_
34
35
36
37//ToDo: Implement our own version to avoid using STD
41
42namespace Divide {
43namespace AI {
44
45using GOAPFact = I32;
46using GOAPValue = bool;
51
52inline const char* GOAPValueName(const GOAPValue val) noexcept {
53 return val ? "true" : "false";
54}
55
56class GOAPGoal : public goap::WorldState {
57 public:
58 GOAPGoal(const Divide::string& name, U32 ID);
59 virtual ~GOAPGoal() = default;
60 GOAPGoal(const GOAPGoal&) = default;
61
62 [[nodiscard]] F32 relevancy() const noexcept { return _relevancy; }
63 void relevancy(const F32 relevancy) noexcept { _relevancy = relevancy; }
64
65 [[nodiscard]] const Divide::string& name() const noexcept { return name_; }
66 [[nodiscard]] virtual bool plan(const GOAPWorldState& worldState, const GOAPActionSet& actionSet);
67
68 [[nodiscard]] const GOAPPlan& getCurrentPlan() const;
69
70 [[nodiscard]] Divide::string getOpenList() const {
71 string ret;
73 return ret;
74 }
75
76 [[nodiscard]] Divide::string getClosedList() const {
77 string ret;
79 return ret;
80 }
81
83
84 protected:
88};
89
91
92} // namespace AI
93} // namespace Divide
94
95#endif //DVD_AESOP_ACTION_INTERFACE_H_
GOAPGoal(const GOAPGoal &)=default
const Divide::string & name() const noexcept
Definition: GOAPInterface.h:65
Divide::string getClosedList() const
Definition: GOAPInterface.h:76
goap::Planner _planner
Definition: GOAPInterface.h:86
void relevancy(const F32 relevancy) noexcept
Definition: GOAPInterface.h:63
F32 relevancy() const noexcept
Definition: GOAPInterface.h:62
virtual ~GOAPGoal()=default
const GOAPPlan & getCurrentPlan() const
virtual bool plan(const GOAPWorldState &worldState, const GOAPActionSet &actionSet)
Divide::string getOpenList() const
Definition: GOAPInterface.h:70
void printOpenList(Divide::string &output) const
Definition: Planner.cpp:39
void printClosedList(Divide::string &output) const
Definition: Planner.cpp:48
bool GOAPValue
Definition: GOAPInterface.h:46
vector< const GOAPAction * > GOAPActionSet
Definition: GOAPInterface.h:49
vector< GOAPGoal > GOAPGoalList
Definition: GOAPInterface.h:90
const char * GOAPValueName(const GOAPValue val) noexcept
Definition: GOAPInterface.h:52
vector< const GOAPAction * > GOAPPlan
Definition: GOAPInterface.h:50
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
int32_t I32
eastl::vector< Type > vector
Definition: Vector.h:42
std::basic_string< char, std::char_traits< char >, dvd_allocator< char > > string
Definition: STLString.h:41
uint32_t U32