ENIGMA / assets /script.js
Um44's picture
Upload 2 files
5a4df38 verified
Raw History Blame Contribute Delete
6.41 kB
// ENIGMA Space β€” interactive elements
// ===== 12-layer canonical order =====
const layers = [
{ num: 0, name: 'Authoring β†’ Compiler', desc: 'Human description β†’ semantic reconstruction β†’ structured dossier β†’ validation β†’ materialization in stores.', detail: 'Biography becomes Identity / Origin Events / History / Relationships / Drives / Desires / Roles / Beliefs / Memory Seeds with provenance. LLM translates, Python validates and writes.' },
{ num: 1, name: 'Identity / History', desc: 'origin_events β†’ canonical NPC history β†’ EventMemory / Chronicle / role history / relationship history.', detail: 'The NPC\'s past exists in the game as simulation data, not just as text.' },
{ num: 2, name: 'Body β†’ Need', desc: 'Body state, needs, sleep, hunger β€” and their real consumers.', detail: 'NPC states have causal consequences, not decorative numbers.' },
{ num: 3, name: 'Desire β†’ Object β†’ Activity', desc: 'Existing Desire / Activity / Object mechanisms unified into a single circuit.', detail: 'NPC does not just "have a need" β€” it wants something, has a goal/object, and chooses an activity.' },
{ num: 4, name: 'Decision β†’ Action β†’ Outcome', desc: 'CAN β‰  WANT β‰  INTEND β‰  ATTEMPT β‰  SUCCESS. TAKE/USE/MOVE/GIVE/FOLLOW and consequences.', detail: 'NPC decision changes the world; the result returns to state/memory.' },
{ num: 5, name: 'Perception β†’ Experience β†’ Memory', desc: 'Perception membrane, personal experience, chronology, event_id, bounded recall, provenance.', detail: 'NPC knows only what it had the opportunity to perceive or learn.' },
{ num: 6, name: 'Salience β†’ Consolidation', desc: 'Event significance for a specific NPC β†’ decay β†’ consolidation β†’ compression β†’ deterministic distortion.', detail: 'Memory becomes selective: the important lives longer, the old may compress or distort.' },
{ num: 7, name: 'Relationships as History', desc: 'RelationshipEvent β†’ repeated interactions β†’ relationship changes β†’ social consequences.', detail: 'A relationship is a consequence of history, not a standalone magical scalar.' },
{ num: 8, name: 'Belief β†’ Expectation β†’ Decision', desc: 'BC-2…BC-7: experience/testimony β†’ belief β†’ conclusion β†’ expectation β†’ decision.', detail: 'NPC acts according to its own picture of the world, not directly according to WORLD TRUTH.' },
{ num: 9, name: 'NPC as Interface', desc: 'Targeted recall, biography, provenance, epistemic divergence, investigation loop, grounding, ignorance.', detail: 'The player learns the world\'s complexity through the NPC, not through panels and hidden coefficients.' },
{ num: 10, name: 'Self-Interpretation', desc: 'WHAT HAPPENED β‰  WHAT REMEMBERS β‰  WHAT BELIEVES β‰  HOW EXPLAINS.', detail: 'NPC may not understand its own motives, may be wrong, may rationalize, may explain itself differently.' },
{ num: 11, name: 'Appraisal / Prediction / Humor', desc: 'Expectation β†’ prediction error β†’ appraisal β†’ individual reactions / humor.', detail: 'Behavior depends not only on the fact of an event, but on how unexpected or significant it is for the NPC.' },
{ num: 12, name: 'Deception', desc: 'KNOWLEDGE β†’ INTENTION TO DECEIVE β†’ FALSE CLAIM β†’ NARRATION.', detail: 'NPC can consciously lie; a lie is distinguishable from ignorance, memory error, delusion, or refusal to disclose.' },
];
const layersGrid = document.getElementById('layersGrid');
if (layersGrid) {
layers.forEach(layer => {
const card = document.createElement('div');
card.className = 'layer-card';
card.innerHTML = `
<span class="layer-num">LAYER ${String(layer.num).padStart(2, '0')}</span>
<div class="layer-name">${layer.name}</div>
<div class="layer-desc">${layer.desc}</div>
<div class="layer-detail">${layer.detail}</div>
`;
card.addEventListener('click', () => {
card.classList.toggle('expanded');
});
layersGrid.appendChild(card);
});
}
// ===== Causal chain =====
const chainNodes = [
{ name: 'EVENT', desc: 'World tick produces a change' },
{ name: 'PERCEPTION', desc: 'Membrane filters by clarity/LOS/sound' },
{ name: 'ENCODING', desc: 'EventMemory written with perspective' },
{ name: 'CONSOLIDATION', desc: 'Salience-weighted decay & compression' },
{ name: 'RETRIEVAL', desc: 'Cue-driven, bounded, by-subject' },
{ name: 'RECONSTRUCTION', desc: 'Validated narrative with hedging' },
{ name: 'BELIEF', desc: 'Crystallized with evidence linkage' },
{ name: 'EXPECTATION', desc: 'Per-source prediction' },
{ name: 'DECISION', desc: 'Utility reducer with modifiers' },
{ name: 'ACTION', desc: 'TAKE/USE/MOVE/GIVE/FOLLOW' },
{ name: 'OUTCOME', desc: 'World change persists' },
{ name: 'CONSEQUENCE', desc: 'Feeds back to memory & belief' },
];
const chain = document.getElementById('causalChain');
if (chain) {
chainNodes.forEach((node, i) => {
const el = document.createElement('div');
el.className = 'chain-node';
el.innerHTML = `<strong>${node.name}</strong><span>${node.desc}</span>`;
chain.appendChild(el);
if (i < chainNodes.length - 1) {
const arrow = document.createElement('div');
arrow.className = 'chain-arrow';
arrow.textContent = 'β†’';
chain.appendChild(arrow);
}
});
}
// ===== Smooth scroll for anchor links =====
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
const target = document.querySelector(this.getAttribute('href'));
if (target) {
e.preventDefault();
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
});
});
// ===== Lazy reveal on scroll =====
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, { threshold: 0.1 });
document.querySelectorAll('.section').forEach(section => {
section.style.opacity = '0';
section.style.transform = 'translateY(20px)';
section.style.transition = 'opacity 0.5s ease, transform 0.5s ease';
observer.observe(section);
});