<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Gothic AI devlog</title><link>https://kaifaty.github.io/GothicAI/</link><atom:link href="https://kaifaty.github.io/GothicAI/feed.xml" rel="self" type="application/rss+xml"/><description>Gothic II with NPCs that hear the player&#x27;s voice, answer in their own voices, act and remember. An open-source experiment on the OpenGothic engine.</description><language>en</language><item><title>The sword hits now, not a rule: the numbers</title><link>https://kaifaty.github.io/GothicAI/posts/blade-hits/</link><guid isPermaLink="true">https://kaifaty.github.io/GothicAI/posts/blade-hits/</guid><pubDate>Mon, 02 Nov 2026 18:00:02 +0300</pubDate><description>What decides a melee hit now, how the blade&#x27;s speed, the spot on the blade and its angle scale the damage, and what follows from it: the formulas behind the short.</description><content:encoded>&lt;p&gt;In a sword fight a hit used to be decided by a rule: the enemy is close and in front of you. Now the blade
decides it: where it went, what it touched and at what angle. The short shows it in 50 seconds (a Russian
voice with English captions); here are the formulas.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;Frames of the short, labels in Russian: the old rule&#x27;s reach and ±30° with the 11 damage it dealt; one swing wounding a bandit (−11) and a wolf (−3); a miss by under 2 cm; the attacker&#x27;s 80 cm step-in&quot; src=&quot;https://kaifaty.github.io/GothicAI/media/blade-hits/sheet.jpg&quot;&gt;&lt;/p&gt;
&lt;h2&gt;The rule it replaces&lt;/h2&gt;
&lt;p&gt;In &lt;a href=&quot;https://github.com/Try/OpenGothic&quot;&gt;OpenGothic&lt;/a&gt; as we started from it, a melee hit is one moment: at the
hit frame of the animation the engine checks that the chosen target is within the weapon&amp;rsquo;s reach and within
±30° in front of the attacker. The weapon itself has no collision. On the test bench a swing at a bandit
215 cm away dealt 11 damage while the sword passed him by.&lt;/p&gt;
&lt;h2&gt;The blade&lt;/h2&gt;
&lt;p&gt;The blade is now a capsule of 2 cm radius from the hand to the end of the weapon&amp;rsquo;s real mesh (90 cm for the
common sword). On every physics step, 60 a second, it sweeps from its last pose to the new one in turns of
at most 5°, so a thin target between two poses is not skipped, and checks the bodies&amp;rsquo; capsules (head, trunk,
limbs) and the world. Humans hit this way now, the hero and NPCs; monsters still attack by the old rule.&lt;/p&gt;
&lt;p&gt;Gothic&amp;rsquo;s own damage (the weapon, strength, the critical roll, the armour) is computed as before, and the
blade multiplies it:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;multiplier = clamp(speed × lever × edge, 0.5, 1.5) × 0.6ⁿ&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;speed&lt;/strong&gt;: the touching point&amp;rsquo;s speed over a typical one for this swing (0.7 of the tip&amp;rsquo;s peak speed in
  this animation);&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;lever&lt;/strong&gt;: 0.5 + 0.5 × the place on the blade, 0 at the hilt and 1 at the tip;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;edge&lt;/strong&gt;: 0.5 + 0.5 × sin of the angle, 0.5 with the flat and 1 with the edge;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;n&lt;/strong&gt;: how many bodies this swing has already hit.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From the short: the same 215 cm swing, with the blade deciding, touches the bandit&amp;rsquo;s trunk with the tip
(lever 1) at 78° (edge 0.99) and 1920 cm/s against a typical 1177 (speed 1.63). That is 1.61, clamped to
1.5: Gothic&amp;rsquo;s 11 becomes 17.&lt;/p&gt;
&lt;h2&gt;What follows from it&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A post stops the swing.&lt;/strong&gt; A wall or a post stops a blade moving forward along the attacker&amp;rsquo;s look; the
  backswing and the follow-through pass, and the ground does not stop it. The swing ends with a hit
  effect and a return to the stance. Before, a two-handed axe went through a fence post.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Two targets in one swing.&lt;/strong&gt; The blade checks every body on its way (an NPC&amp;rsquo;s blade passes through its
  allies). A two-handed swing hits a bandit (×0.94, −11), then a wolf&amp;rsquo;s foreleg almost flat, at 4° and
  slower: 0.30, raised to 0.5, then ×0.6, so −3.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The push.&lt;/strong&gt; The impulse is the weapon&amp;rsquo;s mass (fist 1.5 kg, one-handed 2.5, two-handed 4) × the contact
  speed × the edge, at most 60 N·s, along the blade&amp;rsquo;s motion. The struck part of the body takes 15% of it,
  and its motors pull it back into the animation.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A miss by a centimetre.&lt;/strong&gt; A swing at a bandit 264 cm away hits; at 266 cm it misses by under 2 cm. The
  old rule would have counted both.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The step-in.&lt;/strong&gt; So at the start of a swing the attacker steps toward a target within ±60°: up to 120 cm
  forward or 40 back, at most 6 m/s, turning at most 30°, only until the predicted contact. The 215 cm swing
  took 24 cm, a forward swing at 275 cm took 80; both hit.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;What we keep honest&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The &amp;ldquo;before&amp;rdquo; shots are OpenGothic with blade physics off (&lt;code&gt;melee_physics_hits=0&lt;/code&gt;), not the original
  Gothic II executable, which we did not check.&lt;/li&gt;
