<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jan Schneider on Medium]]></title>
        <description><![CDATA[Stories by Jan Schneider on Medium]]></description>
        <link>https://medium.com/@jacasch?source=rss-6573d49ac216------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DRvUL1YclemeTMz79gnv4w.jpeg</url>
            <title>Stories by Jan Schneider on Medium</title>
            <link>https://medium.com/@jacasch?source=rss-6573d49ac216------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:07:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jacasch/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Holes in Games]]></title>
            <link>https://medium.com/@jacasch/holes-in-games-f689b647d9eb?source=rss-6573d49ac216------2</link>
            <guid isPermaLink="false">https://medium.com/p/f689b647d9eb</guid>
            <category><![CDATA[shaders]]></category>
            <category><![CDATA[game-design]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[rendering]]></category>
            <dc:creator><![CDATA[Jan Schneider]]></dc:creator>
            <pubDate>Thu, 13 Jun 2024 14:52:44 GMT</pubDate>
            <atom:updated>2024-06-13T16:28:56.374Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Holes are Made in Games</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*7BikcvD7WtjRWgB12GJQcQ.gif" /><figcaption>Driving through a building in Teardown (Source: <a href="https://youtu.be/TWfeWtv7Iww">https://youtu.be/TWfeWtv7Iww</a>)</figcaption></figure><p>Before I started to make games myself, I was never particularly impressed by games that allow you to make holes in the world… I guess I just never gave it much thought. Afterall it’s just a hole isn’t it?</p><p>But when I myself had to implement dynamic holes in our game <a href="https://store.steampowered.com/app/1435750/Ultimate_Godspeed/">Ultimate Godspeed</a>, I started to do some research on how games actually do it, and was pretty amazed. So I thought I’d share this with you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*dteLPvRB7g9OMO2JzZLqXw.gif" /><figcaption>Falling into a hole in <a href="https://store.steampowered.com/app/1435750/Ultimate_Godspeed/">Ultimate Godspeed</a></figcaption></figure><p>From a technical perspective holes are very interesting, and there are many ways to actually “punch” an opening in some geometry. We will take a closer look at 4 particular techniques.</p><ul><li>CSG Holes</li><li>Modular Holes</li><li>Voxel Holes</li><li>Masked Holes</li></ul><h3>CSG Holes (Constructive Solid Geometry)</h3><p>If we have some knowledge of 3D modeling techniques, the first thing that comes to mind would be <strong>boolean operations.</strong> This is a very common technique to combine meshed or subtract them from each other. The general term for this procedure is called <strong>Constructive Solid Geometry</strong> or short <strong>CSG</strong>.</p><p>Many game engines actually have some kind of CSG system to do level block-outs. Here you can see the <strong>Unreal Editor </strong>and the <strong>Hammer Editor</strong> in Action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*jW115YUF3I-1HYAmCKKTRQ.gif" /><figcaption>CSP System in Unreal Engine (Source: <a href="https://youtu.be/OtN4eIxoYJU">https://youtu.be/OtN4eIxoYJU</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*agNZHkKjFCRZP1jHDp_vEg.gif" /><figcaption>“Carving” in the Hammer Editor (Source: <a href="https://youtu.be/fCLTotNpqsA">https://youtu.be/fCLTotNpqsA</a>)</figcaption></figure><p>It seems though that such a system is rarely used at runtime and more suited applications like Level Editors. While it works well for basic shapes, it can quickly introduce unwanted discontinuities and bugs when dealing with more complex or user-generated geometry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*AvlVHOS4KHmuXgXco5fvaw.png" /><figcaption>Example of stretched triangles. (Source: <a href="https://doc.cgal.org/latest/Polygon_mesh_processing/index.html">https://doc.cgal.org/latest/Polygon_mesh_processing/index.html</a>)</figcaption></figure><p>The generated Meshes also often consist of very stretched triangles, which is suboptimal for the performance of collision detection algorithms.</p><h3>Modular Holes</h3><p>Another Technique that is definitely used in a lot of games to dynamically punch holes, is what I call <strong>Modular Holes</strong>.</p><p>When a wall gets destroyed, it is instantly replaced by several predefined parts, that then brake apart. This makes it look like the wall actually broke into several parts, when in reality the model just got replaced by a new one.</p><p>Here are some examples from the Games <strong>Red Faction</strong> and <strong>Rainbow Six Siege</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*LTcHgCpBILTNu-pOKkVPYA.gif" /><figcaption>Red Faction (Source: <a href="https://youtu.be/S7txd9Ql8eg">https://youtu.be/S7txd9Ql8eg</a>)</figcaption></figure><p>This technique can be combined with other visual effects like debris or smoke and often looks really stunning.</p><p>The downside though is that every possible place for a hole must be predefined, and modeled. Of course a lot of this can also be done procedurally and doesn’t need a lot of manual work.</p><h3>Voxel Holes</h3><p>Probably the most intuitive approach for letting players make holes in things can be achieved using <strong>Voxel Holes</strong>.</p><h4>What Are Voxels?</h4><p>If you’re not familiar with 3D graphics, I will shortly explain what voxels are. Basically <strong>voxels are the 3D equivalent of 2D Pixels</strong>.</p><blockquote><em>“</em><a href="https://en.wikipedia.org/wiki/Voxel"><em>In 3D computer graphics, a voxel represents a value on a regular grid in three-dimensional space.</em></a><em> (Wikipedia)”</em></blockquote><p>In Contrast to mesh based 3D geometry, voxels are way more flexible when you want to modify every aspect of the world. This allows pretty much for free holes by design, because the whole world is built around a voxel grid — Remove some voxels (or make them empty) and you have a hole.</p><p><strong>Minecraft </strong>and <strong>Teardown </strong>are two examples where you can clearly see the voxels, because they really embrace their boxy nature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*7BikcvD7WtjRWgB12GJQcQ.gif" /><figcaption>Driving through a building in Teardown (Source: <a href="https://youtu.be/TWfeWtv7Iww">https://youtu.be/TWfeWtv7Iww</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*g1Z40Bvz1QC7J6oPkH8ZYg.gif" /><figcaption>Digging tunnels in Minecraft (Source: <a href="https://youtu.be/tAe9g8Hsdb8">https://youtu.be/tAe9g8Hsdb8</a>)</figcaption></figure><p>These games visually embrace the boxy nature of the voxel grid, but this is not a must. There are also other games, that use a voxel-like grid in the background and generate smoother meshes based on that grid. (The two games above actually also generate a mesh based on the voxel grid, but its done in a boxy way)</p><p>Here are two games that are doing something like that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*_-6A45CZfmFRhtRxkgoBaQ.gif" /><figcaption>Drilling inside a planet in Astroneer (Source: <a href="https://youtu.be/u5k0Pt7G0Io">https://youtu.be/u5k0Pt7G0Io</a>)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*IlQ0Mqfuos5UsrZ8W_vImQ.gif" /><figcaption>Drilling Machine in Space Engineers (Source: <a href="https://youtu.be/FQYB_supFbM">https://youtu.be/FQYB_supFbM</a>)</figcaption></figure><p>This way you enjoy many of the advantages of voxels while not having to make it look like a bunch of cubes.</p><p>If you’re interested on how these smooth meshes are generated you might want to take a look at an algorithm called <a href="https://en.wikipedia.org/wiki/Marching_cubes">marching cubes</a> or <a href="https://en.wikipedia.org/wiki/Isosurface">isosurfaces</a> in general.</p><h3>Masked Holes</h3><p>The last technique that I will be showing is also the one that&#39;s the most mind-blowing (at least to me) — I call it <strong>Masked Holes</strong> or also <em>fake holes</em>.</p><p>I call them <em>fake</em><strong> </strong>because they don’t actually modify a mesh or voxel grid. They are nothing but an illusion created using some cool rendering-tricks and shaders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*eK6bqxj83hdO0mRAlnDGrw.gif" /><figcaption>fake Hole / Portal (Source: <a href="https://youtu.be/SySnHIhiVgM">https://youtu.be/SySnHIhiVgM</a>)</figcaption></figure><p>This is often achieved by some kind of masking technique. There are different ways to do this in real-time rendering using Shaders. Basic implementation usually make us of StencilBuffers or ColorMasks.<br>Here are two very different examples, that both use different techniques to fake<strong> </strong>a hole.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*nnl1VcJxO8EdtJ2NoAXExw.gif" /><figcaption>Controlling the hole in Donut County (Source: <a href="https://www.youtube.com/watch?v=32ropZlZkd4&amp;t=40s">https://www.youtube.com/watch?v=32ropZlZkd4&amp;t=40s</a>)</figcaption></figure><p>In the game <strong>Donut County</strong> you actually play as a hole, and can make stuff fall into you. None of the above mentioned approaches would be feasible here, or would just lead to way more effort than simply <em>faking </em>the hole</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MpFUpx4uVgeh1thP.png" /><figcaption>Example of an Effect usign Stencil Buffers</figcaption></figure><p>However these approaches are often limited to sphere shaped holes and brake down from certain angles or when things obstruct the hole.</p><p>For our game <a href="https://store.steampowered.com/app/1435750/Ultimate_Godspeed/"><strong>Ultimate Godspeed</strong></a> we needed a more complex masking approach. We needed more complex holes that look correctly from all angles and maybe even add tunnels.</p><p>I stumbled over a technique called <a href="https://en.wikipedia.org/wiki/Depth_peeling"><strong>depth peeling</strong></a> in an <a href="https://developer.download.nvidia.com/assets/gamedev/docs/OrderIndependentTransparency.pdf">NVIDIA presentation about “Order Independent Transparency”</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QVdM91Eg0UF0mu6iVGUhEA.png" /><figcaption>“Depth Peeling” as illustrated by NVIDIA <a href="https://developer.download.nvidia.com/assets/gamedev/docs/OrderIndependentTransparency.pdf">here</a>.</figcaption></figure><h4>Better Depth Masking</h4><p>Inspired by this concept, I developed my own technique for generating what I call a <strong>depth mask</strong>. This mask is generated prior to rendering any other meshes that might need to be masked.</p><p>The core idea is to store their depth information of the masks into two textures. We need two textures because we need information about the front-face and back-face depths of the mask meshes. I created meshes that act as masks (i.e. for holes or tunnels). These textures are generated every frame before rendering the environment.</p><p>Afterwards, when rendering anything that needs to be masked, I simply check the pixel depth against this depth mask and discard the pixel if it’s inside a hole.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*RJ6E7xiwkvDaJWe54YkRUA.gif" /></figure><p>This effectively allows me to mask arbitrary shaped holes in any other geometry. One limitation is that I utilize three peeling layers (R, G, and B channels of the texture), which means viewing through more than three tunnels simultaneously is improbable. Any artefacts would likely only appear in very distant views, if at all.</p><p>We ended up discarding the Tunnels Idea, because of gameplay issues, but the technology is still there. I might dabble with this at a later point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*KsPLJuDrEjE6cUqiU5vWiA.gif" /><figcaption>Our advanced masking technique where you can see <strong>through </strong>(multiple) holes</figcaption></figure><p>I think <strong>Train Simulator</strong> probably uses a similar technique to cut holes in the terrain, by “masking” the entrance of tunnels so you can see through them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*7dW1ncTss1X5ERgG5CnE0g.gif" /><figcaption>Building a Tunnel in Train Simulator (Source: <a href="https://youtu.be/Uuy_dzzhZBA">https://youtu.be/Uuy_dzzhZBA</a>)</figcaption></figure><h3><strong>Collision</strong></h3><p>Everything we talked about above is of course only visual. But since games are meant to be played and not only looked and you probably want something or someone to go through or in the holes that you just made. To keep the illusion intact, we must also fake the Collisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*STYCDzearQ3xM_UQeXgujw.gif" /><figcaption>Collision with a fake hole (Source: <a href="https://youtu.be/cHhxs12ZfSQ">https://youtu.be/cHhxs12ZfSQ</a>)</figcaption></figure><p>This can be achieved pretty easily in some cases. For example by deactivating the collision with the ground when something is above the hole. The thing then just falls though the floor, but it looks like its falling inside the hole.</p><p>Of course the above mentioned techniques are often combined to create amazing looking effects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*z1d2XS4R1_W3sMy2N-lrUg.gif" /><figcaption>Rainbow Six Siege (Source: <a href="https://youtu.be/Wd38PVOYpZY">https://youtu.be/Wd38PVOYpZY</a>)</figcaption></figure><p>I think in Rainbow Six Siege they are using a combination of depth-masking with prebuilt segments and beautiful visual effects to shoot holes in the walls of buildings.</p><p>Also the bullet and explosion physics must take into account the dynamic holes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*Fgx0AIoA1s7XGwqUR0nQhw.gif" /><figcaption>Melting Rock Tech Demo (Source: <a href="https://www.reddit.com/r/Unity3D/comments/hqbfsq/i_made_a_gun_that_melts_rocks_in_hdrp_using/?utm_source=share&amp;utm_medium=web2x&amp;context=3">https://www.reddit.com/r/Unity3D/comments/hqbfsq/i_made_a_gun_that_melts_rocks_in_hdrp_using/</a>)</figcaption></figure><p>I stumbled upon this cool demo by <a href="https://www.reddit.com/user/FickleSwimming/">FickleSwimming</a>. They achieve really stunning dynamic destruction of a rock They converted the rock mesh to a signed distance field representation, so they can carve holes using clever masking techniques on actual meshes, and have particles collide with the carved “SDF”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f689b647d9eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Animation of Active Ragdolls in Games]]></title>
            <link>https://medium.com/@jacasch/animation-of-active-ragdolls-in-games-32ca9d98afc9?source=rss-6573d49ac216------2</link>
            <guid isPermaLink="false">https://medium.com/p/32ca9d98afc9</guid>
            <dc:creator><![CDATA[Jan Schneider]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 13:13:47 GMT</pubDate>
            <atom:updated>2020-03-02T13:13:47.031Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part III</h4><p>This is the third part of my Analysis of Active Ragdolls in Games. After we’ve investigated how games handles balance in the last post, in this post well look closer at animation. What techniques are used to drive the movement of active ragdolls.</p><p>I think its good to classify motion into two parts. <strong>Inside-Out</strong> motion and <strong>Outside-In</strong> motion.</p><h3>Outside-In Motion</h3><p>A widely used technique is what I call <strong>outside-in</strong> motion. It is when the end of a chain of bones (or just one) is attatched to a point or an object. It then follows the motion of this object. Thats why I sometimes also refer to this as <strong>target driven motion</strong>.</p><p>In traditional animation this term could maybe be referred to as <strong>inverse kinematics</strong>, but this term becomes <strong>obsolete </strong>when the motion is physically driven.</p><p>It is though <strong>inverse</strong> as in <em>inverse kinematics</em>, because the motion doesn’t originate from a bone at the top of the hierarchy (i.e. shoulder), but rather at the bottom (i.e. hand). But in contrast to inverse kinematics, here the joint positions inbetween don’t need to be calculated, but are simulated using physical constraints rather. Its more like pulling and pushing.<br>Furthermore, Motion can propagate through the whole body (i.e. not just to the shoulder)</p><h4>Examples</h4><p>In T.A.B.S. such target driven motion is used all over the place. The weapons and tools are attatched to the hands of the warriors. So when attacking one would think that surely there must be some force coming from the arm to swing the club and to then hit another forager on the head.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*wuQSn83ilymd8qYuVNgyXQ.gif" /><figcaption>a clubber fighting a shielder in T.A.B.S. (<a href="https://www.youtube.com/watch?v=l2-OZRgma8Q">source</a>)</figcaption></figure><p>But in fact the exact opposite is the case. It is pretty obvious that the motion originates from the weapon and not the warrior. This leads to some pretty horrendous looking movements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/0*RD-vcs7HvgC-aXJh" /><figcaption>a curve that defines the force applied to a weapon</figcaption></figure><p>In a very detailed article, Wilhelm Nylund, the dev of T.A.B.S. explains how many of the physics systems work. this is a Curve that defnies the force being applied to a weapon.</p><blockquote>To swing a weapon, a unit first saves the direction in which it wants to hit, which generally goes from the point of the weapon … Then, it defines the swing’s force with an animation curve. The curve starts at zero, then usually curves downwards for a moment, adding to the tip force <em>away</em> from the target, and then rises high, adding lots more force <em>towards</em> the target. “You get a bit of a wind-up, a tell that they will make a strike.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*KhmgtS1TSRi9Bxiv8ulifA.gif" /><figcaption>wheelbarrow in T.A.B.S. (<a href="http://y2u.be/AIu7IgDfUbM">http://y2u.be/AIu7IgDfUbM</a>)</figcaption></figure><p>Here you can see the wheelbarrow unit. The guy that would push the barrow is actually being pulled by it. This is probably easier to implement and it looks super funny!</p><p>The tentacles of Octodad also make us of such outside-in motion. <a href="https://www.gamasutra.com/blogs/KevinGeisler/20150330/240000/Octodad_Dadliest_Catch_PostMortem_Pt_4_Tech.php">According to the devs</a>, the player actually moves an invisible object with the joystick to witch the end of the tentacle is attatched to.</p><blockquote>…simply being a chain of same sized capsules with a tiny capsule on the end which is what the player controlled. …</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/0*BBCKb16yg4ZGu7Ri.jpg" /><figcaption>different rigs for octodad (<a href="https://bit.ly/3adxPGe">https://bit.ly/3adxPGe</a>)</figcaption></figure><p>The rest of the tentacles motion is physically simulated using a chain of bones, that are constrained together and can stretch. You can see how the arm overshoots and wiggles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*TfJKOpt_UsiWX9NfQLSytA.gif" /><figcaption>octodad moving one arm</figcaption></figure><p>Here you can clearly see that the motion of the arm doesn’t come from inside, but rather it looks like the arm is being pulled.</p><p>As I said earlier, target driven animation can influence the whole body and even the position of a character. In some games the player can for example hold on to something that is moving, to then move along with it.<br>This of course isn’t done to only create animation and movement, but also has a lot of gameplay impact. More to that in an other post.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*xfB7OsnZ8TuNxtPAPJrdAA.gif" /></figure><h4>Limitations of Target Driven Motion</h4><p>The phyiscality jerkyness that comes from target driven motion is nice, but it leaves behind more precise control for the joints that are not attatched to something. While this is mostly being embraced, movement often looks rather marionette-like.</p><h3><strong>Inside-Out Motion</strong></h3><p>There is another approach to create physical animation. I call it <strong>inside-out </strong>motion. By that I mean that I mean that the motion doesn’t come from the outside but rather from within the charater.</p><p>All the joints can modify their rotation applying the right torque.</p><h4>Static Animator Reenactment</h4><p>To get more controll on the animation, in Real Guys Wear Ties I used a technique that I call <strong>Static Animator Reenactment</strong>. I wanted to create a system that I can feed regular animation loops that could be hand authered by an animator or even use motion capture data (we didn’t do thayat though). And then use some kind of state machine and blending to switch between animations. Just like most regular animation systems would work.</p><h4>How It works</h4><p>The Idea is that there are 2 rigs. One is controlled by an animation system that uses normal bone animation and ignores any physicalities like collision or gravity. I call this the <strong>static reference</strong>. The second is the <strong>active rig</strong> and is whats actually visible (displayed using a skinned mesh). It is a full ragdoll, that constantly tries to mimic the static reference. Or more precise, every bone tries to rotate itself so that it matches the relative orientation to its parent bone in the reference rig.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*T3b-5UyTsBcpJz5kktoq-w.gif" /><figcaption>static animator (left) and active ragdoll (right)</figcaption></figure><p>Here I lowered the force of the active ragdoll, so you can see more clearly that it never matches the pose exactly but tries to do so. It looks a bit odd because the hip is fixed in place, and thus the character is not moving.</p><p>I found this gif of the system when it was bugging out. Here the bones target rotation is being falsely calculated. All the Movement just results from friction. #tubleweed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*Ix-VSXIKIdwHMWcFWhyIpQ.gif" /><figcaption>static animator (gray) and active ragdoll (colored)</figcaption></figure><h4>Limitations of Static Animator Reenactment</h4><p>This approach has a flaw though. While its easy to author good looking animation loops, it’s rather hard to make characters interact with the world more than just bouncing around when the hit something. You’d probably still want some movement thats target driven, to drive gameplay.</p><p>To combine these two approaches is pretty hard to do, because you’d either have to lessen the internal force for certain body parts to drive them from the outside, or modify the target rig to do what you want using inverse kinematics. But even then you’d still need to perfom some checks whether the hand is not actually stuck or anything.</p><h3>Gameplay</h3><p>In the Next post we will look closer at how such physical system acutally affect gameplay.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32ca9d98afc9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Balancing Of Active Ragdolls in Games]]></title>
            <link>https://medium.com/@jacasch/balancing-of-active-ragdolls-in-games-367f146b25fb?source=rss-6573d49ac216------2</link>
            <guid isPermaLink="false">https://medium.com/p/367f146b25fb</guid>
            <category><![CDATA[physics-animations]]></category>
            <category><![CDATA[ragdoll]]></category>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[active-ragdoll]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Jan Schneider]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 07:02:18 GMT</pubDate>
            <atom:updated>2020-03-05T08:22:52.121Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part II</h4><p>This is the second part of my <strong>In Depth Analysis of Physically Animated Characters in Games</strong>. In this post we will talk about the balancing of physical characters. We will look at possible approaches and analyse their benefits and drawbacks.</p><h3>The Need Of Balance</h3><p>In contrast to animation controlled characters, physically animated characters are not upright by default. In fact the exact opposite is the case.</p><p>Ragdolls are basically just chains of attatched body parts and thus react to physical influences and behave like dead bodies. In the <a href="https://medium.com/@junk.u.spam/analysis-of-active-ragdolls-in-games-82c95f8ed7a5">previous post</a> I explained that motors can be used to apply physical forces and make the ragdoll “active”, so it tries to get in to a certain pose.</p><p>But that doesn’t necessarily balance the character. Just because all joints are correctly rotated, the whole Ragdoll could still tip over and then just take the “correct” pose while laying on the floor for example.</p><p>Thats why its necessary to balance the ragdoll in some way or another.</p><h3>Balance Through External Forces</h3><p>A common and convenient approach is to use external forces (forces that dont originate from a joint motor). <br>Games like <a href="https://store.steampowered.com/app/285900/Gang_Beasts/"><em>Gang Beasts</em></a>, <a href="https://store.steampowered.com/app/477160/Human_Fall_Flat/"><em>Human: Fall Flat</em></a>, <a href="https://store.steampowered.com/app/224480/Octodad_Dadliest_Catch/">Octodad</a>, or <a href="https://store.steampowered.com/app/508440/Totally_Accurate_Battle_Simulator/"><em>Totally Accurate Battle Simulator</em></a> all use some sort of external forces to balance their characters. It’s hard to figure out the exact implementation form just looking at the games, but there are still a lot of things that can be observed.</p><h4><strong>Octodad</strong></h4><p>I found a nice <a href="https://www.gamasutra.com/blogs/KevinGeisler/20150330/240000/Octodad_Dadliest_Catch_PostMortem_Pt_4_Tech.php">blogpost</a> on gamasutra where the developers of <strong>Octodad</strong> talk a lot about their implementation. They state:</p><blockquote>To keep him (Octodad) upright and at all stable many small helper forces were needed. The main stabilizing force was an upward force on his head which pulled him up like a balloon.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*yAAsXVzQAJN1aw0lkqSJMQ.gif" /><figcaption>octodad walking around ( <a href="http://y2u.be/yEZVrqriMuw">http://y2u.be/yEZVrqriMuw</a>)</figcaption></figure><p>In some other games its also possible to fall down (lose balance) and then stand up again. This can be achived by temporarly disabling all balancing forces on the active ragdoll.</p><p>During this period of disabling and enablig the balancing forces one can see pretty well how it all works</p><h4>Human: Fall Flat</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*tziRZSyRhjO8LpJWAqnAWw.gif" /><figcaption>characters standing up in Human: Fall Flat (<a href="http://y2u.be/PtLSSmTIEYw">http://y2u.be/PtLSSmTIEYw</a>)</figcaption></figure><p>In <strong>Human: Fall Flat</strong> we can observe multiple things. After falling down the characters lie on the floor and don’t move. I think at this point pretty much all external forces (probably even internal joint forces) are disabled.<br>Then after a short time the characters become “concious” again and the get pulled up on what seems to be their chest.<br>A pretty neat detail is that shortly before they become upright, it seems that their feet “try” to go below the center of mass. Also the hips seem to move up before the chest does.<br>Maybe the hands are also somehow involved but its hard to deduce.</p><h4>Totally Accurate Battle Simulator (T.A.B.S)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*COgA98Jx2F-wWoSAljb0tg.gif" /><figcaption>standing up after attacking in tabs T.A.B.S. ( <a href="http://y2u.be/x9ztA3p4vw8">http://y2u.be/x9ztA3p4vw8</a>)</figcaption></figure><p>In <strong>T.A.B.S.</strong> this looks pretty similar. Some force is pulling the characters up at their chest or neck to make them upright again.<br>Different classes seem to have different recovery times and forces.<br>Whats also pretty intresting is that it seems that the tools are controlling the arms of the characters rather that the other way around. But we’ll look deeper into that when analysing the animation in these games.</p><p>In an article on rockpapershotgun this is described in more detail. Its an interiew with Wilhelm Nylund, game designer and CEO of Landfall Games, who made T.A.B.S. The article is very much worth a read.</p><blockquote>So to get a unit to stand, Nylund adds upwards forces on its torso and head which act like a marionette’s strings, pulling it upright. To ensure a unit only stands when there’s ground directly below it, he shoots a raycast with a length of around the unit’s height directly downwards from its head. Only if the raycast hits the ground is the upwards force added</blockquote><blockquote>Then, to make the unit stand firmly on its feet, the game checks whether its feet are touching the ground. If they are, then it checks how far the point of connection is from the head. The closer the head is to the point of collision, the more force is added, compelling it to stand up more vigorously; if it’s fully upright, then it gets less upwards force.</blockquote><p>Additionally to that pulling up they apparently also try to move the legs so that they can support the wheight of the bodies. Wilhelm Nylund, has stated in a <a href="https://www.gamasutra.com/view/news/326077/How_Landfall_Games_finds_the_fun_in_physics_engines.php">post on gamasutra</a>.</p><blockquote>The balance script adds force to the legs and feet to try to keep them in position to help support the body. For example, if both feet are in front of the bodies center of mass one of them needs to move backwards so that the character can stay balanced.</blockquote><h4><strong>My Approach For Real Guys Wear Ties</strong></h4><p>To balance the characters in <em>Real Guys Wear Ties</em> I also used external forces, but in a slightly different way than the games above did it. Basically the hip (root bone of the rig) was attatched to a point below the character. It was constrained so that it could only move around this point while keeping a certain distance (basically the length of the legs).<br>So the whole body could tilt and then snap back as if it was a spring.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*FMEYQb5spsQ1BrhcptYAxA.gif" /></figure><p>This had a lot of implications though. The point to which the hip was attatched to also controlled the movement of the whole character. And it was not that easy to change the distance of the hip to the floor. This was expecially painful if we wanted to play different animations like sitting for example.</p><p>Of course such external forces like in the eamples above would not exist in the real world, since all our forces that we need to walk come from muscles <strong>inside </strong>our bodies.<br>And while this may not look physically correct, it might not be noticed or could even add to the player experience, because it looks funny.</p><h4>More Sophisticated Balancing Techniques</h4><p>Recently I stumbled upon a project that is still in development by a developer named <a href="https://www.patreon.com/user?u=19043128">MetalCore999</a>. He is working on a lot of different gameplay systems building upon his implementation of active ragdolls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*PFf9TCga6pEEBW8_blgAJA.gif" /><figcaption>early dev footage ( <a href="http://y2u.be/xV7mSQwK1P4">http://y2u.be/xV7mSQwK1P4</a>)</figcaption></figure><p>The approach is pretty intresting, because his ragdolls balance themself without (or with very little) external force. The system can figure out if the character is stable or falling, and then tries to place the feet infront (or any other direction) accordingly to be stable again. Also the active ragdoll can stand up by using its limbs to push it off the ground, and then place the feet below.</p><p>This kind of inside-out approach and mimics the true behaviour of muscles much more closely.</p><p>When talking to <a href="https://www.patreon.com/user?u=19043128">MetalCore999</a>, he explained that he found many implementations of active ragdolls looked too much like they were marionettes being pulled on strings. He also didn’t like how they looked when they fell. Thats why he didn’t want to use a constant force to pull up the ragdolls, but rather satbilize them from the inside.</p><blockquote>Since most often the center of mass is located approximately in the pelvis region, the system notices if the center of mass is farther than the position of both feet in different directions, then the fall begins.</blockquote><p>Nonetheless he still has to use some tricks to stabilize the rig. He states that he locks the rotation of the pelvin in the X and Z axes (Unity 3D) because torque generated from movement from the upper body is hard to balance out with the legs.</p><blockquote>But the Unity physics engine is far from real, so I have to use some trick. I freeze the rotation of the pelvis along two axes (x, z) when the center of mass position is almost correct, just to help the pelvis align. But if the position of the center of mass is beyond the permissible limits, then I unfreeze all the axes of rotation. Thus, the character really tries to stand up using his hands, and when he almost succeeded, I help him in aligning his pelvis.</blockquote><p>He said he spent countless hours infront of a mirror to understand how humans atually balance themselves. A big inspiration were <strong>inverse pendulums. </strong>Like shown in this GIF.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*O_N-LMsciWYg7Gc456K1SQ.gif" /><figcaption>an inverse pendulum balancing itself (<a href="https://www.youtube.com/watch?v=a4c7AwHFkT8&amp;feature=youtu.be">source</a>)</figcaption></figure><p>There is also a lot of research being done on such things for real world applications. Biped (two legged) robots for example, like the ones developped by boston dynamic, also need to be able to walk and balance themselves without any external forces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Qsxf-rqqCU0zyO3OjTvNMA.gif" /></figure><p>But the more you go down that road, the more you get into heavy maths and physics and it become incredibly hard to achieve a certain behaviour. And I think thats whats cool about games. Nobody cares how it works or if its realistically simulated. We can and probably should cheat a lot, because in the end what counts is the look and feel.</p><h3>Animation</h3><p><a href="https://medium.com/@junk.u.spam/animation-of-active-ragdolls-in-games-32ca9d98afc9">In the next part</a> we will look deeper into animation and see what actually drives these active ragdolls.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=367f146b25fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis of Active Ragdolls in Games]]></title>
            <link>https://medium.com/@jacasch/analysis-of-active-ragdolls-in-games-82c95f8ed7a5?source=rss-6573d49ac216------2</link>
            <guid isPermaLink="false">https://medium.com/p/82c95f8ed7a5</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[active-ragdoll]]></category>
            <category><![CDATA[physics-animations]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[ragdoll]]></category>
            <dc:creator><![CDATA[Jan Schneider]]></dc:creator>
            <pubDate>Fri, 28 Feb 2020 10:48:43 GMT</pubDate>
            <atom:updated>2020-02-28T10:48:43.365Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part I</h4><p>Ragdolls have always intrigued me in games. Its just funny to see bodies collapse upon a car crash and fly through the air in <a href="https://www.rockstargames.com/games/info/V"><em>GTA </em></a>or lose balance in <a href="https://steep.ubisoft.com/game/en-us/home/"><em>Steep </em></a>and fall down a sheer endless cliff.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*gKkywlgIFF_sYauW0aYD4w.gif" /><figcaption>falling down a cliff in Steep (<a href="http://y2u.be/j3vITj5JuP0">http://y2u.be/j3vITj5JuP0</a>)</figcaption></figure><p>But that’s not what this series shall be about. We are going to look at active ragdolls.</p><h3>Active Ragdolls</h3><p>Ragdolls like the one shown above have been a thing in the video game industry for almost 2 decades now. <a href="https://en.wikipedia.org/wiki/Hitman:_Codename_47">Hitman: Codename 47</a> (2000) or Max Payne (2001) already had similar implementations (less complex of course).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ix937FmMLH18r-JJVrSsyQ.gif" /><figcaption>ragdolls in Max Payne (<a href="http://y2u.be/jMIoB1oWgpo">http://y2u.be/jMIoB1oWgpo</a>)</figcaption></figure><p>But in recent years more and more games have gone even further. Games like <a href="https://store.steampowered.com/app/224480/Octodad_Dadliest_Catch/"><em>Octodad</em></a>, <a href="https://store.steampowered.com/app/285900/Gang_Beasts/"><em>Gangbeast</em></a><em> </em>or <a href="https://store.steampowered.com/app/508440/Totally_Accurate_Battle_Simulator/"><em>Totally Accurate Battle Simulator (T.A.B.S.)</em></a><em> </em>have made use of so called active ragdolls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5pjx-LofCK-9f4dm65jjyg.png" /><figcaption>some games that made use of active ragdolls</figcaption></figure><p>They don’t just use physically constrained rigs to simulate dead bodies flying through the air and smashing into walls, but rather they use physical forces and joint motors to actively influence said ragdolls. Hence the term active ragdolls has been established.</p><p>If you want to dive deeper <a href="https://medium.com/@640Lab">640 Lab</a> has some more technical posts on how to build something similar yourself. also <a href="https://www.youtube.com/user/nimsony">Nimso Ny</a> has made some videos on his active ragdoll system and also <a href="https://www.reddit.com/r/Unity3D/comments/97tqc7/how_to_keep_active_ragdoll_upright_as_seen_here/e4cd4zp?utm_source=share&amp;utm_medium=web2x">answered some questions</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*JAOGCpEazUDFA4QscsHlFg.gif" /><figcaption>battle ine T.A.B.S. (<a href="http://y2u.be/XOsh20sNElw">http://y2u.be/XOsh20sNElw</a>)</figcaption></figure><p>Although all these games do many things different from a technical and from a game design stand point, they all still have one thing in common. All of them use physical forces to manipulate the rigs of the characters. And not only do these forces affect the visual appearence, but they also drive gameplay.</p><p>I think this is a pretty interesting topic from a game design perspective.</p><h3>My Own Experience</h3><p>During my studies in game design we (<a href="https://twitter.com/DeniseHohl">Denise</a>, <a href="https://www.linkedin.com/in/nathalie-meier-659334162/">Nathalie </a>and me) created a small adventure game “<a href="https://jacasch.itch.io/real-guys-wear-ties"><em>Real Guys Wear Ties</em></a><em>”</em> where you play as a parasitic, sexist, power-hungry tie.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qt7Ks3K0rIgIJNwOOjvY_A.png" /></figure><p>You can pull around the people that are wearing you (your hosts effectively), make them talk to each other, and try to eventually controll the CEO of a bank. We tried to embrace funny physical movement and there is a lot of symbolysim and criticism on patriarchal and capitalistic structures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*EbpvSxrznNi9ur9DR7Uaog.gif" /><figcaption>fun fact: it was originaly a bug, that the door spinns so fast. but we left it that way</figcaption></figure><p>Amongst other things I worked on the active ragdoll system for the game. It supported animation and movement based on the pulling of the tie.<br>While working on it I learned a lot about the technical requirements and implications such a system has.</p><p>Although we were pretty happy with the prototype that we managed to create, we realised nontheless that there still is a lot of stuff that would need to be reconsidered.</p><h3>Lookout</h3><p>Currently I’m reworking and rethinking the whole game concept as part of my bachelors thesis. I want to dive deeper into physical animation systems and active ragdolls and create gameplay that is more based on this physical interaction with the world.</p><p>Thats also the reason why I thought i’d share my research and do these little writeups. In this series we will analyse different games that made use of active ragdolls or physically animated characters. We will look at technical details on how they solved certain problems and also see how all of that affects gameplay.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82c95f8ed7a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>