The Spatials V3 devblog 2015-11-16

Internal development notes, very slightly cleaned up and commented a week later.

TL;DR: the planet surface generator now supports random civ camps, new hand crafted camps have been designed, the reputation manager implementation has started.

In V2 planet surfaces featured enemy or NPC camps, procedurally generated. The algorithm that guided this generator was simple and limited. For V3 we are instead designing the camps by hand. Max has continued this week to create new designs with the graphics he finished last week. Here’s a preview:

- faction/ civs V3 system phase 1
	redefine civ model wrt galaxy
		name, shortname, adjective, base face, emotion faces, icons
	gen for planet: camps
		temporary model/hardcode of camp kinds
		1: run prop gen
		2: run resource node gen
			generate camp
		2.1: run player struct spawns
		3: picking camp areas, the instance camp entity, clearing props
			algo: seed-rand pick N camp kinds, then try to find a highly walkable rect to plant it
				fix: spatial query is not possible for overlaps, since it requires one tick of SpatialIndex
		3.1: populate camp
			problem: cannot spatial query existing ents (too early), walkable bit not set (ImpassableSys not run yet)
				so not possible to respect existing ents
				moving spawn time of previous ents (resource nodes etc.) only shifts the problem
				fix: just force a world tick after certain steps, it's done at loading time after all
				fix: more than one ent by position id (floors)
- add some weighting to camp picker so smaller camps are featured more often (even with repeats)
- different amount of camp spawns for each kind of planet

Another piece of the V3 planet surface generator, the camp spawner, is now place. It first required formalizing camps as entities (already done in the editor mode), expressing resource spawn areas as camps, then solving some practical problems with how the ECS system aggressively defers processing to the future when possible. Camps are now being spawned using the templates created in the editor mode:

- reputation manager
	rep system separate from immutable civ rules
		repurpose existing Reputation class
	dynamic love/neutral/hate vs player
		keep data in Reputation, Civ has default/min/max

In V3 the player will have to deal with the different civilizations in a more complex way. Different actions (attacking them, serving them in the station, etc) will change a reputation score with a particular civilization. This in turn will influence how those civs interact with the player. For example, if you attack the blorg on a planet because you want to build resource extractors, they may become hostile and destroy them when you are not around. The existing reputation system has been enhanced to keep track of this new kind of relationship, and the civs model now has data for the possible reputation values (for example, you can make peace with the pirates but they will never like you enough to visit your station, unless it involves guns and explosions).