&lt;li&gt;The targets are placed by the test bench. The slow motion is the game&amp;rsquo;s own frames with its time slowed,
  not interpolated. Every number on screen comes from the take&amp;rsquo;s log.&lt;/li&gt;
&lt;li&gt;The voice is a person&amp;rsquo;s recording. The music is Gothic II&amp;rsquo;s (Kai Rosenkranz).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Next&lt;/h2&gt;
&lt;p&gt;Balancing the whole fight (the blade, stamina, parries) is planned as one pass of its own, not step by step.&lt;/p&gt;
&lt;p&gt;Not playable yet: it runs from source on macOS and needs your own copy of Gothic II: Night of the Raven.
How it works now is in &lt;a href=&quot;https://github.com/kaifaty/GothicAI/blob/main/docs/physics.md&quot;&gt;&lt;code&gt;docs/physics.md&lt;/code&gt;&lt;/a&gt;
(stage 7), the multiplier in
&lt;a href=&quot;https://github.com/kaifaty/GothicAI/blob/main/OpenGothic/common/game/damagecalculator.cpp&quot;&gt;&lt;code&gt;damagecalculator.cpp&lt;/code&gt;&lt;/a&gt;,
the push in &lt;a href=&quot;https://github.com/kaifaty/GothicAI/blob/main/OpenGothic/common/game/meleeimpact.cpp&quot;&gt;&lt;code&gt;meleeimpact.cpp&lt;/code&gt;&lt;/a&gt;.
The short was filmed on the &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/scripts/bench&quot;&gt;test bench&lt;/a&gt; and
drawn with &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/shorts/explain&quot;&gt;&lt;code&gt;shorts/explain&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title>How the bow works now: the numbers</title><link>https://kaifaty.github.io/GothicAI/posts/bow-numbers/</link><guid isPermaLink="true">https://kaifaty.github.io/GothicAI/posts/bow-numbers/</guid><pubDate>Tue, 13 Oct 2026 21:58:47 +0300</pubDate><description>What decides an arrow&#x27;s damage now, what skill, dexterity and strength do, and how it compares with Gothic&#x27;s dice: the formulas behind the short.</description><content:encoded>&lt;p&gt;The &lt;a href=&quot;https://kaifaty.github.io/GothicAI/posts/archery/&quot;&gt;last post&lt;/a&gt; showed the bow aimed by hand. This one is about the numbers behind it. If you
aim the arrow yourself, what is left for the hero&amp;rsquo;s skill, dexterity and strength? Gothic is an RPG after
all. The short answers that in 80 seconds (a Russian voice with English subtitles); here are the formulas.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;Frames of the short: the dice&#x27;s chance and roll over a bandit, the hit zones, the damage formula, damage per second against the dice&quot; src=&quot;https://kaifaty.github.io/GothicAI/media/bow-numbers/sheet-en.jpg&quot;&gt;&lt;/p&gt;
&lt;h2&gt;The dice it replaces&lt;/h2&gt;
&lt;p&gt;In Gothic II the bow aims itself and one roll decides the hit. The chance comes from the bow skill and the
distance, as Gothic2.exe computes it. Up close it is 100%, falling to the skill at 15 m. Past 15 m it is
&lt;code&gt;H − H·d/45 m&lt;/code&gt; (H is the skill), so it drops at once to two thirds of the skill and reaches zero at 45 m.
A bandit with 40% skill hits from 16 m a quarter of the time. That formula, taken from the executable, is
the yardstick for everything below.&lt;/p&gt;
&lt;h2&gt;Damage&lt;/h2&gt;
&lt;p&gt;The arrow is a real projectile: it leaves along the line of the bow, drops over distance and hits what it
touches, with zones fitted to each body&amp;rsquo;s mesh. The damage keeps Gothic&amp;rsquo;s own rule (the bow&amp;rsquo;s damage plus
dexterity) and adds three factors:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;damage = max(5, ((bow damage + dexterity) × draw − protection) × zone)&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;draw&lt;/strong&gt;: 0.3 to 1; a shorter draw does not shoot;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;protection&lt;/strong&gt;: the target&amp;rsquo;s protection against arrows; it never takes the damage below 0;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;zone&lt;/strong&gt;: head 2, trunk 1, arms and legs 0.6. It applies after the armour, so a head shot always deals
  twice a body shot;&lt;/li&gt;
