{"id":5505,"date":"2022-03-19T18:50:42","date_gmt":"2022-03-19T18:50:42","guid":{"rendered":"https:\/\/www.hemispheregames.com\/?p=5505"},"modified":"2022-03-19T22:16:11","modified_gmt":"2022-03-19T22:16:11","slug":"physics-based-animation-in-gibbon-beyond-the-trees","status":"publish","type":"post","link":"https:\/\/www.hemispheregames.com\/new_blog\/2022\/03\/19\/physics-based-animation-in-gibbon-beyond-the-trees\/","title":{"rendered":"Physics-Based Animation in Gibbon: Beyond the Trees"},"content":{"rendered":"<p><a href=\"https:\/\/www.gibbongame.com\/\"><span style=\"font-weight: 400;\">Gibbon: Beyond the Trees<\/span><\/a><span style=\"font-weight: 400;\">, a game I\u2019ve been collaborating on over the last few years with the awesome folks at Broken Rules, <\/span><a href=\"https:\/\/apple.co\/-Gibbon\"><span style=\"font-weight: 400;\">came out on Apple Arcade<\/span><\/a><span style=\"font-weight: 400;\"> a few weeks ago.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">It\u2019s an endless-runner style game in which the player controls a gibbon that can swing, slide, and somersault their way through the jungle, and beyond. It\u2019s a beautiful game, not only visually, but aurally and narratively as well. (I may be biased. ;-)<\/span><\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><\/p>\n<div class=\"videoContainer\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/vcG7VMZELWQ?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/div>\n<p><\/span><\/p>\n<p><span style=\"font-weight: 400;\">One of the things people have been remarking on is the game\u2019s \u201cfluid animation,\u201d so we thought it\u2019d be fun to blog about that, as we definitely put a lot of work into that aspect. Here I\u2019ll focus on the game\u2019s procedural animation (what\u2019s seen during gameplay) as opposed to the wonderful cut-scene animations, created by Simon Griesser and ingeniously integrated into the game by Vivien Schreiber.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The first thing you need to know is this: gibbons are amazing. If you\u2019ve never seen a gibbon \u201cbrachiate\u201d (swing from handhold to handhold), watch this:<\/span><\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><\/p>\n<div class=\"videoContainer\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/U3JhwjNfx_g?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;start=56&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/div>\n<p><\/span><\/p>\n<p><span style=\"font-weight: 400;\">Such fluid swinging is what <\/span><a href=\"https:\/\/twitter.com\/brokenrules\/status\/1495688870347915266\"><span style=\"font-weight: 400;\">inspired Felix<\/span><\/a><span style=\"font-weight: 400;\"> to try to create a game that would convey the sense of joy and freedom-of-movement that gibbons must feel.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">He began working on a prototype, but found the movement to be quite complex, and elusive to capture, so he branched out\u2026<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Animation mockups can be a great way to explore and sketch out a game\u2019s identity, without requiring it to be fully built. So Felix and Clemens worked with their office-mate, Sascha Vernik (with audio by Almut Schwacke), to create the following mockup:<\/span><\/p>\n<div style=\"width: 1920px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-5505-1\" width=\"1920\" height=\"1080\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon-movement-prototype-trimmed.mp4?_=1\" \/><a href=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon-movement-prototype-trimmed.mp4\">https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon-movement-prototype-trimmed.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">They also asked <\/span><a href=\"https:\/\/twitter.com\/Wolfire\"><span style=\"font-weight: 400;\">David Rosen of Wolfire Games<\/span><\/a><span style=\"font-weight: 400;\"> if he\u2019d be interested in creating a movement prototype of gibbon brachiation, running, and sliding. (David has a long history of creating cool, procedural animation systems, such as for their game Overgrowth.) Luckily he was up for the challenge, and created a system that was an awesome launching point for creating the full game. David also just published a video describing that prototype and the techniques he employed therein \u2013 required viewing for anyone interested in the subject!<\/span><\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><\/p>\n<div class=\"videoContainer\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/KCKdGlpsdlo?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/div>\n<p><\/span><\/p>\n<p><span style=\"font-weight: 400;\">I also joined the project around this time, and started to work with Felix on fleshing all this out into a playable game prototype. Our next steps were to\u00a0build a simple game world of branches, canopies, and vines, and have our gibbon start to move through it. Felix hit the world &amp; level building, and I got to work on having the gibbon move through this more complex terrain.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">An early capability we needed to give our procedural gibbon was the ability to transition from flying through the air, to swinging. (Prior to this, it could go from flying to running, and running to swinging, but not flying to swinging.) So I added this. But in doing so, I started to bump into some of the limitations of modeling swinging as a sine-wave. Questions arose, such as how to set the amplitude, frequency, and phase depending on the gibbon\u2019s incoming velocity. Also questions about how to pose\/pull the arms to get a decent sense of initial contact. I tried to connect things up, and it looked ok some of the time, but sometimes it looked kinda glitchy, and momentum often didn\u2019t feel like it was being conserved. And as we built out our trees and world, we found that this kind of transition happened very often, as did \u201claunches\u201d (releasing from swinging), which also felt quite discontinuous and unphysical.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So I felt we needed a swinging model that centred around handholds, to achieve nice transitions into and out of swinging. This was especially true in cases where our gibbon would do a single swing, on eg. a vertical branch, with no long-term sine-wave to follow.<\/span><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon_single_swing.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"wp-image-5512 size-full\" src=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon_single_swing.jpg?resize=1104%2C795&#038;ssl=1\" alt=\"\" width=\"1104\" height=\"795\" srcset=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon_single_swing.jpg?w=1104&amp;ssl=1 1104w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon_single_swing.jpg?resize=300%2C216&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon_single_swing.jpg?resize=768%2C553&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/gibbon_single_swing.jpg?resize=1024%2C737&amp;ssl=1 1024w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>a tracing of a single gibbon swing, from <a href=\"#bertram1\">[1]<\/a><\/em><\/p>\n<p><span style=\"font-weight: 400;\">So I tried a quick experiment, modeling our gibbon as a two-point rig &#8211; a hand and COM (center-of-mass) &#8211; to see how a handhold-centred approach to swinging could feel.<\/span><\/p>\n<div style=\"width: 960px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-5505-2\" width=\"960\" height=\"540\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/single_swinging_2_point_trimmed.mp4?_=2\" \/><a href=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/single_swinging_2_point_trimmed.mp4\">https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/single_swinging_2_point_trimmed.mp4<\/a><\/video><\/div>\n<p><span style=\"font-weight: 400;\">Despite the crude model, I liked the sense of contact and momentum transfer this approach gave. For instance, when falling from a great height, the gibbon\u2019s swing naturally converts their downward speed into some fast forward motion.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As for modeling a gibbon as a \u201cfurry ball\u201d with an arm sticking out, that didn\u2019t seem like such a poor simplification given videos like this:<\/span><\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><\/p>\n<div class=\"videoContainer\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/zX4-eMbpiHA?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/div>\n<p><\/span><\/p>\n<p><span style=\"font-weight: 400;\">Something else emerged from this approach that I hadn\u2019t initially thought about; but as I read papers on the subject (<\/span><a href=\"https:\/\/onlinelibrary.wiley.com\/doi\/10.1002\/ajpa.20156\"><span style=\"font-weight: 400;\">this one<\/span><\/a><span style=\"font-weight: 400;\"> in particular) and watched videos of gibbons swinging, it became clear there was a strong relationship between a gibbon\u2019s velocity and where it wanted its next handhold to be. Specifically, gibbons ideally want their \u201cgrab arm\u201d to be reaching out perpendicularly to their velocity. In this way, the swing is initiated smoothly, with no discontinuities in the gibbon\u2019s COM velocity \u2013 just a new (perpendicular) force applied, causing a smooth rotation. Anything else causes a \u201ccollisional energy loss\u201d, and possibly some serious arm strain or whiplash.<\/span><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/IMG_0350.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5536\" src=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/IMG_0350.jpg?resize=1887%2C1331&#038;ssl=1\" alt=\"\" width=\"1887\" height=\"1331\" srcset=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/IMG_0350.jpg?w=1887&amp;ssl=1 1887w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/IMG_0350.jpg?resize=300%2C212&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/IMG_0350.jpg?resize=768%2C542&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/IMG_0350.jpg?resize=1024%2C722&amp;ssl=1 1024w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><em>gibbons ideally want their \u201cgrab arm\u201d to be perpendicular to their velocity<\/em><\/p>\n<p><span style=\"font-weight: 400;\">I should note that,\u00a0given the high speeds in our game, I focused on &#8220;ricochetal&#8221; brachiation, in which there&#8217;s an aerial phase between handholds, and things behave quite elastically. Real gibbons also use &#8220;continuous contact&#8221; brachiation, at slower speeds, for which the COM-path looks different; but we weren&#8217;t really operating in that regime. Anyways, it seems this idea of minimizing collisional energy loss is a key in \u201cunderstanding locomotion using limbs in any terrestrial environment.\u201d <a href=\"#bertram1\">[1] <\/a>\u00a0 The upshot is this gave clear guidance on where a gibbon should be looking for handholds at any given instant, as well as what pose a gibbon adopts in the air as they approach a handhold. Useful knowledge for a procedural animation system! (You may have noticed this detail in where the black-dot \u201chand\u201d is in the video above \u2013 constantly adjusting based on velocity.)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">On the downside, this system didn&#8217;t really plan ahead, treating all swingable points as equal, regardless of what tree or branch the handhold was on. This ran counter to Felix\u2019s vision for the project. He wanted the game to feel smooth and intuitive, with gibbons brachiating along the lengths of branches \u201cautomatically\u201d, almost like a flowy rhythm game \u2013 not twitchy, requiring players to give input for every handhold. This made perfect sense. It was important both from a gameplay perspective, so that players could relax and predict where they were going as they followed a branch, and in terms of realism \u2013 gibbons generally swing along branches; they don\u2019t treat the jungle as a disconnected scattering of handholds.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">At this stage I wasn\u2019t sure how to solve the ballistic-planning problem (more on that later) of getting this handhold-centred system to always follow branches. So I combined the two, using this new \u201cfree-swing\u201d system for single swings and swing initiation (first grab from the air), and blending that into the sine-wave system for subsequent brachiation until the end of a given branch. Here\u2019s how that looked.<\/span><\/p>\n<div style=\"width: 960px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-5505-3\" width=\"960\" height=\"540\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/mixed_swinging.mp4?_=3\" \/><a href=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/mixed_swinging.mp4\">https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/mixed_swinging.mp4<\/a><\/video><\/div>\n<p><span style=\"font-weight: 400;\">Still rough, but it worked. As you can see, I was using the free-swing for canopies and for vines (modified) as well, which made pursuing this approach all the more compelling. (<\/span><span style=\"font-weight: 400;\">I had also done a first pass on deformable trees and vines at that point, but to stay focused here I\u2019ll leave those details for another time.)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">A general topic I\u2019d like to point out here is the whole LOD (level of detail) approach to procedural animation. David\u2019s approach of modeling the COM, then \u201cmapping\u201d that to the 5-point rig (which was a <\/span><span style=\"font-weight: 400;\">fantastic<\/span><span style=\"font-weight: 400;\"> design choice), then mapping that (including some inverse kinematics) to a \u201ccomplete\u201d, 14-point rig, and finally mapping that to the display rig\u2019s bones (including joint rotations), was a great structure to work with. It provides a certain simplicity and abstraction at each level, allowing the \u201cprocedural animator\u201d to focus on the important aspects at that level, without the system becoming too complex. And as we move upwards, the pieces that were computed at lower levels become constraints on the higher LODs, making sure the important movements (like COM continuity, hand contact, etc.) don\u2019t get lost. It\u2019s a sweet combination, allowing for both control and nuance. In particular, it allowed me to add the 2-point swinging rig into the LOD chain in a very natural way.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Before I go on, there\u2019s one more free-swing experiment I\u2019d like to share, in which I allowed the gibbon to move right-to-left as well, going back and forth on the same branch. We didn\u2019t use this, as it didn\u2019t fit the game, but it was fun to watch.<\/span><\/p>\n<div style=\"width: 960px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-5505-4\" width=\"960\" height=\"540\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/single_branch_2_point_swinging.mp4?_=4\" \/><a href=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/single_branch_2_point_swinging.mp4\">https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/single_branch_2_point_swinging.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<h1><span style=\"font-weight: 400;\">Ballistic Planning<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">Next, I wanted to try to solve the \u201cballistic planning\u201d problem, so I could use the free-swing approach for <\/span><i><span style=\"font-weight: 400;\">all<\/span><\/i><span style=\"font-weight: 400;\"> swings, while still following a branch. The idea would be to have a two-phase brachiation system: a swing phase and a ballistic phase. The gibbon would (1) grab a handhold at some incoming velocity and angle; (2) swing on it until a given release angle; (3) fly ballistically (ie. under gravity) until coming to the next handhold, and repeating the loop until the end of the branch. Here\u2019s some simple example geometry to visualize this.<\/span><\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_planning-1.jpg?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5545\" src=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_planning-1.jpg?resize=1685%2C982&#038;ssl=1\" alt=\"\" width=\"1685\" height=\"982\" srcset=\"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_planning-1.jpg?w=1685&amp;ssl=1 1685w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_planning-1.jpg?resize=300%2C175&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_planning-1.jpg?resize=768%2C448&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_planning-1.jpg?resize=1024%2C597&amp;ssl=1 1024w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Sounds simple enough, but the key was to connect the release (2) of each swing (its angle and speed) so the gibbon would end its ballistic trajectory with its hand at the next, chosen\/planned handhold, and with its velocity perpendicular to its grab-arm vector. And while we have some flexibility in setting the launch speed, we wanted things to look smooth and natural, so we had to avoid any strong boosts or slowdowns. We also wanted to keep the gibbon\u2019s speed between some upper and lower thresholds, so the gibbon wouldn\u2019t stall, or start flying super fast.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To give some intuition about this problem, consider that for speeds below some threshold, there is no solution. Beyond that, there\u2019s an infinite range of solutions. Regardless, even for a given, valid speed, I couldn\u2019t find an analytic solution to the problem. (ie. no closed form equation that you can just plug some numbers into and get an answer, such as release angle, out.)<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So, as I learned in computer science when facing a tricky-to-solve optimization problem, I went with a stochastic approach: guessing, scoring, and picking the best option. I also used an iterative approach to refine each guess.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">I\u2019d start by randomly picking (in a desired range) an average COM-speed for the arc, a launch angle, and a grab angle. This would allow me to compute the COM positions at release and at grab. Based on that I could compute flight time, and launch velocity required. This in turn allowed me to compute a new, refined release angle and grab angle (based purely on velocities), which in turn gave me new COM positions, etc, etc. After about five to ten iterations of this, the calculation would converge (as I had hoped when designing the algorithm), and I\u2019d have an accurate arc for that speed.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">I would then score that arc, based on some desired parameters. For instance, some of these guesses would give some pretty crazy, high arcs. These would get a bad score. I\u2019d also significantly penalize the score of a solution that required a significant change in the gibbon\u2019s momentum during their swing from positions (1) to (2). Some \u201cmuscle work\u201d was ok \u2013 even good, depending on what we wanted for gameplay purposes \u2013 but too much looked discontinuous, as though our gibbon had gotten a rocket boost, or hit a wall.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">After a bunch of these stochastic, iterative solutions, I\u2019d pick the one with the best score, and voila: a \u201cgood\u201d solution! Hopefully, anyways. I did end up tweaking the ballistic planner\u2019s scoring function from time to time over the next 1.5 years of the project! (To pick more preferable solutions, and sometimes adding strong penalties to avoid some extreme edge cases.)<\/span><\/p>\n<p>Of course, things never quite line up perfectly. I had to allow for some tolerances in all these systems: grabs where they aren&#8217;t ideal (but where players still expect them), vectors not being quite perpendicular, arm-bend\/stretch, etc. The code required some extra variables here, some blends there, a little accounting to re-inject any lost energy (except where we intentionally bleed speed), some velocity &#8220;projection&#8221;, etc. Various devils in the details.<\/p>\n<p><span style=\"font-weight: 400;\">Sometimes I wondered if I was going too far down this rabbit hole. Don\u2019t get me wrong: I do enjoy this kind of problem. But projects have finite budgets, and I wasn\u2019t always sure if this kind of improvement was \u201cworth it\u201d. But on the whole I felt it was \u2013 especially in our increasingly complex levels with branches of various lengths (short and long) to traverse. That said, I wanted to do an apples-to-apples comparison; so I went back to David\u2019s original test scene, the one with the gibbon traversing that \u201cinfinite\u201d terrain, to see how they compared in that context. Here\u2019s the before and after:<\/span><\/p>\n<div style=\"width: 960px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-5505-5\" width=\"960\" height=\"540\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/sine_wave_brachiation_trimmed.mp4?_=5\" \/><a href=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/sine_wave_brachiation_trimmed.mp4\">https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/sine_wave_brachiation_trimmed.mp4<\/a><\/video><\/div>\n<p style=\"text-align: center;\"><em><span style=\"font-weight: 400;\">original sine-wave brachiation<\/span><\/em><\/p>\n<div style=\"width: 960px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-5505-6\" width=\"960\" height=\"540\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_brachiation_trimmed.mp4?_=6\" \/><a href=\"https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_brachiation_trimmed.mp4\">https:\/\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/ballistic_brachiation_trimmed.mp4<\/a><\/video><\/div>\n<p style=\"text-align: center;\"><em><span style=\"font-weight: 400;\">new two-phase, ballistic brachiation (+ fancy new model from Simon!)<\/span><\/em><\/p>\n<p><span style=\"font-weight: 400;\">In this \u201cinfinite swinging\u201d context, with no discontinuities to deal with, it wasn\u2019t as big an improvement, but it still felt more natural and physical to me. I\u2019m curious to hear what others think.<\/span><\/p>\n<h1><span style=\"font-weight: 400;\">Conclusion<\/span><\/h1>\n<p><span style=\"font-weight: 400;\">After &#8220;basic&#8221; brachiation, and as the team and project expanded,<\/span><span style=\"font-weight: 400;\">\u00a0we continued to work on a number of animation, physics, and gameplay fronts. I could dive into the details around vine swinging, canopies, and cables; also backflips, bouncing, and pair throws(!); our air-planner and contextual controls; our &#8220;friend AI&#8221;; the 2.5D nature of the game; blending procedural and artist\/fbx animations and poses; bird flight and quadruped monkey-running; etc. I&#8217;ll save those details for another time, though I&#8217;d be happy to hear if any of those are of particular interest.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For now, I&#8217;ll just sign off with a snippet of how the game looked when we shipped it last week:<\/span><\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><\/p>\n<div class=\"videoContainer\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/5JYiBMVdnJg?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/div>\n<p><\/span><\/p>\n<p><span style=\"font-weight: 400;\">Thanks for reading! And as always, questions and feedback are welcome.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\"><a id=\"bertram1\"><\/a>[1]\u00a0<\/span><span style=\"font-weight: 400;\"><a href=\"https:\/\/onlinelibrary.wiley.com\/doi\/10.1002\/ajpa.20156\">New Perspectives on Brachiation Mechanics<\/a>, John E.A. Bertram<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gibbon: Beyond the Trees, a game I\u2019ve been collaborating on over the last few years with the awesome folks at Broken Rules, came out on Apple Arcade a few weeks ago. It\u2019s an endless-runner style game in which the player controls a gibbon that can swing, slide, and somersault their way through the jungle, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5579,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[3],"tags":[],"class_list":["post-5505","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.hemispheregames.com\/new_blog\/wp-content\/uploads\/2022\/03\/GibbonTitleShot-1.jpg?fit=1714%2C912&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p5C9wi-1qN","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/posts\/5505","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/comments?post=5505"}],"version-history":[{"count":5,"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/posts\/5505\/revisions"}],"predecessor-version":[{"id":5577,"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/posts\/5505\/revisions\/5577"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/media\/5579"}],"wp:attachment":[{"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/media?parent=5505"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/categories?post=5505"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hemispheregames.com\/new_blog\/wp-json\/wp\/v2\/tags?post=5505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}