The Spatials V3 devblog 2016-04-04

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

TL;DR: extreme conditions for thirst (passing out), sleep (forced sleep anywhere) and mind (homicidal rampage); social vital with stacking feeling for having a chat; speed controls with active pause; and a developer console with a REPL.

- very low thirst: passing out from time to time
	add logic in thirst system

The extreme effect for lack of thirst is in place. Officers will get dizzy and pass out for some seconds, interrupting everything they are doing. For now there is no health consequences, with that effect having been added to extreme hunger.

- add support for simple time limited feelings that can be handled by the mind system
	so there's no need to bring up a new system for simple stuff
- ChildSystem/Component: add suicideOnParentFailingAspect
- zzzzz effect for sleeping entities
- very low sleep: forced sleep without a bed, adds temp negative feeling at end 

Extreme lack of sleep now puts officers to sleep at a random moment, with a high priority. It makes them regain enough sleep vital to get out of the danger zone, but adds at the same time a negative feeling from having had to sleep without a bed.

- add concept of civ antagonist in civ component, for swapping aggro
- mind going low or too low can force high prio behaviors
	homicidal: when the entity is an aggressor
		need to flip civ temporarily
		at end, give some +mind temp buff
		dev note: trying to make them go chaotic aggressor, makes them match themselves as a valid target
- do not consider a target the last attacker when its current aspect is non-enemy
- stop fleeing from non-enemies

Mind is the vital where all the feelings, negative and positive, have consequences. When an officer gets too low on Mind they will go insane. For now one effect is implemented, and homicidal rampage. It’s actually swaps the civ alignment of the officer entity for 30s to “ChaosEnemy”, a fictional civ that hates everything and is hated by everything else, including other ChaosEnemy. If they manage to survive the onslaught of attacks sure to follow their rage, they calm down and gain a time limited positive feeling.

While developing this feature an interesting bug surfaced. Since the new ChaosEnemy alignment targeted anything that was vulnerable, it also made the miserable official target themselves. Suicide was invented!

- add support for stacking feelings, multiply delta by stack size
- vital: social
	conversations add a Chatted feeling, also increase social bar
	too low social gives a negative feeling
Social chats

Another vital has been implemented, Social. Entities with this vital will try to chat to other (neutral or higher) Social entities around them. This will make the vital go up, and give them a stacking positive feeling. Too little interaction and they will get a negative feeling.

- test speed controls, including pause
	allows for examination but actions have problems
		info selection requires active World to draw reticle, for example
		building tools require active World to draw cursors, for example
- active pause
	propagate a pause flag to ::tick() in the model logic
	it makes the game logic skip most of its processing
	it is passed to World:process(ticks, pause), which only runs systems with the onPause flag
		base DisplaySystem sets it true by default
	-> still not perfect (check building tool) but much better
- fix main menu pause under new pause system
- global key binding toggle for pause-vs-last-speed
Simulation speed controls

One of the most requested features is here! V3 not only has gained speed controls (5x is just a test value for now), it’s also possible to pause the game and still interact with it (what I call “active pause”). It’s not perfect, but some bugs have already been fixed, and from now on new features will be developed keeping active pause in mind. This will also help with V3 combat, allowing to pause and give new orders.

- output log to file (output.txt in writable folder)
- developer console
	keep a backlog of 1000 log lines
	shell has hotkey that shows the scrolling console
	console has efficient incremental display, is live updated when shown
	make hotkey an user option
	add REPL prompt with history and private environment
Scheme REPL and developer console

To help with current development and for future modders two new technical features have been implemented. The game will now output its log to an output.txt file in the writable folder (this is where the save files go). It will be very useful to catch Scheme errors in mods.

And to make it even easier there’s now an in-game console with the same log contents. On top of that the console has a REPL prompt, which allows to input a one line Scheme expression and evaluate it. It’s useful for poking the state of the running game and even for changing it, like spawning entities.