&lt;li&gt;each step is rounded, and at least 5 is dealt, as in Gothic.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A master (a bow of 150, dexterity 150) at full draw against a paladin in plate (protection 100): 400 in the
head, 200 in the trunk, 120 in a limb. The test bench measured the same.&lt;/p&gt;
&lt;h2&gt;What the stats do&lt;/h2&gt;
&lt;p&gt;From novice to master (skill 0 to 100%, dexterity 0 to 150):&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stat&lt;/th&gt;
&lt;th&gt;What it changes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Bow skill&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Accuracy&lt;/strong&gt;: the sway at full draw 0.9° → 0.25°, the scatter on release 0.6° → 0.1°, the aim settles after a turn in 0.6 → 0.2 s, the breath holds 2 → 5 s. &lt;strong&gt;Training&lt;/strong&gt;: Gothic&amp;rsquo;s trained archers&amp;rsquo; animations are kept, so the reload animation takes 1.16 / 1.08 / 0.92 s on the three tiers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dexterity&lt;/td&gt;
&lt;td&gt;The damage (above) and the &lt;strong&gt;tempo&lt;/strong&gt;: the draw 1.2 → 0.5 s, the reload&amp;rsquo;s pace ×0.85 → ×1.6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strength&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Holding a heavy bow&lt;/strong&gt;: a bow needs 0.6 of its damage in strength, or its own requirement. Short of it, the bow sways more (×(1 + the shortfall)), draws slower and trembles sooner: it holds steady for 1.5 s at half the strength it needs and 6 s at twice. A crossbow cocks at ×0.75 → ×1.4 the pace&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h2&gt;Against the dice&lt;/h2&gt;
&lt;p&gt;On the test bench: four tiers from novice to master, 30 shots per cell, no armour. Damage per second aiming
by hand, divided by the dice&amp;rsquo;s at the same tier:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tier (skill, bow, strength/dexterity)&lt;/th&gt;
&lt;th&gt;10 m&lt;/th&gt;
&lt;th&gt;20 m&lt;/th&gt;
&lt;th&gt;30 m&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;novice (10%, Bow_L_01, 10/10)&lt;/td&gt;
&lt;td&gt;0.86&lt;/td&gt;
&lt;td&gt;4.0&lt;/td&gt;
&lt;td&gt;4.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;apprentice (30%, Bow_L_03, 30/30)&lt;/td&gt;
&lt;td&gt;0.79&lt;/td&gt;
&lt;td&gt;1.65&lt;/td&gt;
&lt;td&gt;1.57&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;middling (60%, Bow_M_01, 60/60)&lt;/td&gt;
&lt;td&gt;0.79&lt;/td&gt;
&lt;td&gt;1.16&lt;/td&gt;
&lt;td&gt;1.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;master (100%, Bow_H_03, 150/150)&lt;/td&gt;
&lt;td&gt;1.10&lt;/td&gt;
&lt;td&gt;1.39&lt;/td&gt;
&lt;td&gt;1.76&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Close up, aiming by hand is a little slower than the dice: drawing takes time. Past 15 m it deals more,
because the dice cuts the chance there in one step (a novice is left with a few percent) and physics does not. A
master puts 17 of 30 arrows into a head at 20 m.&lt;/p&gt;
&lt;h2&gt;What we keep honest&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Every number on screen is computed, not typed in: the chance and roll over the bandit are the ones the
  game threw in that take, the formula card works its example out the way the engine does, and the charts
  come from the bench&amp;rsquo;s log.&lt;/li&gt;
&lt;li&gt;The bench&amp;rsquo;s bot aims with no human error, only the bow&amp;rsquo;s own sway. A person with a mouse will do worse;
  that is the margin we left.&lt;/li&gt;
