RoSoDude Where can I find more info about the Dark Engine and what exactly it simulates, mechanically? I'm asking because you mentioned this:
SS2's melee combat in the Dark Engine which simulated the collision of your weapon over its swing animation
Is there a documentation for it anywhere?
I want to know about what Ultima Underworld simulates as well as Thief and System Shock 1 because all these "hidden" mechanics are very fascinating to me.
I don't think it's really well-documented anywhere; someone made a video covering some of the basics, though.
I can also give you my perspective as an experienced SS2 modder. All of this stuff is a result of the Dark Engine having originally been built to support extensive swordfighting simulation before The Dark Project became primarily about stealth and spelunking (so everything I say here also applies to Thief and Thief 2).
The essence of it is that weapons are represented by simple physics colliders (cylinders, I believe) which become active sources of damage stims over a range of animation frames (they are nonphysical otherwise; you can see that the player wrench receives OnPhysMadePhysical and OnPhysMadeNonPhysical script events when the collider is turned on or off). This applies to both player and enemy motions (the name Dark uses for anims); if I load up the Pipe Hybrid's uppercut attack motion in ShockEd, I can see the start and end of these attack frames represented by the green flags (Trigger 1):
If the weapon collider hits something (level geometry, another physics object), it transfers any relevant damage stims defined in the Object Hierarchy to the target (for the player, this is based on their equipped melee weapon, while for the enemy it depends on their linked weapon archetype), then cancels the motion and tweens back to some other animation state. For player weapons, you reset back to the normal held position, while enemies might reset to the start of another attack motion.
The result is that a player weapon can collide with an enemy weapon while they're both in an attack motion and they'll "parry" each other. Furthermore, if you attack something while angling your view to the right of an enemy, you'll hit them in the earlier part of your swing, while if you angle your view to the left you'll hit them later. This can allow you to more deliberately time your strike if you aren't in range yet or if you want to increase your attack speed up close.
The other half of melee combat in the Dark Engine is the AI behaviors, which are a pretty complicated topic on their own. The most relevant bit here is that the basic AI behaviors are driven by the motion system, in that the AI code calculates the creature's response to stimuli which is executed via grouped sequences of motions with relevant tags (like "MeleeCombat", "Search", "Attack", "Locomote", "ReceiveWound") in the motion database. If the engine wants an enemy to move somewhere to search for the player, it'll tell them to execute the "Locomote" + "Search" motion group which will cause them to wander around, in some cases with motions that move one leg at a time. You can create unique AI behaviors just by tweaking the motion sequences, their tags, the distance scale that the motion group travels through space, and the time scale that speeds or slows the motion group down. The Pipe Hybrid executes a dodge in melee combat sometimes because it receives an attack signal from the player and activates a backstep motion group with a large scaled distance in a short timescale. Alternately, the Cyborg Assassin tries to avoid fighting up close (which the AI code determines from its object properties), and thus will trigger its LocoUrgent motion group to attempt to escape. This leaves the designer a lot of tools to tweak and add AI behaviors without ever touching the source code by tweaking their object properties and expressing their behaviors via the motion system. I invite you to see the possibilities for modifying the motion database to develop AI behaviors in my
Scary Monsters AI enhancement mod.
Some other miscellaneous notes about SS2 melee combat (most of which also applies to Thief):
- The backpedal exploit affects all enemies who try to attack in melee, however it is more problematic on some than others. The exploit is based on enemies calculating that the player will be out of range due to their velocity (it's a static calculation that doesn't take into account animation timings). With base Agility, Pipe Hybrids can overtake you on the sides and attempt to attack, while Rumblers will stupidly walk forward forever even as they're continually hit with a wrench to the face.
- Enemies receive melee attack signals from the player, though I'm not sure if it's at the instant the player clicks the button or at the start of the attack animation. Hybrids will dodge or attack in response to these signals, for example. Rumblers never seem to respond in this manner, hence they are more vulnerable to the backpedal exploit, while Hybrids may attack a backpedaling player who attacks first.
- Rumblers will often instantly smack players who try to sneak up and melee them from behind because of their low turn speed and very early attack frames which begin right as their claw is being reared backwards for an attack to the front. Spiders notably have no attack frames assigned to their jump move, making it nothing more a completely harmless intimidation tactic.
- "Parrying" simply occurs when two active melee hitboxes collide and cancel each other. Parrying is possible with any player melee weapon and any melee enemy, though it is easier to see on Pipe Hybrids, Monkeys, and Rumblers.
- You can get the damage bonus from Smasher without actually executing the overhand attack. If you charge the strike long enough to start the transition animation to overhand (after pulling all the way to the left), it'll get full bonus damage even when it reverts to a normal left-to-right swipe. I believe this is also the case for the overhand attack in Thief, though I've not confirmed it.
- The Crystal Shard has an error in its property assignment that makes it deal 2.25x damage with Smasher instead of 1.25x damage as intended (basically, you get the Normal AND Smasher damage bundled together, instead of just the Smasher damage). This is fixed by mods like SCP.
- All melee damage bonuses are multiplicative, except for Strength which is a flat bonus added after all other multipliers. This means Strength has much more impact on the Wrench (due to its low base damage) than other melee weapons, which benefit more from weapon skills/Adrenaline Overproduction/Lethal Weapon/Smasher.
EDIT: Hopefully the above should make it obvious how much deeper SS2's melee mechanics are compared to this remake...