Suggested The night is dark and full of terrors


Org Co-Founder & Project Lead
I mentioned this design a while ago and have wanted to post it. Also getting to play a bit with the structure of a solid proposal here meant to eventually produce multiple modules.

Primary module name: NightTerrors
Brief description: Adds things that go bump in the night and might try to eat you if you can't stay safe
Module category: Augmentation (tentative category info here)
Meant to be useful for: Adding survival elements to gameplay, optionally compatible with Wood & Stone, Light & Shadow, and general play (just adds (more) danger for the player or even creatures in general the player might need)

Synopsis: Adds a creature type that only comes out at night / in the dark (extensible with other creature types). Said creatures will shy away from light (day time / torches) but otherwise home in on the player (or any other creature) slowly. Over time the creatures will get more daring and venture into torch-lit areas as long as the player isn't actively looking in its direction. If an obstacle is detected (like a walled shelter) and there is no easy way around it the creatures will claw at the blocks, replacing them with more and more claw-marked blocks, like breaking a block but in slow-motion (possibly over days of in-game time, depending on material). Claw scratching sounds should play appropriately, as should howling noises at night. Creatures despawn at dawn and return again next night until they've been able to sneak up to the player's turned back enough times to kill (might run away after one claw attack). After that they "reset" their aggression level and start from scratch. How long can you survive with one life, clutching a sputtering torch ?

MoSCoW analysis for viable release

  • Creature model. Am thinking the Perdemot model we have on TeraMisc. Needs to be put in a dedicated module and tested to work in-game.
  • Pathfinding setup that'll make the creatures path towards the player slowly at all times, but only move if light values are low
  • AI detection for player vision - if spotted then freeze Weeping Angle style (also see technical note below)
  • Ability for creature to cause slight damage when essentially touching the player (within 1 block's range or so)
  • Main module should track and display some stats, like how many days since last death, how many creatures, etc. Based on time since last death the creature behavior should be updated (more aggressive over time) maybe once a day (base on midnight event?)
  • Play creepy sounds/music at night.
  • Make night darker (again)
  • Pathfinding allowing the creatures to identify obstacles and target them for removal (detect path through solid blocks and attack them if no better path exists)
  • Pathfinding allowing creatures to consider light when determining a path to the player
  • Pathfinding allowing creatures to flee when spotted (path away from player, favoring shadow) instead of freezing in place
  • Add claw-marked blocks and use those to indicate blocks damaged by creatures. Another option would be adding "decals" to existing blocks but that would be a new 3d wizardry feature.
  • Use block material as a quality modifier for how long it takes creatures to damage/destroy a block (force player to make stronger shelters)
  • Add usage of Seasons to vary creature behavior based on season. For instance more aggressive during winter / more eager to target animals/livestock for food. Or maybe more numerous yet weaker in spring / summer (new baby monsters!). On a related note Seasons could be enhanced to cover the world in snow during winter and make food harder to come by.
  • Introduce phases of the moon (could that be a variant of seasons?) and vary creature behavior based on it. More howling and aggression during full moon. Need to be able to use the Skysphere better :) Could also vary music this way (seasons too)
I am notexpecting to be able to put a lot of time toward this so I'm hoping for an interested volunteer or two. Have discussed the pathfinding with synopia in the past. Maybe Marcin Sciesinski would be interested in the creatures and potential use for Wood & Stone.

Trickiest parts are likely enhancing pathfinding to deal with blocked paths and developing a Spotted type event if one entity is looking at another (mainly player looking at the creature). Possible thought pattern for AI:
  • Check once per [time period] all creatures of interest
  • Is a player in decent range of the creature?
  • Is a player looking roughly in the direction of the creature? Implementation ideas below
  • Is there a clear line of sight between the player and the creature? beware of glass ..
  • Spotted! Trigger a CreatureSpottedByPlayer event
    • Possible optimization if there are a lot of creatures: when one creature is spotted auto-trigger the same event for all relevant creatures within "range" of that creature. Unsure how this would balance against then distance-sorting all the creatures to figure out which are close enough to care.
Talked to Immortius in the past and got some technical notes for anybody interested in giving the actual "vision test" a shot:

Immortius said:
Calculate a frustum for each player, check whether the creature is within it
trickiness is each player's fov is not available at the moment, might need to pick a typical angle
to be really lazy you can check if the AI is in front of the player, that's a really simple check
dot product between the player's direction of view vector and the relative location of the AI from the player will tell you the angle
if it is negative, the AI is behind the player
You can follow with a trace to check if the world impedes vision
both of these are rough, since it would simple be to the center of the AI
Any more ideas / additions / tweaks / etc ? Any volunteers? :D