&lt;li&gt;The balance table was measured without armour; the paladin example is with it.&lt;/li&gt;
&lt;li&gt;The scenes are staged: the bandit is held in place and cannot die. The arrow&amp;rsquo;s flight is slowed down.&lt;/li&gt;
&lt;li&gt;The voice is a person&amp;rsquo;s recording, not a synthetic one. The music is Gothic II&amp;rsquo;s (Kai Rosenkranz); the
  game&amp;rsquo;s own sound is cut out of the inserts.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Next&lt;/h2&gt;
&lt;p&gt;Plans: whether NPCs should aim at heads, and a balance check with a real player&amp;rsquo;s aim instead of the bot&amp;rsquo;s.&lt;/p&gt;
&lt;p&gt;Not playable yet: it runs from source on macOS and needs your own copy of Gothic II: Night of the Raven.
The engine is &lt;a href=&quot;https://github.com/Try/OpenGothic&quot;&gt;OpenGothic&lt;/a&gt;. The design and the measurements are in
&lt;a href=&quot;https://github.com/kaifaty/GothicAI/blob/main/docs/manual-aim.md&quot;&gt;&lt;code&gt;docs/manual-aim.md&lt;/code&gt;&lt;/a&gt;, the numbers in
&lt;a href=&quot;https://github.com/kaifaty/GothicAI/blob/main/OpenGothic/common/game/archery.cpp&quot;&gt;&lt;code&gt;archery.cpp&lt;/code&gt;&lt;/a&gt; and
&lt;a href=&quot;https://github.com/kaifaty/GothicAI/blob/main/OpenGothic/common/game/damagecalculator.cpp&quot;&gt;&lt;code&gt;damagecalculator.cpp&lt;/code&gt;&lt;/a&gt;.
The short was filmed on the &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/scripts/bench&quot;&gt;test bench&lt;/a&gt; and
drawn with &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/shorts/explain&quot;&gt;&lt;code&gt;shorts/explain&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title>Aiming a bow by hand</title><link>https://kaifaty.github.io/GothicAI/posts/archery/</link><guid isPermaLink="true">https://kaifaty.github.io/GothicAI/posts/archery/</guid><pubDate>Tue, 13 Oct 2026 09:26:58 +0300</pubDate><description>The bow no longer aims itself and no dice decide the hit: you draw, hold and the arrow flies where you point it. NPC archers aim the same way and lead a runner.</description><content:encoded>&lt;p&gt;In Gothic II the bow locks onto a target and a dice roll decides whether the arrow hits. Now you aim it
yourself: hold the button to draw, let go to shoot, and the arrow goes where the bow points. In the short
the same scenes are played twice: on top the bow as the game has it, below aimed by hand.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;Frames of the short: the draw, a head shot, the cant, a step with the bow drawn, leaning out of cover, paladins at a runner; on top the auto aim and the dice, below aimed by hand&quot; src=&quot;https://kaifaty.github.io/GothicAI/media/archery/sheet-en.jpg&quot;&gt;&lt;/p&gt;
&lt;h2&gt;How it plays&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;The draw.&lt;/strong&gt; Holding the left button draws the string, letting go shoots, the right button lowers the bow
without a shot, and Shift holds your breath for a few seconds. A drawn bow sways; held too long, the arms
start to tremble and finally give up. A small crosshair sits where you aim, and its brackets open as far
as the arrow may stray.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The arrow is real.&lt;/strong&gt; It drops over distance, so at 30 m you aim higher. It hits what it touches: zones
fitted to each body&amp;rsquo;s mesh, the head for double damage, the limbs for 0.6. The zone multiplies what got
through the armour.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Skill shows.&lt;/strong&gt; The draw time, the sway, the arrow&amp;rsquo;s speed and the spread on release come from the bow
skill, strength and dexterity, and the trained tiers keep the game&amp;rsquo;s own animations. A crossbow reloads by
strength.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stance.&lt;/strong&gt; With the bow up, the sneak key crouches (steadier hands), the side steps lean you out of cover,
the mouse wheel cants the bow for a quicker, looser shot, and forward and back step slowly with the bow
still drawn.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NPC archers aim too.&lt;/strong&gt; The fight AI decides when to shoot; the archer draws, holds until the aim settles
and lets go, at the chest, over it for the drop and ahead of a runner. How far it misses comes from the
original dice: the chance at that distance becomes a spread around the chest, so archers hit about as
often per minute as before. Against a runner the difference shows: in this take the paladins&amp;rsquo; bolts by
the dice missed 16 of 16, aimed by hand they hit 5 of 8.&lt;/p&gt;
&lt;p&gt;Where the dice remains (with manual aim switched off in &lt;code&gt;Gothic.ini&lt;/code&gt;), it now rolls exactly as
Gothic2.exe does. OpenGothic&amp;rsquo;s formula was kinder past 15 m: a bandit archer 16 m away hit 41% of the
time instead of the original 25%.&lt;/p&gt;
&lt;h2&gt;Balance&lt;/h2&gt;
&lt;p&gt;We compared it with the dice on the test bench: four tiers from novice to master, 30 arrows each at 10,
20 and 30 m. Close up, aiming by hand deals about as much damage per second as the dice or a little less,
since drawing takes time; past 15 m it deals more, where the original dice falls off sharply. A master
puts 17 of 30 arrows into a head at 20 m. The bench&amp;rsquo;s aim has no human error, only the bow&amp;rsquo;s sway, so a
person with a mouse will do worse: that is the margin we left.&lt;/p&gt;
&lt;h2&gt;What we keep honest&lt;/h2&gt;
&lt;p&gt;Both halves are the same scenario on the same build, played twice: on top with manual aim off, which is
OpenGothic with the auto aim and the original dice, not the original executable. The test bench&amp;rsquo;s bot
aims, not a person. The scenes are staged: the bandit is held in place and cannot die, the hero cannot be
hurt, the hero keeps the untrained animations, and the head shots use a master&amp;rsquo;s stats, the other scenes
a middling archer&amp;rsquo;s. The game&amp;rsquo;s sound comes from the lower take; the picture is a little brighter for
phone screens.&lt;/p&gt;
&lt;h2&gt;Next&lt;/h2&gt;
&lt;p&gt;Plans: a reaction to an arrow that only just misses, archers that do not shoot through their allies,
whether NPCs should aim at heads, and a balance check with a real player&amp;rsquo;s aim.&lt;/p&gt;
&lt;p&gt;Not playable yet: it runs from source on macOS and needs your own copy of Gothic II: Night of the Raven.
The engine is &lt;a href=&quot;https://github.com/Try/OpenGothic&quot;&gt;OpenGothic&lt;/a&gt;; the design and the numbers are in
&lt;a href=&quot;https://github.com/kaifaty/GothicAI/blob/main/docs/manual-aim.md&quot;&gt;&lt;code&gt;docs/manual-aim.md&lt;/code&gt;&lt;/a&gt;, and the short was
filmed with &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/shorts/compare&quot;&gt;&lt;code&gt;shorts/compare&lt;/code&gt;&lt;/a&gt; on the
&lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/scripts/bench&quot;&gt;test bench&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title>What happens if you insult Xardas</title><link>https://kaifaty.github.io/GothicAI/posts/xardas-wrath/</link><guid isPermaLink="true">https://kaifaty.github.io/GothicAI/posts/xardas-wrath/</guid><pubDate>Tue, 13 Oct 2026 07:47:25 +0300</pubDate><description>Xardas answers live and decides for himself when he has had enough. Then he kills the hero and raises him as a skeleton: a joke ending outside the main game.</description><content:encoded>&lt;p&gt;You can say anything to Xardas now, rudeness included. In the short the hero gets ruder line by line. First he asks whether Xardas is too old for all this magic, then he calls him a half-baked necromancer, then he brings up his mother. Xardas answers each line live, and after the third he decides he has had enough. The game plays the rest: a spell, the hero falls, Xardas raises him as a skeleton, and the game ends on a picture.&lt;/p&gt;
&lt;p&gt;It is a joke ending, not part of the main game: the AI server turns it on only with a flag of its own.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;Frames of the short: the three lines, the spell, the summoning, the skeleton before Xardas, the end card&quot; src=&quot;https://kaifaty.github.io/GothicAI/media/xardas-wrath/sheet-en.jpg&quot;&gt;&lt;/p&gt;
&lt;h2&gt;How it works&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Xardas decides whether he is offended.&lt;/strong&gt; The language model behind Xardas answers each line in
character. When it takes the words as an insult, it marks how bad they were: 1 for rudeness, 2 for an
insult, 3 for a grave one. The code keeps the count. Xardas puts up with 5 points. He sees how much
patience he has left, and near the end he is warned. One thing he forgives nobody: an insult to his
mother tips the scales at once.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The last word.&lt;/strong&gt; When the scales tip, the model is told that this is the end and says one more line
knowing it. In this take it was &amp;ldquo;You will serve me in silence.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The game plays the ending.&lt;/strong&gt; Xardas finishes speaking, readies a death spell and casts it at the hero
until he falls. Two seconds later he readies a summoning, its light rises from the body, and the hero gets
up as a skeleton. It works like the game&amp;rsquo;s shape change spell, so from then on the player is the skeleton.
Then the screen goes black and the end card comes up; a key takes you to the main menu. The game&amp;rsquo;s
interface is hidden for the whole scene, and the conversation&amp;rsquo;s subtitles go once the hero falls.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;The end card, a picture made with an image generation model&quot; src=&quot;https://kaifaty.github.io/GothicAI/media/xardas-wrath/card.jpg&quot;&gt;&lt;/p&gt;
&lt;h2&gt;Does it really tip&lt;/h2&gt;
&lt;p&gt;We checked it with the live model on the game, not only with a scripted one:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;three plain insults in a row, his mother left out: he ended it on the third;&lt;/li&gt;
&lt;li&gt;his mother: at once;&lt;/li&gt;
&lt;li&gt;the question about his age he did not take as an insult and answered calmly.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In one of eleven live runs the model answered angrily but did not mark the insult, so nothing happened.
After that we made the rule clearer in what Xardas sees about his patience, and the three takes that
followed all ended the way they should.&lt;/p&gt;
&lt;h2&gt;What we keep honest&lt;/h2&gt;
&lt;p&gt;Xardas&amp;rsquo;s answers are not scripted and not edited: he hears the hero&amp;rsquo;s voice through speech recognition
and answers with a language model. Whether he is offended is his model&amp;rsquo;s call too. Only the pauses while
the model thinks are cut. The hero&amp;rsquo;s lines are ours, written for the scene and said by a voice designed
from a description; nobody&amp;rsquo;s voice is cloned. The scene is set up for the camera: the hero stands on the
pentagram, and the cuts of the ending follow its stages. The skeleton, the spell and the summoning are the
game&amp;rsquo;s own. The end card is a generated picture. Its line is in Russian in our game, so the English short
translates it above the picture.&lt;/p&gt;
&lt;h2&gt;Next&lt;/h2&gt;
&lt;p&gt;These are plans: playing on as the skeleton (the player already is one), and tempers for other
characters, since for now only Xardas has one.&lt;/p&gt;
&lt;p&gt;Not playable yet: it runs from source on macOS and needs your own copy of Gothic II: Night of the Raven.
How it is built: &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/docs/xardas-wrath.md&quot;&gt;docs/xardas-wrath.md&lt;/a&gt;,
the scales in &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/server/src/gothic_ai/wrath.py&quot;&gt;wrath.py&lt;/a&gt;, the
ending in &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/OpenGothic/ai_bridge/necromancy.cpp&quot;&gt;necromancy.cpp&lt;/a&gt;.
The engine is &lt;a href=&quot;https://github.com/Try/OpenGothic&quot;&gt;OpenGothic&lt;/a&gt;; Gothic II is Piranha Bytes&amp;rsquo; and THQ Nordic&amp;rsquo;s.&lt;/p&gt;</content:encoded></item><item><title>Bodies that react</title><link>https://kaifaty.github.io/GothicAI/posts/bodies/</link><guid isPermaLink="true">https://kaifaty.github.io/GothicAI/posts/bodies/</guid><pubDate>Mon, 12 Oct 2026 23:10:00 +0300</pubDate><description>Feet that stand on slopes, eyes that follow you, runners that lean into turns, blows that throw the body back: the same scenes with our animation work off and on.</description><content:encoded>&lt;p&gt;Characters that talk back need bodies that react too. Over the last days the people and creatures of
Gothic II learned to stand on uneven ground, to notice you, to lean when they run and to give way when
they are hit. The short shows the same scenes twice: on top OpenGothic as it is, below with our
animation work switched on.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;Frames of the short: feet on a slope, a wolf, a farmer&#x27;s gaze, leaning into a turn; our animation off on top, on below&quot; src=&quot;https://kaifaty.github.io/GothicAI/media/bodies/sheet-en.jpg&quot;&gt;&lt;/p&gt;
&lt;h2&gt;What changed&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Feet stand on the ground.&lt;/strong&gt; On a slope or a stair both feet touch it: a knee bends, the hips go down.
Wolves and molerats stand on all four paws, and their bodies tilt and roll with the ground.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;They notice you.&lt;/strong&gt; In a conversation a character turns to whom it talks to: the head first, the chest
and the waist for larger turns. Outside a conversation it notices the hero coming within a few metres, a
drawn weapon, a fight nearby. It looks for a few seconds, loses interest, and looks again when you have
moved on.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Runners lean.&lt;/strong&gt; Into a turn by how fast they run and how sharply they turn (up to 14 degrees), forward
up a slope and a little back down one.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Blows throw the body.&lt;/strong&gt; Every hit bends the upper body away from where it came from: a sword swung from
the side pushes along the blade, an arrow along its flight, a hit off the middle twists the trunk, and
the head lags behind and swings back. It is as strong as the blow hurt, on top of the game&amp;rsquo;s own stumble,
and it also comes where the game plays no reaction at all. On top of the stumble it is subtle, which is
why the short does not show it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Smoother switches between animations.&lt;/strong&gt; When a run stops or a walk turns into a run, the new animation
now plays at once and the difference to the old pose fades out instead of a frozen first frame or a jump:
the largest jump of a joint when a run stops went from 70 cm to 20.&lt;/p&gt;
&lt;p&gt;All of it runs on top of the animations of the game, as passes over the skeleton the engine has already
posed; nothing in the game&amp;rsquo;s files is changed.&lt;/p&gt;
&lt;h2&gt;How it was tested&lt;/h2&gt;
&lt;p&gt;Each of these was tuned on the test bench: it plays a scenario inside the game, records video and
per-frame metrics, and reports suspicious frames, a foot sinking into a step, a head jerking, a flinch
that does not come back. The bench also found a freeze in the engine itself: under load the renderer
could wait forever for a thread that had missed its signal; it is fixed now.&lt;/p&gt;
&lt;h2&gt;What we keep honest&lt;/h2&gt;
&lt;p&gt;Both halves of every scene are the same scripted run on the same build of the engine, played twice: once
with our animation switched off, once with it on. The top is OpenGothic, not the original game&amp;rsquo;s
executable. The scenes are set up for the camera: the hero cannot be hurt, the farmer is held in place so
that his routine does not take him away. The game&amp;rsquo;s own sound is from the run below; the picture is a
little brighter than the game for phone screens.&lt;/p&gt;
&lt;h2&gt;Next&lt;/h2&gt;
&lt;p&gt;Feet that stay on the ground during sword swings on a slope, and the upper body turning to an enemy
above or below in melee.&lt;/p&gt;
&lt;p&gt;The project is not playable yet: it runs from source on macOS and needs your own copy of Gothic II: Night
of the Raven. The engine is &lt;a href=&quot;https://github.com/Try/OpenGothic&quot;&gt;OpenGothic&lt;/a&gt;; the tools that filmed this
are in the repository: &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/shorts/compare&quot;&gt;&lt;code&gt;shorts/compare&lt;/code&gt;&lt;/a&gt;
and the &lt;a href=&quot;https://github.com/kaifaty/GothicAI/tree/main/scripts/bench&quot;&gt;test bench&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title>The shorts film themselves</title><link>https://kaifaty.github.io/GothicAI/posts/shorts-by-the-agent/</link><guid isPermaLink="true">https://kaifaty.github.io/GothicAI/posts/shorts-by-the-agent/</guid><pubDate>Mon, 12 Oct 2026 20:00:00 +0300</pubDate><description>A scene is written as a script; the hero speaks with a synthetic voice, the characters hear it through speech recognition and answer live, and the cut comes out as a vertical short.</description><content:encoded>&lt;p&gt;To show what the characters can do we need videos, and recording them by hand is slow: every answer is
different, so a good moment takes several tries. So the coding agent that works on the project now films
the shorts itself, with nobody at the keyboard.&lt;/p&gt;
&lt;h2&gt;How a short is made&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;A script.&lt;/strong&gt; A short is a small file: the hook, the hero&amp;rsquo;s lines, where the camera stands. For the first
   one the hero tries to fool Xardas: &amp;ldquo;Lee sent me. He said you&amp;rsquo;d give me your staff.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The hero&amp;rsquo;s voice.&lt;/strong&gt; The lines are voiced once by text-to-speech with a voice designed from a
   description. Nobody&amp;rsquo;s voice is cloned.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The take.&lt;/strong&gt; The game runs on the test bench. The bench holds the talk key while the recording plays;
   the AI server hears it through the same speech recognition as a player&amp;rsquo;s microphone, and Xardas answers
   with the language model, in his voice. The bench films it, together with the game&amp;rsquo;s own sound.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Several takes.&lt;/strong&gt; The answers differ every time, so the agent films a few, reads what was said in
   each, and picks the one that carries the idea.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The cut.&lt;/strong&gt; The pauses while the model thinks are cut down to a beat, the hero&amp;rsquo;s voice is mixed in,
   subtitles go on, and out comes a 1080×1920 short in Russian or English.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img alt=&quot;Frames of the cut short, with subtitles&quot; src=&quot;https://kaifaty.github.io/GothicAI/media/shorts-by-the-agent/sheet-en.jpg&quot;&gt;&lt;/p&gt;
