Posted May 03, 2024 by ferniss
#npcs #stats
I took a long break to contemplate whether or not anything is worth doing and now I’m back.
Here are some of the logs from the before times I didn’t release with a few modern updates.
My focus started on the AI and the way Npcs move from room to room. I was having a musical chairs issues, where some npcs weren’t being placed into “stations” because their AI didn’t have enough available options.
I added some “passing stations” to rooms where I saw fit after noticing the NPCs getting bottlenecked into certain rooms. For Administration and Security I could picture unaffiliated Npcs visiting for one reason or another like “customer service” or “to chat” but they’re not allowed to loiter for more than 1 hour (1 turn).
The system is essentially an array of objects with this schema:
const caution: Caution = {
npc: watcher, //npc reporting the caution
time: 15, //number of turns caution is active
label: 'questioning', //the outcome
type: 'seen', //poorly named, unimplemented, wildcard.
authority: npcs.all[watcher].clan, //who to report caution to
suspect: s, //player or specific npc name
reason: 'theft', //still opaque. Adds more specification.
}
* I switched from Lua to TypeScript https://ts-defold.dev/
Each turn the cautions are looped through and checked if they can be addressed. This may involve an NPC confronting another NPC or the player with questions or issues. I did a poor job of introducing interactions in a prior post so I’ll put this here:
The trade and give interactions haven’t been set up yet, but Pockets will allow you an attempt to pickpocket and NPC or other Actor. If you fail a skill check you may create a “snitch”. When this new caution is addressed, it requires that if this NPC (victim) crosses paths with Security a Questioning caution will be created.
The Talk interaction will bring up a dialog sequence.
I added the confrontation logic I used for interactions and added it to level load as well.
I created a new caution for “questioning”. If the player or NPC is wanted for questioning, and the player and authority cross paths, the player will be stopped by that authority for questioning. I added dialog scripts for these which are in poor shape.
Went from 21 rooms to 28. There are only 3 actual levels for these though. layout:::
export const RoomsInitLayout = [
['alley1', 'alley2', 'alley3', null, null],
['unloading', 'warehouse', 'commonsext', 'storage', 'maintenance'],
['loading', 'lockers', 'commonsint', 'chapel', 'inn1'],
['baggage', 'customs', 'lobby', 'recroom', 'pubgrill'],
['grounds', 'reception', 'admin1', 'gym', 'store'],
['entrance', 'viplobby', 'security', 'infirmary', 'dorms'],
]
This is what I’m using right now for skill checks. Skills have values 1 to 10 (not counting bonuses) and binaries range from -1 to 1
local skills = {
constitution = 5,
charisma = 5, -- deception?
wisdom = 5,
intelligence = 5,
speed = 5,
perception = 5,-- insight
strength = 5, --carrying capacity, intimidation
stealth = 5-- !!
}
local binaries = {
evil_good = 0,
passive_aggressive = 0,
lawless_lawful = 0,
anti_authority = 0,
un_educated = 0,
poor_wealth = 0
}