Divide Framework
0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Node.h
Go to the documentation of this file.
1
9
#pragma once
10
11
#include "
Action.h
"
12
#include "
WorldState.h
"
13
14
namespace
Divide
{
15
16
namespace
goap {
17
struct
Node
{
18
static
I32
last_id_
;
// a static that lets us assign incrementing, unique IDs to nodes
19
20
WorldState
ws_
;
// The state of the world at this node.
21
I32
id_
;
// the unique ID of this node
22
I32
parent_id_
;
// the ID of this node's immediate predecessor
23
I32
g_
;
// The A* cost from 'start' to 'here'
24
I32
h_
;
// The estimated remaining cost to 'goal' form 'here'
25
const
Action
*
action_
;
// The action that got us here (for replay purposes)
26
27
Node
() noexcept;
28
Node
(const
WorldState
& state,
I32
g,
I32
h,
I32
parent_id, const
Action
* action);
29
30
// F -- which is simply G+H -- is autocalculated
31
inline
I32
f
() const noexcept {
return
g_
+
h_
; }
32
33
// /**
34
// Less-than operator, needed for keeping Nodes sorted.
35
// @param other the other node to compare against
36
// @return true if this node is less than the other (using F)
37
// */
38
// bool operator<(const Node& other);
39
40
[[nodiscard]]
string
toString
( )
const
;
41
42
};
43
44
bool
operator<
(
const
Node
& lhs,
const
Node
& rhs)
noexcept
;
45
}
//namespace goap
46
}
//namespace Divide
Action.h
WorldState.h
Divide::goap::Action
Definition:
Action.h:15
Node
A node is any point on the path between staring point and ending point (inclusive)
Divide::goap::operator<
bool operator<(const Node &lhs, const Node &rhs) noexcept
Definition:
Node.cpp:27
Divide
Handle console commands that start with a forward slash.
Definition:
AIProcessor.cpp:7
Divide::I32
int32_t I32
Definition:
PlatformDataTypes.h:50
Divide::goap::Node
Definition:
Node.h:17
Divide::goap::Node::action_
const Action * action_
Definition:
Node.h:25
Divide::goap::Node::g_
I32 g_
Definition:
Node.h:23
Divide::goap::Node::id_
I32 id_
Definition:
Node.h:21
Divide::goap::Node::parent_id_
I32 parent_id_
Definition:
Node.h:22
Divide::goap::Node::h_
I32 h_
Definition:
Node.h:24
Divide::goap::Node::Node
Node() noexcept
Definition:
Node.cpp:12
Divide::goap::Node::toString
string toString() const
Definition:
Node.cpp:35
Divide::goap::Node::ws_
WorldState ws_
Definition:
Node.h:20
Divide::goap::Node::f
I32 f() const noexcept
Definition:
Node.h:31
Divide::goap::Node::last_id_
static I32 last_id_
Definition:
Node.h:18
Divide::goap::WorldState
Definition:
WorldState.h:13
Source
AI
ActionInterface
CustomGOAP
Node.h
Generated on Fri May 17 2024 16:59:48 for Divide Framework by
1.9.6