#ifndef BLOBS_APP_ASSETS_HPP_
#define BLOBS_APP_ASSETS_HPP_
+#include "../creature/NameGenerator.hpp"
#include "../graphics/AlphaSprite.hpp"
#include "../graphics/ArrayTexture.hpp"
#include "../graphics/Canvas.hpp"
math::GaloisLFSR random;
+ creature::NameGenerator name;
+
struct {
world::Set<world::Resource> resources;
world::Set<world::TileType> tile_types;
std::cout << "moon cycles per year: " << (planet.OrbitalPeriod() / moon.OrbitalPeriod()) << std::endl;
auto blob = new creature::Creature(sim);
- blob->Name("Blob");
+ blob->Name(assets.name.Sequential());
Spawn(*blob, planet);
blob->BuildVAO();
--- /dev/null
+#ifndef BLOBS_CREATURE_NAMEGENERATOR_HPP_
+#define BLOBS_CREATURE_NAMEGENERATOR_HPP_
+
+#include <string>
+
+
+namespace blobs {
+namespace creature {
+
+class NameGenerator {
+
+public:
+ NameGenerator();
+ ~NameGenerator();
+
+public:
+ std::string Sequential();
+
+private:
+ int counter;
+
+};
+
+}
+}
+
+#endif
#include "Creature.hpp"
#include "Genome.hpp"
#include "Memory.hpp"
+#include "NameGenerator.hpp"
#include "Situation.hpp"
#include "Steering.hpp"
#include "../world/TileType.hpp"
#include <algorithm>
+#include <sstream>
#include <glm/gtx/transform.hpp>
#include <iostream>
Creature *a = new Creature(c.GetSimulation());
const Situation &s = c.GetSituation();
// TODO: generate names
- a->Name("Blobby");
+ a->Name(c.GetSimulation().Assets().name.Sequential());
// TODO: mutate
c.GetGenome().Configure(*a);
s.GetPlanet().AddCreature(a);
a->BuildVAO();
Creature *b = new Creature(c.GetSimulation());
- b->Name("Sir Blobalot");
+ b->Name(c.GetSimulation().Assets().name.Sequential());
c.GetGenome().Configure(*b);
s.GetPlanet().AddCreature(b);
b->GetSituation().SetPlanetSurface(
}
+NameGenerator::NameGenerator()
+: counter(0) {
+}
+
+NameGenerator::~NameGenerator() {
+}
+
+std::string NameGenerator::Sequential() {
+ std::stringstream ss;
+ ss << "Blob " << ++counter;
+ return ss.str();
+}
+
+
Situation::Situation()
: planet(nullptr)
, position(0.0)