forked from Fundynamic/RealBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNodeDataTypes.h
195 lines (168 loc) · 6.21 KB
/
NodeDataTypes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/**
* RealBot : Artificial Intelligence
* Version : Work In Progress
* Author : Stefan Hendriks
* Url : http://realbot.bots-united.com
**
* DISCLAIMER
*
* History, Information & Credits:
* RealBot is based partially upon the HPB-Bot Template #3 by Botman
* Thanks to Ditlew (NNBot), Pierre Marie Baty (RACCBOT), Tub (RB AI PR1/2/3)
* Greg Slocum & Shivan (RB V1.0), Botman (HPB-Bot) and Aspirin (JOEBOT). And
* everybody else who helped me with this project.
* Storage of Visibility Table using BITS by Cheesemonster.
*
* Some portions of code are from other bots, special thanks (and credits) go
* to (in no specific order):
*
* Pierre Marie Baty
* Count-Floyd
*
* !! BOTS-UNITED FOREVER !!
*
* This project is open-source, it is protected under the GPL license;
* By using this source-code you agree that you will ALWAYS release the
* source-code with your project.
*
**/
/**
* NODE MACHINE data types
* COPYRIGHTED BY STEFAN HENDRIKS (C)
**/
#ifndef NODEDATATYPES_H
#define NODEDATATYPES_H
// player sizes for path_connection_walkable
#define MAX_JUMPHEIGHT 60 // confirmed // 45 without crouching
#define MAX_FALLHEIGHT 130 // not confirmed (200 is to high, adjusted)
#define MAX_STAIRHEIGHT 18 // confirmed
#define HEAD_HEIGHT 72 // confirmed
#define ORIGIN_HEIGHT 36 // confirmed (?)
#define CROUCHED_HEIGHT 37 // confirmed
#define PLAYER_WIDTH 32 // confirmed (?)
// File version
// Version 1.0
#define FILE_NODE_VER1 1
#define FILE_EXP_VER1 1
// Version 2.0
#define FILE_NODE_VER2 2
#define FILE_EXP_VER2 2
// Node bits (for navigational performance)
#define BIT_LADDER (1 << 0)
#define BIT_WATER (1 << 1)
#define BIT_JUMP (1 << 2)
#define BIT_DUCK (1 << 3)
// Path flags
#define PATH_DANGER 39 // Picked a random number here
#define PATH_CONTACT 37 // w0h00
#define PATH_NONE 32 // - rushing
#define PATH_CAMP 31 // camp path
// Visibility flags
#define VIS_INVALID 96 // BERKED
#define VIS_UNKNOWN 97
#define VIS_VISIBLE 98
#define VIS_BLOCKED 99
// Goal types & info
#define MAX_GOALS 75
// Node types / goal types
#define GOAL_SPAWNCT 1
#define GOAL_SPAWNT 2
#define GOAL_BOMBSPOT 3
#define GOAL_BOMB 4 // updates all the time
#define GOAL_HOSTAGE 5 // updates all the time
#define GOAL_RESCUEZONE 6 // rescue zone (for hostages)
#define GOAL_CONTACT 7 // zones where teams often have contact
#define GOAL_IMPORTANT 8
#define GOAL_VIP 9 // as_ maps VIP starting point
#define GOAL_VIPSAFETY 10 // as_ maps VIP safety zone
#define GOAL_ESCAPEZONE 11 // es_ maps escape zone
#define GOAL_WEAPON 12 // pre-dropped weapons like in awp_map
#define GOAL_NONE 99
// Node costs
#define NODE_DANGER 8192 // Value
#define NODE_DANGER_STEP 0.5 // Step to take to get dangerous
#define NODE_DANGER_DIST 512.0 // Distance
// Node contact costs
#define NODE_CONTACT 8192
#define NODE_CONTACT_STEP 0.2
#define NODE_CONTACT_DIST 128
// Node boundries
#define MAX_NODES 4096
#define MAX_NEIGHBOURS 16
#define NODE_ZONE 45
#define MAX_PATH_NODES MAX_NODES
// Max troubled node connections we remember
#define MAX_TROUBLE 100
// Meridian stuff
#define SIZE_MEREDIAN 256
#define MAP_MAX_SIZE 16384
#define MAX_MEREDIANS MAP_MAX_SIZE / SIZE_MEREDIAN // Size of HL map divided by SIZE of a meridian to evenly spread
#define MAX_NODES_IN_MEREDIANS 120 // EVY: higher number, number of nodes per meredian
//#define MAX_NODES_IN_MEREDIANS 80 // (size meredian / zone (~6) times 2 (surface) , rounded to 80
// A* defines OPEN/CLOSED lists
#define OPEN 1 // open, can still re-evaluate
#define CLOSED 2 // closed, do nothing with it
#define AVAILABLE 3 // available, may open
const unsigned long g_iMaxVisibilityByte = (MAX_NODES * MAX_NODES) / 8;
// doors (doors.cpp) HLSDK
#define SF_DOOR_ROTATE_Y 0
#define SF_DOOR_START_OPEN 1
#define SF_DOOR_ROTATE_BACKWARDS 2
#define SF_DOOR_PASSABLE 8
#define SF_DOOR_ONEWAY 16
#define SF_DOOR_NO_AUTO_RETURN 32
#define SF_DOOR_ROTATE_Z 64
#define SF_DOOR_ROTATE_X 128
#define SF_DOOR_USE_ONLY 256 // door must be opened by player's use button.
#define SF_DOOR_NOMONSTERS 512 // Monster can't open
#define SF_DOOR_SILENT 0x80000000
// Player information on map
typedef struct {
Vector vPrevPos; // Previous Position
int iNode; // Previous Node
}
tPlayer;
// Astar Node informaiton
typedef struct {
int state; // OPEN/CLOSED
double cost; // Cost
double danger;
int parent; // Who opened this node?
}
tNodestar;
// Additional Node Information
typedef struct {
float fDanger[2]; // Danger information (0.0 - no danger, 1.0 dangerous). Indexed per team (T/CT)
float fContact[2]; // How many times have contact with enemy (0.0 none, 1.0 , a lot)
}
tInfoNode;
typedef struct {
int iNodes[MAX_NODES_IN_MEREDIANS];
}
tMeredian;
// Trouble connections
typedef struct {
int iFrom; // From NODE
int iTo; // To NODE
int iTries; // How many times we had trouble with this connection
}
tTrouble;
// Node (stored in RBN file, do not change casually)
typedef struct {
Vector origin; // Node origin
int iNeighbour[MAX_NEIGHBOURS]; // Reachable nodes for this node
int iNodeBits;
}
tNode;
// Goal Node information
typedef struct {
edict_t *pGoalEdict; // edict of goal
int iNode; // index of node attached to it
int iType; // type of goal
int iChecked; // many times checked/visited?
int iBadScore; // bad score for a node (when it seems to be unreachable?)
int index; // the index in the Goals[] array
char name[32]; // name of goal
}
tGoal;
#endif // NODEDATATYPES_H