Skip to content

Instantly share code, notes, and snippets.

@klaussilveira
Forked from oldmanauz/ExmpleSource.cpp
Created August 21, 2023 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klaussilveira/0a5b2005c1974c363a216155cd869860 to your computer and use it in GitHub Desktop.
Save klaussilveira/0a5b2005c1974c363a216155cd869860 to your computer and use it in GitHub Desktop.
Simple Flecs TD
/**
Copyright <2021> <Lexxicon Studios LLC.>
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**/
#include <vector>
#include "flecs.h"
const int TD_LOG_INFO = 0;
// Define all the components
struct Position
{
float x;
float y;
};
struct Health
{
float current;
};
struct MaxHealth
{
float value;
};
struct Cooldown
{
float remainingTime;
};
struct Attack
{
// flecs::entity_view is a `const` flecs::entity.
// Functionally treat it is a ready only entity.
flecs::entity_view payload;
float cooldown;
};
struct PayloadType{};
struct Damage
{
float amount;
};
struct KnockBack
{
float x;
float y;
};
struct Target
{
flecs::entity_view entity;
};
int main()
{
// Initialise the flecs world
flecs::world ecs;
ecs_tracing_color_enable(false);
// Flecs system that runs every tick
// .kind(flecs::PreFrame) makes the system run in the flecs::PreFrame phase
// As no components are specified in the system query, it matches no entities the flecs::world. "iter.count() == 0"
ecs.system("Tick Printer")
.kind(flecs::PreFrame)
.iter([](flecs::iter& iter)
{
ecs_trace(TD_LOG_INFO, "\n--- Tick[%d] time[%f] ---", iter.world().get_tick(), iter.world_time());
ecs_log_push();
});
// Flecs system that runs every tick
// .kind(flecs::PostFrame) makes the system run in the flecs::PostFrame phase
// As no components are specified in the system query, it matches no entities the flecs::world. "iter.count() == 0"
ecs.system("Post Tick")
.kind(flecs::PostFrame)
.iter([](flecs::iter& iter)
{
ecs_log_pop();
ecs_trace(TD_LOG_INFO, "--- End Tick ---");
});
// Flecs observer that logs creation of new entities
// Triggered when an "IsA" relationship is ADDED to ANY (wildcard) entity
// Triggered by creation of entities from prefabs (approx Line 348 --> "ecs.entity("Creep").scope([&]{" --> onwards)
ecs.observer<>()
.term(flecs::IsA).object(flecs::Wildcard)
.event(flecs::OnAdd)
.each([](flecs::entity e)
{
ecs_trace(TD_LOG_INFO, "New Instance: %s [%s]", e.str().c_str(), e.type().str().c_str());
});
// Flecs observer sets an entities' health
// Triggered when an object has an <MaxHealth> component ios SET AND the entity DOESN'T contain a <Health> component
// Creating 'creep' entities triggers this observer, it sets their current health (in <Health> component) to their max health (in <MaxHealth> component)
ecs.observer<MaxHealth>("Init Health")
.term<Health>().oper(flecs::Not)
.event(flecs::OnSet)
.each([](flecs::entity e, MaxHealth& maxHealth)
{
ecs_trace(TD_LOG_INFO, "Init health for %s to %f", e.str().c_str(), maxHealth.value);
e.set<Health>({maxHealth.value});
});
// Flecs system that updates cooldowns on entities
// The system query collects entities with a <Cooldown , [WILDCARD]> pair
// ".arg(1).object(flecs::Wildcard)" sets the WILDCARD in the pair
// In this code sample, cooldowns are only added to turret attacks in the "Send Attack" system > "e.set<Cooldown, Attack>({attack.cooldown});"
ecs.system<Cooldown>("Tick Cooldown")
.arg(1).object(flecs::Wildcard) // <- Cooldown is actually a pair type with anything
.iter([](flecs::iter& iter, Cooldown* cooldowns)
{
auto obj = iter.term_id(1).object(); // Gets the component that is paired with the <Cooldown> pair (In this code, an <Attack> component)
for(auto i : iter)
{
cooldowns[i].remainingTime -= iter.delta_system_time();
if(cooldowns[i].remainingTime <= 0)
{
ecs_trace(TD_LOG_INFO, "%s<%s> off cooldown", iter.entity(i).str().c_str(), obj.str().c_str());
// Removes the <Cooldown, *> pair from the entity when the <Cooldown>.remainingTime reaches 0
iter.entity(i).remove<Cooldown>(obj);
}
}
});
// Flecs observer that destroys creeps when their health reaches 0
// Triggered when an entity has a <Health> component set
// This observer triggers when the <Health> component is modified by: "it.entity(i).modified<Health>()" in the "Apply Damage" observer
ecs.observer<Health>()
.event(flecs::OnSet)
.each([](flecs::entity e, Health& hp)
{
if(hp.current <= 0)
{
ecs_trace(TD_LOG_INFO, "Killing %s", e.str().c_str());
e.destruct();
}
});
// Flecs system that prints the positions of entities with a <Position> component
ecs.system<Position>()
.each([](flecs::entity e, Position& p)
{
ecs_trace(TD_LOG_INFO, "%s located at [%f, %f]", e.str().c_str(), p.x, p.y);
});
// Flecs observer that applies damage to creeps
// Triggered when an entity has <Health> component set AND <Damage> component set
// Creeps are the only entities that may contain a <Health> and <Damage> component
// NOTE: This obsever will never match a <* , Damage> pair like the Turrets have set
ecs.observer<Health, Damage>("Apply Damage")
.event(flecs::OnSet)
.iter([](flecs::iter it, Health* healths, Damage* damages)
{
if(it.event_id() != it.world().component<Damage>()) // Only preceed if this event was triggered by <Damage> being set NOT <Health> being set
{
return;
}
for(auto i : it)
{
auto e = it.entity(i);
auto maxHealth = e.get<MaxHealth>(); // Gettin the <MaxHealth> component from the entity
healths[i].current -= damages[i].amount;
it.entity(i).modified<Health>(); // Alert flecs that <Health> component is modified. Triggers observer: "ecs.observer<Health>()" above
ecs_trace(TD_LOG_INFO, "Damaged %s for %f %f/%f", e.str().c_str(), damages[i].amount, healths[i].current, maxHealth->value);
}
});
// Flecs observer that Applies Knock Back attack
// Triggered when an entity has <Position> component set AND <KnockBack> component set
// Creeps are the only entities that may contain a <Position> and <KnockBack> component
// NOTE: This obsever will never match a <* , KnockBack> pair like the Turrets have set
ecs.observer<Position, KnockBack>("Apply Knock Back")
.event(flecs::OnSet)
.iter([](flecs::iter it, Position* positions, KnockBack* knockBacks)
{
if(it.event_id() != it.world().component<KnockBack>()) // Only preceed if this event was triggered by <KnockBack> being set NOT <Position> being set
{
return;
}
for(auto i : it)
{
ecs_trace(TD_LOG_INFO, "Knocking %s for [%f,%f]", it.entity(i).str().c_str(), knockBacks[i].x, knockBacks[i].y);
positions[i].x += knockBacks[i].x;
positions[i].y += knockBacks[i].y;
it.entity(i).modified<Position>(); // Alert flecs that <Position> component is modified. Not necessary in current code, but might save some bug fixing later in life.
}
});
// Flecs system sends attacks from turrets
// The system query collects entites that HAVE an <Attack> AND <Target> components AND DONT HAVE a <Cooldown, Attack> pair
// A turret can only attack if their attack is off cooldown. The presence of a <Cooldown,Attack> pair means the turret can't attack.
//
// In the turret prefab definition:
// Turret contains an <Attack> component with variable "flecs::entity_view payload"
// <Attack> component will add one or both of the following pairs (depnding on turret prefab type) to the <Attack> components "payload" variable:
// <PayloadType, Damage> pair
// <PayloadType, KnockBack> pair
ecs.system<Attack, Target>("Send Attack")
.term<Cooldown>().object<Attack>().oper(flecs::Not)
.each([](flecs::entity e, Attack& attack, Target& target)
{
// Is the turrets target entity dead?
if(!target.entity.is_alive())
{
ecs_trace(TD_LOG_INFO, "%s target is dead", e.str().c_str());
e.remove<Target>(); // Removes <Target> component so turret is free to aquire new target
return;
}
ecs_trace(TD_LOG_INFO, "Sending payload from %s to %s", e.str().c_str(), target.entity.str().c_str());
ecs_log_push();
// Iterates through each pair that has been added to the <Attack>.payload entity. The TypeID will contain Pairs of <PayloadType, Damage> or <PayloadType, KnockBack>
attack.payload.each([&](flecs::id TypeID)
{
// Checks if "TypeID" is a Pair WITH <PayloadType>
// In this code, <Damage> or <KnockBack> components will be paired with <PayloadType>
if(TypeID.has_relation(TypeID.world().component<PayloadType>()))
{
// "TypeID" will be a pair of either: <PayloadType, Damage> or <PayloadType, KnockBack>
auto payloadType = TypeID.object(); // Gets the 'object' from a pair. "payloadType" will be either <Damage> or <KnockBack>
ecs_trace(TD_LOG_INFO, "%s", payloadType.str().c_str());
// Send an attack to the turret's target
// Adds a <Damage> or <KnockBack> component (with the turrets damage/knock back amount) to the turrets target entity
//
// Author's comment:
// I then stage the target onto the current stage target.entity.mut(e) basically saying "Any writes to this entity will be queued in the queued that e is using.
// Then I queue a write to the target from the payload onto the target: .set_ptr(payloadType, attack.payload.get(TypeID));
//
// NOTE: ".set_ptr()" not currently documented.
target.entity.mut(e).set_ptr(payloadType, attack.payload.get(TypeID));
}
});
ecs_log_pop();
// Adds a <Cooldown, Attack> pair to the turret entity
// The <Cooldown>.remainingTime is set from Turret entities' <Attack>.cooldown amount. (This is set in the turret prefab definition)
e.set<Cooldown, Attack>({attack.cooldown});
});
// Creates 2 tags, one for each Team
auto TeamOne = ecs.entity("PlayerTeam");
auto TeamTwo = ecs.entity("Creeps");
// Query builder that gets a collection of entities that contain <Position> AND <Health> component AND <TeamTwo> tag
// set(flecs::Self | flecs::SuperSet) matches <TeamTwo> in the base component of a prefab
auto FindAllCreeps = ecs.query_builder<>()
.term<Position>()
.term<Health>()
.term(TeamTwo).set(flecs::Self | flecs::SuperSet)
.build();
// Flecs system finds a target for a turret
// The system query collects entites that have the <Attack> BUT NOT <Target> components AND <TeamOne> tag. Will get a list of turrets without a target.
// A turret can only attack if their attack is off cooldown. The presence of a <Cooldown, Attack> pair means the turret's attack is on cooldown
// ".each([FindAllCreeps](flecs::entity e)" copies the FindAllCreeps query by value into the system.
ecs.system("Find New Targets")
.term<Attack>()
.term<Target>().oper(flecs::Not)
.term(TeamOne)
.each([FindAllCreeps](flecs::entity e)
{
// Iterates all the entities found by the <FindAllCreeps> query
std::vector<flecs::entity> FoundCreeps;
FindAllCreeps.each([&](flecs::entity Creep)
{
FoundCreeps.emplace_back(Creep); // Adds every entity found (creeps) to a list
});
// Exit game if no creeps found
if(FoundCreeps.size() == 0)
{
ecs_trace(TD_LOG_INFO, "%s found no more creeps", e.str().c_str());
e.world().quit(); // Allows ecs.should_quit() to equal true
}else
{
// Get a random creep of type flecs::entity from the "FoundCreeps" list
auto Picked = FoundCreeps[rand() % FoundCreeps.size()];
ecs_trace(TD_LOG_INFO, "%s now targeting %s", e.str().c_str(), Picked.str().c_str());
// Sets turrets target
e.set<Target>({Picked});
}
});
// Defines BaseCreep as prefab
auto BaseCreep = ecs.prefab("BaseCreep")
.add(TeamTwo)
.set_override<Position>({0, 0});
// Defines WeakCreep as prefab based on BaseCreep
auto WeakCreep = ecs.prefab("WeakCreep")
.is_a(BaseCreep)
.set<MaxHealth>({3});
// Defines StrongCreep as prefab based on BaseCreep
auto StrongCreep = ecs.prefab("StrongCreep")
.is_a(BaseCreep)
.set<MaxHealth>({20});
// Defines BaseTurret as prefab
auto BaseTurret = ecs.prefab("TurretBase")
.add(TeamOne);
// Defines FastDamageTurret as prefab based on BaseTurret.
// Attacks with "Damage" payloads. For more explanation, see "Send Attack" function
auto FastDamageTurret = ecs.prefab("FastDamageTurret")
.is_a(BaseTurret)
.set<Attack>({
ecs.entity().set<PayloadType, Damage>({1}),
1});
// Defines MedTeleportTurret as prefab based on BaseTurret
// Attacks with "KnockBack" payloads. For more explanation, see "Send Attack" function
auto MedTeleportTurret = ecs.prefab("MedTeleportTurret")
.is_a(BaseTurret)
.set<Attack>({
ecs.entity().set<PayloadType, KnockBack>({1, 0}),
2});
// Defines SlowSuperTurret as prefab based on BaseTurret
// Attacks with "KnockBack" and "Damage" payloads. For more explanation, see "Send Attack" function
auto SlowSuperTurret = ecs.prefab("SlowSuperTurret")
.is_a(BaseTurret)
.set<Attack>({
ecs.entity().set<PayloadType, KnockBack>({0, 1})
.set<PayloadType, Damage>({5}),
3});
// Creates 3 creeps from prefabs as children of entity "Creep"
// This is done so the log is tidier.
ecs.entity("Creep").scope([&]{
ecs.entity().is_a(WeakCreep);
ecs.entity().is_a(StrongCreep);
ecs.entity().is_a(StrongCreep);
});
// Creates 4 turrets from prefabs as children of entity "Turret"
// This is done so the log is tidier.
ecs.entity("Turret").scope([&]{
ecs.entity().is_a(FastDamageTurret);
ecs.entity().is_a(FastDamageTurret);
ecs.entity().is_a(MedTeleportTurret);
ecs.entity().is_a(SlowSuperTurret);
});
ecs_trace(TD_LOG_INFO, "Begin");
// Run flecs world at 1 FPS
ecs.set_target_fps(1);
while(!ecs.should_quit())
{
ecs.progress(); // Update all the flecs systems
}
ecs_trace(TD_LOG_INFO, "Done");
}
info: scratch.cpp:93: New Instance: Creep.436 [Position,(ChildOf,Creep),(IsA,WeakCreep)]
info: scratch.cpp:101: Init health for Creep.436 to 3.000000
info: scratch.cpp:93: New Instance: Creep.437 [Position,(ChildOf,Creep),(IsA,StrongCreep)]
info: scratch.cpp:101: Init health for Creep.437 to 20.000000
info: scratch.cpp:93: New Instance: Creep.438 [Position,(ChildOf,Creep),(IsA,StrongCreep)]
info: scratch.cpp:101: Init health for Creep.438 to 20.000000
info: scratch.cpp:93: New Instance: Turret.440 [(ChildOf,Turret),(IsA,FastDamageTurret)]
info: scratch.cpp:93: New Instance: Turret.441 [(ChildOf,Turret),(IsA,FastDamageTurret)]
info: scratch.cpp:93: New Instance: Turret.442 [(ChildOf,Turret),(IsA,MedTeleportTurret)]
info: scratch.cpp:93: New Instance: Turret.443 [(ChildOf,Turret),(IsA,SlowSuperTurret)]
info: scratch.cpp:277: Begin
info: scratch.cpp:78:
--- Tick[0] time[1.000000] ---
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:228: Turret.440 now targeting Creep.438
info: | scratch.cpp:228: Turret.441 now targeting Creep.438
info: | scratch.cpp:228: Turret.442 now targeting Creep.437
info: | scratch.cpp:228: Turret.443 now targeting Creep.437
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[1] time[2.031005] ---
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.442 to Creep.437
info: | | scratch.cpp:192: KnockBack
info: | scratch.cpp:185: Sending payload from Turret.443 to Creep.437
info: | | scratch.cpp:192: Damage
info: | | scratch.cpp:192: KnockBack
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 19.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 18.000000/20.000000
info: scratch.cpp:167: Knocking Creep.437 for [1.000000,0.000000]
info: scratch.cpp:152: Damaged Creep.437 for 5.000000 15.000000/20.000000
info: scratch.cpp:167: Knocking Creep.437 for [0.000000,1.000000]
info: scratch.cpp:78:
--- Tick[2] time[3.056674] ---
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [1.000000, 1.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[3] time[4.113907] ---
info: | scratch.cpp:115: Turret.442<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [1.000000, 1.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 17.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 16.000000/20.000000
info: scratch.cpp:78:
--- Tick[4] time[5.158010] ---
info: | scratch.cpp:115: Turret.443<Attack> off cooldown
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [1.000000, 1.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.442 to Creep.437
info: | | scratch.cpp:192: KnockBack
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:167: Knocking Creep.437 for [1.000000,0.000000]
info: scratch.cpp:78:
--- Tick[5] time[6.169840] ---
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [2.000000, 1.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.443 to Creep.437
info: | | scratch.cpp:192: Damage
info: | | scratch.cpp:192: KnockBack
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 15.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 14.000000/20.000000
info: scratch.cpp:152: Damaged Creep.437 for 5.000000 10.000000/20.000000
info: scratch.cpp:167: Knocking Creep.437 for [0.000000,1.000000]
info: scratch.cpp:78:
--- Tick[6] time[7.211511] ---
info: | scratch.cpp:115: Turret.442<Attack> off cooldown
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [2.000000, 2.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[7] time[8.267222] ---
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [2.000000, 2.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.442 to Creep.437
info: | | scratch.cpp:192: KnockBack
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:167: Knocking Creep.437 for [1.000000,0.000000]
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 13.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 12.000000/20.000000
info: scratch.cpp:78:
--- Tick[8] time[9.311009] ---
info: | scratch.cpp:115: Turret.443<Attack> off cooldown
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [3.000000, 2.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[9] time[10.356709] ---
info: | scratch.cpp:115: Turret.442<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [3.000000, 2.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.443 to Creep.437
info: | | scratch.cpp:192: Damage
info: | | scratch.cpp:192: KnockBack
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.437 for 5.000000 5.000000/20.000000
info: scratch.cpp:167: Knocking Creep.437 for [0.000000,1.000000]
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 11.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 10.000000/20.000000
info: scratch.cpp:78:
--- Tick[10] time[11.399392] ---
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [3.000000, 3.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.442 to Creep.437
info: | | scratch.cpp:192: KnockBack
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:167: Knocking Creep.437 for [1.000000,0.000000]
info: scratch.cpp:78:
--- Tick[11] time[12.414394] ---
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [4.000000, 3.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 9.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 8.000000/20.000000
info: scratch.cpp:78:
--- Tick[12] time[13.442084] ---
info: | scratch.cpp:115: Turret.443<Attack> off cooldown
info: | scratch.cpp:115: Turret.442<Attack> off cooldown
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [4.000000, 3.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[13] time[14.486403] ---
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.437 located at [4.000000, 3.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.443 to Creep.437
info: | | scratch.cpp:192: Damage
info: | | scratch.cpp:192: KnockBack
info: | scratch.cpp:185: Sending payload from Turret.442 to Creep.437
info: | | scratch.cpp:192: KnockBack
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.437 for 5.000000 0.000000/20.000000
info: scratch.cpp:127: Killing Creep.437
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 7.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 6.000000/20.000000
info: scratch.cpp:78:
--- Tick[14] time[15.516481] ---
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[15] time[16.546555] ---
info: | scratch.cpp:115: Turret.442<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 5.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 4.000000/20.000000
info: scratch.cpp:78:
--- Tick[16] time[17.591400] ---
info: | scratch.cpp:115: Turret.443<Attack> off cooldown
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:180: Turret.442 target is dead
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[17] time[18.648335] ---
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:180: Turret.443 target is dead
info: | scratch.cpp:228: Turret.442 now targeting Creep.438
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 3.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 2.000000/20.000000
info: scratch.cpp:78:
--- Tick[18] time[19.663305] ---
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.438 located at [0.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.442 to Creep.438
info: | | scratch.cpp:192: KnockBack
info: | scratch.cpp:228: Turret.443 now targeting Creep.436
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:167: Knocking Creep.438 for [1.000000,0.000000]
info: scratch.cpp:78:
--- Tick[19] time[20.704914] ---
info: | scratch.cpp:134: Creep.436 located at [0.000000, 0.000000]
info: | scratch.cpp:134: Creep.438 located at [1.000000, 0.000000]
info: | scratch.cpp:185: Sending payload from Turret.440 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.441 to Creep.438
info: | | scratch.cpp:192: Damage
info: | scratch.cpp:185: Sending payload from Turret.443 to Creep.436
info: | | scratch.cpp:192: Damage
info: | | scratch.cpp:192: KnockBack
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 1.000000/20.000000
info: scratch.cpp:152: Damaged Creep.438 for 1.000000 0.000000/20.000000
info: scratch.cpp:127: Killing Creep.438
info: scratch.cpp:152: Damaged Creep.436 for 5.000000 -2.000000/3.000000
info: scratch.cpp:127: Killing Creep.436
info: scratch.cpp:78:
--- Tick[20] time[21.735649] ---
info: | scratch.cpp:115: Turret.442<Attack> off cooldown
info: | scratch.cpp:115: Turret.440<Attack> off cooldown
info: | scratch.cpp:115: Turret.441<Attack> off cooldown
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[21] time[22.751541] ---
info: | scratch.cpp:180: Turret.442 target is dead
info: | scratch.cpp:180: Turret.440 target is dead
info: | scratch.cpp:180: Turret.441 target is dead
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:78:
--- Tick[22] time[23.796064] ---
info: | scratch.cpp:115: Turret.443<Attack> off cooldown
info: | scratch.cpp:222: Turret.442 found no more creeps
info: | scratch.cpp:222: Turret.440 found no more creeps
info: | scratch.cpp:222: Turret.441 found no more creeps
info: scratch.cpp:86: --- End Tick ---
info: scratch.cpp:283: Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment