Wednesday, July 24, 2013

Creature behavior components

Planning on doing creature behaviors via a System in my entity-component system that manages various possibly-conflicting emotional states.  For example:

Fear of X: The creature will avoid being near X.  Fear should be influenced by a creature's HP, as well as seeing the damage output of X.  If the player is dealing a large amount of damage, a creature should become afraid even if it's not being directly attacked.  Fear should decrease over time to its default value.

Hatred of X: The creature will attack X.  All enemy creatures should start with this.  Dealing damage to a creature should increase its hatred - this allows for non-hostile creatures to become hostile if attacked.  Hatred should decrease over time to its default value.

Fear and Hatred will combine differently depending on the combat capabilities of the creature.  A creature with only melee attacks will not engage in combat if its Fear is too great, while a ranged creature may be able to stay far enough away to satisfy its Fear but still able to attack.


Tuesday, July 23, 2013

World Map Generation Ideas #1

Inspired by Voronoi diagrams, especially the usage here.



What I'm thinking of for world generation:
  1. Generate a semi-random set of points in the region.  Distribution should be pretty even, so probably start with a hexagonal grid and then perturb each point slightly.
  2. Generate the Voronoi diagram of those points.  I need a good library for this, or need to write one.  These regions will define the areas that the player can move between.
  3. Generate a random heightmap.  This should use Perlin noise or something to make pretty smooth transitions.  Should also weight by subtracting the distance from the center, or some other metric to give me an island.
  4. Determine biomes (desert, forest, plains) based on height and adjacent regions.
  5. Generate map features - castles, towns, lakes, rivers, dungeons.  This one is gonna be really complex, and worthy of its own discussion later.