docs+feat: 13 retail-AC deep-dives (R1-R13) + C# port scaffolds + roadmap E-H
78,000 words of grounded, citation-backed research across 13 major AC
subsystems, produced by 13 parallel Opus-4.7 high-effort agents. Plus
compact C# port scaffolds for the top-5 systems and a phase-E-through-H
roadmap update sequencing the work.
Research (docs/research/deepdives/):
- 00-master-synthesis.md (navigation hub + dependency graph)
- r01-spell-system.md 5.4K words (fizzle sigmoid, 8 tabs, 0x004A wire)
- r02-combat-system.md 5.9K words (damage formula, crit, body table)
- r03-motion-animation.md 8.2K words (450+ commands, 27 hook types)
- r04-vfx-particles.md 5.8K words (13 ParticleType, PhysicsScript)
- r05-audio-sound.md 5.6K words (DirectSound 8, CPU falloff)
- r06-items-inventory.md 7.4K words (ItemType flags, EquipMask 31 slots)
- r07-character-creation.md 6.3K words (CharGen dat, 13 heritages)
- r08-network-protocol-atlas 9.7K words (63+149+94 opcodes mapped)
- r09-dungeon-portal-space.md 6.3K words (EnvCell, PlayerTeleport flow)
- r10-quest-dialogs.md 7.1K words (emote-script VM, 122 actions)
- r11-allegiance.md 5.4K words (tree + XP passup + 5 channels)
- r12-weather-daynight.md 4.5K words (deterministic client-side)
- r13-dynamic-lighting.md 4.9K words (8-light cap, hard Range cutoff)
Every claim cites a FUN_ address, ACE file path, DatReaderWriter type,
or holtburger/ACViewer reference. The master synthesis ties them into a
dependency graph and phase sequence.
Key architectural finding: of 94 GameEvents in the 0xF7B0 envelope,
ZERO are handled today — that's the largest network-protocol gap and
blocks F.2 (items) + F.5 (panels) + H.1 (chat).
C# scaffolds (src/AcDream.Core/):
- Items/ItemInstance.cs — ItemType/EquipMask enums, ItemInstance,
Container, PropertyBundle, BurdenMath
- Spells/SpellModel.cs — SpellDatEntry, SpellComponentEntry,
SpellCastStateMachine, ActiveBuff,
SpellMath (fizzle sigmoid + mana cost)
- Combat/CombatModel.cs — CombatMode/AttackType/DamageType/BodyPart,
DamageEvent record, CombatMath (hit-chance
sigmoids, power/accuracy mods, damage formula),
ArmorBuild
- Audio/AudioModel.cs — SoundId enum, SoundEntry, WaveData,
IAudioEngine / ISoundCache contracts,
AudioFalloff (inverse-square)
- Vfx/VfxModel.cs — 13 ParticleType integrators, EmitterDesc,
PhysicsScript + hooks, Particle struct,
ParticleEmitter, IParticleSystem contract
All Core-layer data models; platform-backed engines live in AcDream.App.
Compiles clean; 470 tests still pass.
Roadmap (docs/plans/2026-04-11-roadmap.md):
- Phase E — "Feel alive": motion-hooks + audio + VFX
- Phase F — Fight + cast + gear: GameEvent dispatch, inventory,
combat, spell, core panels
- Phase G — World systems: sky/weather, dynamic lighting, dungeons
- Phase H — Social + progression: chat, allegiance, quests, char creation
- Phase J — Long-tail (renumbered from old Phase E)
Quick-lookup table updated with 10+ new rows mapping observations to
new phase letters.
This commit is contained in:
parent
7230c1590f
commit
3f913f1999
20 changed files with 15312 additions and 17 deletions
192
src/AcDream.Core/Combat/CombatModel.cs
Normal file
192
src/AcDream.Core/Combat/CombatModel.cs
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
using System;
|
||||
|
||||
namespace AcDream.Core.Combat;
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
// Scaffold for R2 — combat math + damage event data.
|
||||
// Full research: docs/research/deepdives/r02-combat-system.md
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
public enum CombatMode
|
||||
{
|
||||
Undef = 0,
|
||||
NonCombat = 1,
|
||||
Melee = 2,
|
||||
Missile = 3,
|
||||
Magic = 4,
|
||||
Peaceful = 5,
|
||||
}
|
||||
|
||||
public enum AttackHeight
|
||||
{
|
||||
High = 1,
|
||||
Medium = 2,
|
||||
Low = 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retail uses a 15-bit flags enum for attack types — weapon categories.
|
||||
/// See r02 §2 + <c>ACE.Entity.Enum.AttackType</c>.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum AttackType : uint
|
||||
{
|
||||
None = 0,
|
||||
Punch = 0x0001,
|
||||
Kick = 0x0002,
|
||||
Thrust = 0x0004,
|
||||
Slash = 0x0008,
|
||||
DoubleSlash = 0x0010,
|
||||
TripleSlash = 0x0020,
|
||||
DoubleThrust = 0x0040,
|
||||
TripleThrust = 0x0080,
|
||||
Offhand = 0x0100,
|
||||
OffhandSlash = 0x0200,
|
||||
OffhandThrust = 0x0400,
|
||||
ThrustSlash = 0x0800,
|
||||
// more in r02 §2
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum DamageType : uint
|
||||
{
|
||||
Undef = 0,
|
||||
Slash = 0x0001,
|
||||
Pierce = 0x0002,
|
||||
Bludgeon = 0x0004,
|
||||
Cold = 0x0008,
|
||||
Fire = 0x0010,
|
||||
Acid = 0x0020,
|
||||
Electric = 0x0040,
|
||||
Nether = 0x0080,
|
||||
Mana = 0x0100,
|
||||
Health = 0x0200,
|
||||
Stamina = 0x0400,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 12-quadrant body-part table: High/Mid/Low × L/R × Front/Back.
|
||||
/// Layout: <c>[HLF MLF LLF HRF MRF LRF HLB MLB LLB HRB MRB LRB]</c>.
|
||||
/// Retail picks a quadrant based on AttackHeight + small RNG for L/R.
|
||||
/// </summary>
|
||||
public enum BodyPart
|
||||
{
|
||||
Head = 0,
|
||||
Chest = 1,
|
||||
Abdomen = 2,
|
||||
UpperArm = 3,
|
||||
LowerArm = 4,
|
||||
Hand = 5,
|
||||
UpperLeg = 6,
|
||||
LowerLeg = 7,
|
||||
Foot = 8,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A single attack resolution: who hit whom, where, with what weapon, for how much.
|
||||
/// Produced by the server; client reads for damage floaters + HP bar updates.
|
||||
/// </summary>
|
||||
public readonly record struct DamageEvent(
|
||||
uint AttackerGuid,
|
||||
uint TargetGuid,
|
||||
AttackType AttackType,
|
||||
DamageType DamageType,
|
||||
BodyPart BodyPart,
|
||||
int DamageDealt,
|
||||
int PostResistDamage,
|
||||
bool WasCritical,
|
||||
bool WasEvaded,
|
||||
bool WasResisted,
|
||||
float AccuracyModUsed,
|
||||
float PowerModUsed);
|
||||
|
||||
/// <summary>
|
||||
/// Retail-faithful combat math. Source: r02 research + ACE CombatManager.
|
||||
/// All formulas cited to research doc §5 + §7.
|
||||
/// </summary>
|
||||
public static class CombatMath
|
||||
{
|
||||
// ── Power bar (melee) ──────────────────────────────────────────
|
||||
// PowerMod = PowerLevel + 0.5, so [0.5, 1.5] over a full charge.
|
||||
public static float PowerModMelee(float powerLevel) => powerLevel + 0.5f;
|
||||
|
||||
// ── Accuracy bar (missile) ─────────────────────────────────────
|
||||
// AccuracyMod = AccuracyLevel + 0.6, so [0.6, 1.6].
|
||||
public static float AccuracyModMissile(float accuracyLevel) => accuracyLevel + 0.6f;
|
||||
|
||||
// ── Hit-chance sigmoid ─────────────────────────────────────────
|
||||
// Physical: k=0.03, magic: k=0.07. chance = 1 - 1/(1+e^(k×(skill-def))).
|
||||
public static double HitChancePhysical(int attackSkill, int defenseSkill)
|
||||
=> 1.0 - 1.0 / (1.0 + Math.Exp(0.03 * (attackSkill - defenseSkill)));
|
||||
|
||||
public static double HitChanceMagic(int attackSkill, int defenseSkill)
|
||||
=> 1.0 - 1.0 / (1.0 + Math.Exp(0.07 * (attackSkill - defenseSkill)));
|
||||
|
||||
// ── Base crit rates ────────────────────────────────────────────
|
||||
public const double PhysicalCritBase = 0.10; // 10%
|
||||
public const double MagicCritBase = 0.05; // 5%
|
||||
|
||||
/// <summary>
|
||||
/// Full retail damage formula (r02 §5). Simplified version without
|
||||
/// augmentations and ratings — extend as needed.
|
||||
/// </summary>
|
||||
public static int ComputeDamage(
|
||||
float weaponDamageMin, float weaponDamageMax,
|
||||
int attributeBonus, // Str for melee, Coord for missile, Self for magic
|
||||
float powerMod, // PowerModMelee or AccuracyModMissile
|
||||
float skillMod, // skill-based bonus (weapon skill)
|
||||
bool isCritical,
|
||||
float critMultiplier,
|
||||
float armorReduction, // damage reduction from armor
|
||||
float resistMultiplier, // 0..1 multiplier from buffs / natural resist
|
||||
Random rng)
|
||||
{
|
||||
// Base weapon roll
|
||||
double baseDmg = rng.NextDouble() * (weaponDamageMax - weaponDamageMin) + weaponDamageMin;
|
||||
|
||||
// Apply attribute bonus + power mod + skill mod
|
||||
double raw = (baseDmg + attributeBonus) * powerMod * skillMod;
|
||||
|
||||
// Crit
|
||||
if (isCritical) raw *= critMultiplier;
|
||||
|
||||
// Subtract armor (capped at 0)
|
||||
raw = Math.Max(0, raw - armorReduction);
|
||||
|
||||
// Resist multiplier (<1 reduces, >1 amplifies)
|
||||
raw *= resistMultiplier;
|
||||
|
||||
return (int)Math.Max(0, Math.Round(raw));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Per-body-part armor level (AL). Retail creatures have 9 body parts
|
||||
/// with independent AL values. See r02 §8.
|
||||
/// </summary>
|
||||
public sealed class ArmorBuild
|
||||
{
|
||||
public int ALHead { get; set; }
|
||||
public int ALChest { get; set; }
|
||||
public int ALAbdomen { get; set; }
|
||||
public int ALUpperArm { get; set; }
|
||||
public int ALLowerArm { get; set; }
|
||||
public int ALHand { get; set; }
|
||||
public int ALUpperLeg { get; set; }
|
||||
public int ALLowerLeg { get; set; }
|
||||
public int ALFoot { get; set; }
|
||||
|
||||
public int Get(BodyPart bp) => bp switch
|
||||
{
|
||||
BodyPart.Head => ALHead,
|
||||
BodyPart.Chest => ALChest,
|
||||
BodyPart.Abdomen => ALAbdomen,
|
||||
BodyPart.UpperArm => ALUpperArm,
|
||||
BodyPart.LowerArm => ALLowerArm,
|
||||
BodyPart.Hand => ALHand,
|
||||
BodyPart.UpperLeg => ALUpperLeg,
|
||||
BodyPart.LowerLeg => ALLowerLeg,
|
||||
BodyPart.Foot => ALFoot,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue