16 #include <unordered_map> 19 #include <torchcraft/refcount.h> 20 #include "messages_generated.h" 23 typedef unsigned int uint32_t;
24 typedef unsigned short uint16_t;
83 int32_t health, max_health,
shield, max_shield, energy;
87 int32_t
type, armor, shieldArmor, size;
110 Accelerating = 1ll << 0,
111 Attacking = 1ll << 1,
112 AttackFrame = 1ll << 2,
113 BeingConstructed = 1ll << 3,
114 BeingGathered = 1ll << 4,
115 BeingHealed = 1ll << 5,
119 CarryingGas = 1ll << 9,
120 CarryingMinerals = 1ll << 10,
122 Completed = 1ll << 12,
123 Constructing = 1ll << 13,
124 DefenseMatrixed = 1ll << 14,
125 Detected = 1ll << 15,
126 Ensnared = 1ll << 16,
128 Following = 1ll << 18,
129 GatheringGas = 1ll << 19,
130 GatheringMinerals = 1ll << 20,
131 Hallucination = 1ll << 21,
132 HoldingPosition = 1ll << 22,
134 Interruptible = 1ll << 24,
135 Invincible = 1ll << 25,
136 Irradiated = 1ll << 26,
139 LockedDown = 1ll << 29,
140 Maelstrommed = 1ll << 30,
141 Morphing = 1ll << 31,
143 Parasited = 1ll << 33,
144 Patrolling = 1ll << 34,
147 Repairing = 1ll << 37,
148 Researching = 1ll << 38,
149 Selected = 1ll << 39,
151 StartingAttack = 1ll << 41,
152 Stasised = 1ll << 42,
155 Targetable = 1ll << 45,
156 Training = 1ll << 46,
157 UnderAttack = 1ll << 47,
158 UnderDarkSwarm = 1ll << 48,
159 UnderDisruptionWeb = 1ll << 49,
160 UnderStorm = 1ll << 50,
161 Upgrading = 1ll << 51,
177 Terran_Infantry_Armor = 1ll << 0,
178 Terran_Vehicle_Plating = 1ll << 1,
179 Terran_Ship_Plating = 1ll << 2,
180 Zerg_Carapace = 1ll << 3,
181 Zerg_Flyer_Carapace = 1ll << 4,
182 Protoss_Ground_Armor = 1ll << 5,
183 Protoss_Air_Armor = 1ll << 6,
184 Terran_Infantry_Weapons = 1ll << 7,
185 Terran_Vehicle_Weapons = 1ll << 8,
186 Terran_Ship_Weapons = 1ll << 9,
187 Zerg_Melee_Attacks = 1ll << 10,
188 Zerg_Missile_Attacks = 1ll << 11,
189 Zerg_Flyer_Attacks = 1ll << 12,
190 Protoss_Ground_Weapons = 1ll << 13,
191 Protoss_Air_Weapons = 1ll << 14,
192 Protoss_Plasma_Shields = 1ll << 15,
193 U_238_Shells = 1ll << 16,
194 Ion_Thrusters = 1ll << 17,
195 Titan_Reactor = 1ll << 19,
196 Ocular_Implants = 1ll << 20,
197 Moebius_Reactor = 1ll << 21,
198 Apollo_Reactor = 1ll << 22,
199 Colossus_Reactor = 1ll << 23,
200 Ventral_Sacs = 1ll << 24,
201 Antennae = 1ll << 25,
202 Pneumatized_Carapace = 1ll << 26,
203 Metabolic_Boost = 1ll << 27,
204 Adrenal_Glands = 1ll << 28,
205 Muscular_Augments = 1ll << 29,
206 Grooved_Spines = 1ll << 30,
207 Gamete_Meiosis = 1ll << 31,
208 Metasynaptic_Node = 1ll << 32,
209 Singularity_Charge = 1ll << 33,
210 Leg_Enhancements = 1ll << 34,
211 Scarab_Damage = 1ll << 35,
212 Reaver_Capacity = 1ll << 36,
213 Gravitic_Drive = 1ll << 37,
214 Sensor_Array = 1ll << 38,
215 Gravitic_Boosters = 1ll << 39,
216 Khaydarin_Amulet = 1ll << 40,
217 Apial_Sensors = 1ll << 41,
218 Gravitic_Thrusters = 1ll << 42,
219 Carrier_Capacity = 1ll << 43,
220 Khaydarin_Core = 1ll << 44,
221 Argus_Jewel = 1ll << 47,
222 Argus_Talisman = 1ll << 49,
223 Caduceus_Reactor = 1ll << 51,
224 Chitinous_Plating = 1ll << 52,
225 Anabolic_Synthesis = 1ll << 53,
226 Charon_Boosters = 1ll << 54,
227 Upgrade_60 = 1ll << 60,
231 Terran_Infantry_Armor_2 = 1ll << 0,
232 Terran_Vehicle_Plating_2 = 1ll << 1,
233 Terran_Ship_Plating_2 = 1ll << 2,
234 Terran_Infantry_Weapons_2 = 1ll << 7,
235 Terran_Vehicle_Weapons_2 = 1ll << 8,
236 Terran_Ship_Weapons_2 = 1ll << 9,
237 Zerg_Carapace_2 = 1ll << 3,
238 Zerg_Flyer_Carapace_2 = 1ll << 4,
239 Protoss_Ground_Armor_2 = 1ll << 5,
240 Protoss_Air_Armor_2 = 1ll << 6,
241 Zerg_Melee_Attacks_2 = 1ll << 10,
242 Zerg_Missile_Attacks_2 = 1ll << 11,
243 Zerg_Flyer_Attacks_2 = 1ll << 12,
244 Protoss_Ground_Weapons_2 = 1ll << 13,
245 Protoss_Air_Weapons_2 = 1ll << 14,
246 Protoss_Plasma_Shields_2 = 1ll << 15,
247 Terran_Infantry_Armor_3 = 1ll << 16,
248 Terran_Vehicle_Plating_3 = 1ll << 17,
249 Terran_Ship_Plating_3 = 1ll << 18,
250 Terran_Infantry_Weapons_3 = 1ll << 23,
251 Terran_Vehicle_Weapons_3 = 1ll << 24,
252 Terran_Ship_Weapons_3 = 1ll << 25,
253 Zerg_Carapace_3 = 1ll << 19,
254 Zerg_Flyer_Carapace_3 = 1ll << 20,
255 Protoss_Ground_Armor_3 = 1ll << 21,
256 Protoss_Air_Armor_3 = 1ll << 22,
257 Zerg_Melee_Attacks_3 = 1ll << 26,
258 Zerg_Missile_Attacks_3 = 1ll << 27,
259 Zerg_Flyer_Attacks_3 = 1ll << 28,
260 Protoss_Ground_Weapons_3 = 1ll << 29,
261 Protoss_Air_Weapons_3 = 1ll << 30,
262 Protoss_Plasma_Shields_3 = 1ll << 31,
265 Stim_Packs = 1ll << 0,
267 EMP_Shockwave = 1ll << 2,
268 Spider_Mines = 1ll << 3,
269 Scanner_Sweep = 1ll << 4,
270 Tank_Siege_Mode = 1ll << 5,
271 Defensive_Matrix = 1ll << 6,
272 Irradiate = 1ll << 7,
273 Yamato_Gun = 1ll << 8,
274 Cloaking_Field = 1ll << 9,
275 Personnel_Cloaking = 1ll << 10,
276 Burrowing = 1ll << 11,
277 Infestation = 1ll << 12,
278 Spawn_Broodlings = 1ll << 13,
279 Dark_Swarm = 1ll << 14,
283 Parasite = 1ll << 18,
284 Psionic_Storm = 1ll << 19,
285 Hallucination = 1ll << 20,
287 Stasis_Field = 1ll << 22,
288 Archon_Warp = 1ll << 23,
289 Restoration = 1ll << 24,
290 Disruption_Web = 1ll << 25,
291 Unused_26 = 1ll << 26,
292 Mind_Control = 1ll << 27,
293 Dark_Archon_Meld = 1ll << 28,
294 Feedback = 1ll << 29,
295 Optical_Flare = 1ll << 30,
296 Maelstrom = 1ll << 31,
297 Lurker_Aspect = 1ll << 32,
298 Unused_33 = 1ll << 33,
300 Nuclear_Strike = 1ll << 45,
309 std::unordered_map<int32_t, std::vector<Unit>>
units;
310 std::unordered_map<int32_t, std::vector<Action>>
actions;
326 void filter(int32_t x, int32_t y,
Frame& o)
const;
327 void combine(
const Frame& next_frame);
328 bool getCreepAt(uint32_t x, uint32_t y);
330 flatbuffers::Offset<fbs::Frame> addToFlatBufferBuilder(flatbuffers::FlatBufferBuilder& builder)
const;
331 void readFromFlatBufferTable(
const fbs::Frame& table);
354 return (a.
id < b.
id);
363 std::vector<std::vector<detail::UnitDiff>>
units;
365 std::unordered_map<int32_t, std::vector<Action>>
actions;
373 flatbuffers::Offset<fbs::FrameDiff> addToFlatBufferBuilder(flatbuffers::FlatBufferBuilder& builder)
const;
374 void readFromFlatBufferTable(
const fbs::FrameDiff& fbsFrameDiff);
379 const std::unordered_map<int32_t, std::vector<replayer::Action>>& actions,
380 const std::unordered_map<int32_t, replayer::Resources>& resources,
381 const std::vector<replayer::Bullet>& bullets);
385 std::unordered_map<int32_t, std::vector<replayer::Action>>& actions,
386 std::unordered_map<int32_t, replayer::Resources>& resources,
387 std::vector<replayer::Bullet>& bullets);
int id
Definition: frame.h:340
int32_t visible
Definition: frame.h:86
std::vector< int32_t > order_diffs
Definition: frame.h:344
uint64_t upgrades_level
Definition: frame.h:172
int32_t y
Definition: frame.h:82
std::vector< int32_t > var_diffs
Definition: frame.h:342
Copyright (c) 2015-present, Facebook, Inc.
Definition: openbwprocess.h:17
std::unordered_map< int32_t, std::vector< Unit > > units
Definition: frame.h:309
int32_t used_psi
Definition: frame.h:169
int32_t targetX
Definition: frame.h:71
int32_t groundDmgType
Definition: frame.h:91
int32_t remainingBuildTrainTime
Definition: frame.h:102
int32_t targetId
Definition: frame.h:70
int32_t pixel_size_y
Definition: frame.h:89
int32_t spellCD
Definition: frame.h:104
Frame * add(Frame *frame, FrameDiff *diff)
int32_t shield
Definition: frame.h:83
int reward
Definition: frame.h:315
int reward
Definition: frame.h:370
Upgrades
Definition: frame.h:176
std::vector< int32_t > order_ids
Definition: frame.h:343
int32_t gas
Definition: frame.h:168
UnitCommand command
Definition: frame.h:95
uint64_t techs
Definition: frame.h:173
int32_t type
Definition: frame.h:56
bool orderUnitByiD(const Unit &a, const Unit &b)
Definition: frame.h:353
int32_t pixel_y
Definition: frame.h:88
int is_terminal
Definition: frame.h:316
int32_t extra
Definition: frame.h:72
int32_t uid
Definition: frame.h:50
int32_t groundRange
Definition: frame.h:92
replayer::Unit Unit
Definition: state.h:36
std::vector< int32_t > var_ids
Definition: frame.h:341
int32_t type
Definition: frame.h:87
Frame * frame_undiff(FrameDiff *, Frame *)
int32_t ore
Definition: frame.h:167
void readTail(std::istream &in, std::unordered_map< int32_t, std::vector< replayer::Action >> &actions, std::unordered_map< int32_t, replayer::Resources > &resources, std::vector< replayer::Bullet > &bullets)
std::unordered_map< int32_t, Resources > resources
Definition: frame.h:311
std::istream & operator>>(std::istream &in, Frame &o)
std::unordered_map< int32_t, std::vector< Action > > actions
Definition: frame.h:310
int32_t targetY
Definition: frame.h:71
int32_t aid
Definition: frame.h:51
int32_t playerId
Definition: frame.h:99
FrameDiff frame_diff(Frame &, Frame &)
int32_t frame
Definition: frame.h:68
std::ostream & operator<<(std::ostream &out, const Frame &o)
std::vector< Bullet > bullets
Definition: frame.h:312
replayer::Resources Resources
Definition: state.h:38
replayer::Frame Frame
Definition: state.h:41
int32_t targetX
Definition: frame.h:58
replayer::Bullet Bullet
Definition: state.h:39
int32_t resources
Definition: frame.h:100
int32_t maxCD
Definition: frame.h:84
bool frameEq(Frame *f1, Frame *f2, bool debug=true)
UpgradesLevel
Definition: frame.h:230
std::unordered_map< uint32_t, uint32_t > creep_map
Definition: frame.h:368
Copyright (c) 2015-present, Facebook, Inc.
Definition: refcount.h:23
std::vector< Bullet > bullets
Definition: frame.h:367
Techs
Definition: frame.h:264
bool operator==(const Order &o) const
Definition: frame.h:60
int32_t targetId
Definition: frame.h:57
int32_t type
Definition: frame.h:69
std::vector< int32_t > action
Definition: frame.h:49
std::vector< uint8_t > creep_map
Definition: frame.h:313
Flags
Definition: frame.h:108
int32_t id
Definition: frame.h:82
int32_t y
Definition: frame.h:45
int32_t targetY
Definition: frame.h:58
int32_t first_frame
Definition: frame.h:55
std::vector< std::vector< detail::UnitDiff > > units
Definition: frame.h:363
bool operator==(const UnitCommand &c) const
Definition: frame.h:74
int32_t associatedUnit
Definition: frame.h:105
std::vector< int32_t > pids
Definition: frame.h:362
double velocityY
Definition: frame.h:346
uint64_t upgrades
Definition: frame.h:171
int32_t total_psi
Definition: frame.h:170
std::vector< Order > orders
Definition: frame.h:94
int32_t buildTechUpgradeType
Definition: frame.h:101
int32_t order_size
Definition: frame.h:345
void writeTail(std::ostream &out, const std::unordered_map< int32_t, std::vector< replayer::Action >> &actions, const std::unordered_map< int32_t, replayer::Resources > &resources, const std::vector< replayer::Bullet > &bullets)
int32_t remainingUpgradeResearchTime
Definition: frame.h:103
std::unordered_map< int32_t, Resources > resources
Definition: frame.h:366
int64_t flags
Definition: frame.h:347
uint64_t flags
Definition: frame.h:85
uint32_t width
Definition: frame.h:314
int is_terminal
Definition: frame.h:371
int32_t groundATK
Definition: frame.h:90
replayer::Action Action
Definition: state.h:40
std::unordered_map< int32_t, std::vector< Action > > actions
Definition: frame.h:365
double velocityY
Definition: frame.h:97
int32_t associatedCount
Definition: frame.h:106