&lt;p&gt;In the take we kept, Xardas refuses twice and then sees through it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;And stop hiding every request behind Lee&amp;rsquo;s name.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Nobody wrote that line.&lt;/p&gt;
&lt;h2&gt;What we keep honest&lt;/h2&gt;
&lt;p&gt;The answers are not edited and not picked line by line: a take is used whole or not at all. Only the
silence while the model thinks is shortened, and the description of every short says so. The hero&amp;rsquo;s voice
is synthetic and says exactly the script; what the characters heard is in the take&amp;rsquo;s transcript, mistakes
of the speech recognition included.&lt;/p&gt;
&lt;h2&gt;What it took&lt;/h2&gt;
&lt;p&gt;The bench records the game&amp;rsquo;s sound by mixing it into the recording frame by frame instead of playing it,
so the video and the sound never drift apart. The game has to keep to real time while it films, because
the AI server lives in real time; drawing only the recorded frame and encoding on the GPU got it to
96-99% of real time at 972×1728. One of the first takes lost an answer to an overloaded language model;
the summary of every take shows that, and the take is filmed again.&lt;/p&gt;
&lt;p&gt;The tool is in the repository, in &lt;code&gt;shorts/&lt;/code&gt;.&lt;/p&gt;</content:encoded></item><item><title>Three days in: characters that talk back</title><link>https://kaifaty.github.io/GothicAI/posts/three-days/</link><guid isPermaLink="true">https://kaifaty.github.io/GothicAI/posts/three-days/</guid><pubDate>Mon, 12 Oct 2026 12:00:00 +0300</pubDate><description>What came together in the first three days: voice in, voices out, actions, memory, two minds for every character, and feet that stand on the ground.</description><content:encoded>&lt;p&gt;Gothic AI started on October 10 with a question: what if the people of Gothic II could actually hear you?
Three days and about eighty commits later, they can.&lt;/p&gt;
&lt;p&gt;The game is the original Gothic II: Night of the Raven, running on the open-source
&lt;a href=&quot;https://github.com/Try/OpenGothic&quot;&gt;OpenGothic&lt;/a&gt; engine. Inside the engine sits a thin bridge; everything
clever runs in a separate AI server next to the game.&lt;/p&gt;
&lt;h2&gt;What works&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;You talk with your voice.&lt;/strong&gt; There is no chat window: you hold T, walk up to someone and speak. Speech
recognition (Voxtral) turns it into text while you are still talking, and the server works out whom you
addressed, from where you look and what you say.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;They answer with voices of their own.&lt;/strong&gt; Each character gets a voice designed from a description of it,
not cloned from the original actors. The voice starts while the answer is still being generated, so the
first words come quickly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;They act, not only talk.&lt;/strong&gt; Characters follow you, give you items, draw weapons, fight or run away. A
conversation can end in a deal, or in a fight.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;They remember.&lt;/strong&gt; Conversations are remembered per save game: load an older save and the characters forget
what happened after it. Bystanders overhear what you say to someone else, which matters, because lying is
meant to be part of the game.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Two minds per character.&lt;/strong&gt; A small model, fine-tuned on scenes from Gothic, runs the body: the daily
routine, reactions to a drawn sword, fleeing or fighting, in a fraction of a second. The large language
model does the talking and sets intentions. The body reacts first, the words follow.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Feet on the ground.&lt;/strong&gt; Not AI, but you notice it at once: with foot IK people stand on slopes and stairs
with both feet, and wolves and molerats with all four paws, instead of hovering above the ground.&lt;/p&gt;
&lt;h2&gt;The tooling around it&lt;/h2&gt;
&lt;p&gt;A launcher starts the game and all the services with one button. A test bench plays scenarios inside the
game on its own and records video, metrics and a report of suspicious frames, which is how the foot IK was
tuned without anyone watching the screen.&lt;/p&gt;
&lt;h2&gt;Next&lt;/h2&gt;
&lt;p&gt;The story layer. We are lifting the dialogues of the original scripts into a graph that an AI director can
edit, to build quests on top of the original story rather than instead of it, and to make lies to the
characters work and have consequences.&lt;/p&gt;
&lt;p&gt;The project is not playable yet: it runs from source on macOS and needs your own copy of the game.&lt;/p&gt;</content:encoded></item></channel></rss>
