Skip to content

Instantly share code, notes, and snippets.

@Lexxicon
Forked from oldmanauz/ExmpleSource.cpp
Created October 24, 2021 20:18
Show Gist options
  • Save Lexxicon/b8b3c2789d1f9af1dcce23289ffb8a04 to your computer and use it in GitHub Desktop.
Save Lexxicon/b8b3c2789d1f9af1dcce23289ffb8a04 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.
**/
// **TODO** code doesn't add <Cooldown> component to <Attack> component, it adds a seperate <Cooldown, Attack> pair. Update comments to reflect this understanding
#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 default flecs::PreFrame pipeline **TODO** is PreFrame a default pipeline?
// 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 default flecs::PostFrame pipeline **TODO** is PostFrame a default pipeline?
// 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 is triggered when ANY entity has an "IsA" relationship set.
// In this code is triggered by 'ecs.entity("Creep").scope([&]{' (approx Line 282 onwards)
// when an entitiy is created from the prefab definitions.
// .kind(flecs::PostFrame) makes the system run in the default flecs::PostFrame pipeline
// As no components are specified in the system query, it matches no entities the flecs::world. "iter.count() == 0"
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 that is triggered when an object has an <MaxHealth> component set BUT 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 runs every tick
// The system query collects all the entities that have a <Cooldown> paired with any component.
// In this code, the <Cooldown> component is added to the <Attack> component in the line "e.set<Cooldown, Attack>({attack.cooldown});" in the "Send Attack" system
// **TODO** is <Cooldown> paired with <Attack> or is <Cooldown> component added to <Attack> component???
// This controls the cooldown between turret attacks
// ".arg(1).object(flecs::Wildcard)" makes the system query only match with <Cooldown> components that HAVE been paired with another component
// System monitors the attach cool downs.
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 entity that is attached with the <Cooldown> 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 component (in this code <Cooldown>) from the <Attack> component
// Leaves the <Attack> attached to the entity
iter.entity(i).remove<Cooldown>(obj);
}
}
});
// Flecs observer that is triggered when an object has an <Health> component set
// This triggers when the <Health> component is modified: "it.entity(i).modified<Health>()" in the "Apply Damage" observer
// Observer destorys an entity when it's health reaches 0
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 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 is triggered when an object has <Health> component set AND <Damage> component set
// Applys damage to an entity. Takes damage amount away from health.
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 a set<Damage>({}) DON'T do anything if set<Health>({});
{
return;
}
for(auto i : it)
{
auto e = it.entity(i);
auto maxHealth = e.get<MaxHealth>();
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 is triggered when an object has <Position> component set AND <KnockBack> component 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 a set<KnockBack>({}) DON'T do anything if set<Position>({});
{
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.
}
});
// Flecs system sends attacks from turrets
// The system query collects entites that have the <Attack> and <Target> components AND <Cooldown> component WITHOUT <Cooldown, Attack> pair
// A turret can only attack if their attack is off cooldown. **TODO** This is expressed by <Attack> component NOT having an attached <Cooldown> component OR NOT HAVEING A <Cooldown,Attack> PAIR
// The <Attack> component is added in the turret prefab below
// When the <Attack> component is set, it creates 1 or 2 entities pairs of type <PayloadType, [KnockBack OR Damage]> in the <Attack>.payload variable
// <PayloadType> is a tag.
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 "Type" 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 the "Type" (TypeID) is a Pair AND has a pair type of <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 **TODO**
// 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));
//
// target.entity is a reference to an entity in the <Target> component. It is the target creep of the turret. "target.entity" is type entity_view which is read only.
// target.entity.mut(e) gets a pointer to entity which the turret is targeting stored in <Target>.entity so it can be modified.
// ** TODO ** research stages: -> "target.entity.mut(e)" is doing: Any writes to this entity will be queued in the queued that e
// "set_ptr" not currently documented.
// "set_ptr(payloadType, attack.payload.get(TypeID));" sets a component of type "payloadType" (<Damage> or <Knockback>) in the target's entity (a creep)
// **TODO** what is "attack.payload.get(TypeID)" doing? Aren't payloadType and attack.payload.get(TypeID) the same?
target.entity.mut(e).set_ptr(payloadType, attack.payload.get(TypeID));
}
});
ecs_log_pop();
// Set a cooldown on the turret attack
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> component, <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. This is expressed by <Cooldown> component NOT having an attached <Attack> component
// ".each([FindAllCreeps](flecs::entity e)" copies the FindAllCreeps 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 vector
});
// 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
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