Skip to content

Famous Captains Entities - none alike!

Neofox: floof_mug MMMH, REAL CODE

This RUNS! Playful premises aside, this is a functioning showcase of fennecs principles.

Get comfy, grab a cup of Java CoffeeScript Visual J# whatever, and get your paws dirty playing around in the code! It's good fun!

All .csproj and .cs files are over here on Github!

Premise

Let's reminisce some famous Captains of old and new.

This example will explore what Entities "look" like in your logs or DebuggerDisplay, and what happens when they Despawn, and how they get recycled.

Entity's ToString() method lets us take a quick peek where no human has gone before.

We spawn a unique Entity for each captain; but kirk gets despawned and replaced by The Next Generation (picard). Then we create a bunch more and output to visualize how recycled Entities compare to each other and to give a feeling over how a World counts Generations up when Entities are destroyed.

Recipe

cs
// StarTrek.cs (type declarations at bottom of file)

using fennecs;

Console.OutputEncoding = System.Text.Encoding.UTF8;
if (!Console.IsOutputRedirected) Console.Clear();
Console.WriteLine("Directed by Renard Nimoy.");

var world = new World(1);

var kirk = world.Spawn();
Console.WriteLine($"James Tiberius Kirk, Starfleet identification\n{kirk}");

Console.WriteLine("(Kirk despawned)");
world.Despawn(kirk);

var picard = world.Spawn();
Console.WriteLine($"Jean-Luc Picard, (The Next Generation!) identification\n{picard}");

var janeway = world.Spawn();
Console.WriteLine($"Kathryn Janeway, (New Series!) identification\n{janeway}");
txt
Directed by Renard Nimoy.
James Tiberius Kirk, Starfleet identification
E-00000001:00001 <fennecs.Identity>
(Kirk despawned)
Jean-Luc Picard, (The Next Generation!) identification
E-00000001:00002 <fennecs.Identity>
Kathryn Janeway, (New Series!) identification
E-00000002:00001 <fennecs.Identity>

fennecs is released under the MIT License. Neofox is released under the CC BY-NC-SA 4.0 License.