The Spatials V3 devblog 2015-11-30

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

TL;DR: new civ logos and portraits have been added, working with simplified entities in offscreen planets is now standarized, and an attrition model for player built objects on planets has been implemented.

- new civ portraits
	include in civ model
	use in planet dialog
- logos for new civs

Civilizations and reputation will play a more important role in V3. This past week saw new graphical resources to complement this gameplay area. All civs now have a series of “emotion” portraits to match the player reputation (and later to be used in planet events), plus a more elaborated logo.

- re-sanitize travel
	don't allow travel while exploring (introduce status icon in ship avatar)
	don't allow empty ships to travel

Ship travel has been in debug mode for months, and the sanity checks have been enabled again. New gameplay rules will surface later on.

- need to be able to dynamically work with player built stuff on planets, even when those are offscreen
	when offscreen the per-planet ECS world does not exist, to save huge amounts of CPU and RAM (100+ planets!)
	all player planet-built entities get an offscreen lightweight representation ("offscren-pids")
	other data that corresponds with offscreen objects must reference their pid
	code working with that data must check the status of the pids
		this enables the attrition system
	change the offscreen planet extraction and storage systems to check pid liveness
	all of this happens on a ~3s phase

A central part of planet gameplay in V3 is allowing the player to build persistent objects in planet surfaces. This is easily enabled thanks to the flexibiblity of the new ECS system. But it is not possible to keep a full ECS world for every planet in the galaxy, it would be a waste of RAM and CPU.

In order to allow those objects to retain some level of logic a very light object model has been implemented. It allows for persisting objects to expose a few properties and also to destroy them offscreen. The existing ad-hoc offscreen extraction system was then ported to the new system.

- attrition system: destroys player built objects on planets
	when planet civ rep is hostile or worse
	affects all objects
	for now absolute chance of destroy, change to hit points once combat is implemented
	fix: handle offscreen destroyed objects during planet gen (s7 quirk: deleted hash table entries are still there with a #f value)
	when storage capacity exceeds store (because of storage being destroyed), randomly remove some stock
- attrition defense system: turrets
	decrease chance of destroying player built objects inside their aoe
	objects get tagged with unique id when the map is onscreen
	offscreen attrition system checks if turret with id is still valid, then decreases chance of destroying objects if within radius 5
	suffers attrition like any other object

The first new user of the offscreen planet logic is the attrition system. Under certain rules it is possible for the player to build objects on planets that are controlled by hostile civs. But this comes at a cost: those objects will suffer attrition damage and eventually will be destroyed. For now destruction is modelled as a coin toss, but after ECS combat is implemented it will be changed to track hit points.

To make this new system more interesting a new planet object was implemented: defensive turrents. This object, when built near other player objects, will decrease the chance of attrition damage and destruction.