<?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 Xiao Jiang on Medium]]></title>
        <description><![CDATA[Stories by Xiao Jiang on Medium]]></description>
        <link>https://medium.com/@bjjx1999?source=rss-db5f700816e7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zx6DEL1ipnKGreIpN6Qmtw.png</url>
            <title>Stories by Xiao Jiang on Medium</title>
            <link>https://medium.com/@bjjx1999?source=rss-db5f700816e7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 04:34:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bjjx1999/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[Serious Analysis of Game: GRIS (Mechanics)]]></title>
            <link>https://medium.com/@bjjx1999/serious-analysis-of-game-gris-mechanics-316503e78583?source=rss-db5f700816e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/316503e78583</guid>
            <category><![CDATA[game-analytics]]></category>
            <category><![CDATA[game-designer]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[game-design]]></category>
            <category><![CDATA[game-analysis]]></category>
            <dc:creator><![CDATA[Xiao Jiang]]></dc:creator>
            <pubDate>Sun, 06 Aug 2023 03:56:06 GMT</pubDate>
            <atom:updated>2023-08-06T04:05:39.305Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the first article in the series “Serious Analysis of Game” that I just start writing. As the book “The Art of Game Design” said, game designer give players an experience, and this experience could vary among players. If we try to ignore subjective feeling from different players, we can actually understand what the designer want us to feel. I am now trying to find a way that best describe the experience we get when playing a game and the goal of designers. I’ll write about game in these parts: mechanics, art, narrative, and audio. By that, I hope I can let you have a deeper understanding on why the game works or not, and eventually be more skillful when designing your game. The first game I pick for this series is GRIS, a platformer game released in 2018. In this article, I’ll only analyze its mechanic and leave other parts for next time.</p><p>First, I will define “mechanic feature” or just “feature” as a distinctive part within a specific mechanics. For example, when the the player learned how to swim, the depth they can dive into the water depends on the height they jump, and it does not change even if they jump as a stone. That is a mechanics feature, and I classify it this way because puzzles are constructed to challenge player’s understanding and skill in mechanics feature. When a new mechanic feature is introduced, various puzzles will followed with rising difficulty. Sometimes its the reverse way where puzzles come first and new features introduced later so the player can solve puzzles that block their way.</p><p>If you haven’t notice, most important difference between GRIS and most of other platformer games is that the player will never die or stuck. There is always a platform that catch player when they are falling and no matter how they messed up, there’s always a way back. Some levels are design to let player think they will die if they fall, but actually it’s just designer restricting the camera position, and a platform is in below. It effectively alleviate player’s mental stress and lower the difficulty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*e-SNUBqKVn_tXr9K" /><figcaption>When you think you are going to fall…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t5VRTta3QKug20yi" /><figcaption>It’s actually easy to get back</figcaption></figure><p>However, it does not make the game as simple as a walking simulator. Consider about other platformer games where you are defeated by enemies and you are revived and go challenge again. The process is similar as you missed a jump and have to do it over. They are all challenges or puzzles that designer want player to experience for various reasons, maybe to practice their skills or increase the design diversity so the level is not boring. It’s just their puzzles focus on different parts so that letting player die has no meaning in GRIS.</p><p>Since there’s no skills and enemy, environment become a main part to adding variations and create more diverse experience. Water is added in the middle of the game and at first player can only float on it. It makes player moves slowly and slower if they jump. But later when player can dive and dash, moving in water become more comfortable than on the ground. From then on, water of different shape starts to appear, like water square, water in middle of air, and so on. They make water a comfortable medium where player can move freely.</p><p>With that said, puzzles are set up to challenge player’s understanding of features, and puzzles can be mandatory or optional. Mandatory puzzles are there to help player learn necessary skill to continue the level, like you need to learn and practice basic arithmetic operations before learning equations. Here are few examples: after player learned the stone skill, they have to turn into a stone and walk pass a gust, and the gust will always take player back to the start position whereas player can still move forward with gust before learning the skill.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IR9V3W4bKXHAwn-D" /><figcaption>Player will force back to this position if they fail to solve the puzzle</figcaption></figure><p>It’s worth noting that the player is not required to master the skill, but only need to use it at right time. The threshold for jumping, for instance, is pretty low, meaning you don’t need to jump at right time and position to reach the platform, though the threshold is gradually change to increase the difficulty of the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*viWQEwqBBdVqK10x" /><figcaption>Earlier in game, if you free the butterflies, you still can’t use them because it’s not time yet</figcaption></figure><p>On the other hand, optional puzzles can give player more choices, it’s like two ways to solving a problem, one require deeper understanding to concepts and done in one step, the other need lots of steps but easier to work with. Another purpose for optional puzzles is to allow player to further challenge themselves, like achievements or so. GRIS use optional puzzles mainly for achievements since it has linear structure of levels. It’s important to understand that you can’t force player to experience anything, and whether player want to go for extra challenge depends on them. Designer can use rewards attract more players for challenge, but GRIS did not do that for mementos, which means they made mementos primarily to cater to players who seek more challenges and achievements.</p><p>As mentioned, mementos are challenges that can be complete by touching a specific point. They typically require player to going backward after they get certain ability, be skilled enough to perform certain tasks in limited time, or discovering the edge or hidden spots of a scene.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3POK4ZEW27WFZnir" /><figcaption>Making lots of jumps between platforms and utilize the gust</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TpxyOTqeuKFer0g2" /><figcaption>Come back after you learned the ability to get this one</figcaption></figure><p>In the game, you can see the only tip is which button you should press to use certain ability. Non of the challenges in game have tutorial written in words that tells you what is it and how to finish the challenge. Instead, most mechanics are conveyed through environment, such as windmills start to spin when gust is about to come, while the windmill inside shelter does not spin, indicating the cave is shelter. Nearly all challenges are well designed to make the difficulty curve of the game slowly rising with some peaks, but doesn’t end so high. Here we can see designers want players to finish the game with relatively relaxing emotion but not too relaxing to feel boredom. It’s a great way to immerse players in game and let them enjoy the art and story with more focus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*whAeD4LE-czjTj3B" /><figcaption>The contrast is a great way to tell player about environment</figcaption></figure><p>Although most challenges are designed well, we can still find some flaws. As a 2D platformer game, leveling the platforms is crucial. Whatever the art it has, player should be able to distinguish different platforms and background. GRIS has integrate its art style to platforms pretty well, but still failed in some parts. For instance, player can drop from a thin platform only if the platform below it is close by (based on what I tried). And there’s even a puzzle involving not be able to drop from a slightly high platform. It could confuse the player since they are constantly jumping from high altitude. Another example of not separating background and platform well is the cave challenge in forest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FkzdHNpA_MTad5mK" /><figcaption>Confusing on which platform can player drop</figcaption></figure><p>To summarize, we can learn several points from the mechanics design of GRIS: First, consider what mechanic feature you give to player, make sure they distribute reasonably and are challenged accordingly. Second, make sure you considered both mandatory and optional challenges, whether to have them and the reward for them will vary based on your game’s structure. Finally, always keep in mind the key experience you want players to have.</p><p>So that’s all analysis on mechanics. Please remember that this is a game analysis, not a game review, and its purpose is to figure out what designers want us to experience and whether it works. Although, inevitably, the analysis may contain my subjective feeling that only few people have, I hope the conclusion I come up can help you better understand the game design.</p><p><em>Originally published on my personal website at </em><a href="http://xiaojiangbrian.com/"><em>http://xiaojiangbrian.com</em></a><em> on August 6, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=316503e78583" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Ways to Reduce Load Time in Runtime for Unity]]></title>
            <link>https://medium.com/@bjjx1999/3-ways-to-reduce-load-time-in-runtime-for-unity-15d33003eb79?source=rss-db5f700816e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/15d33003eb79</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[asset-management]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[indie-game]]></category>
            <dc:creator><![CDATA[Xiao Jiang]]></dc:creator>
            <pubDate>Sat, 24 Jun 2023 10:42:31 GMT</pubDate>
            <atom:updated>2023-06-24T13:06:06.463Z</atom:updated>
            <content:encoded><![CDATA[<p>Long loading time have always been a problem for most indie games. With my experience in game development, I can assure that if you don’t pay attention and avoid it, it will eventually become the bottleneck of your game’s performance. I’ll list 3 reasons that might slow down game loading and show you how does SmartReference(<a href="https://github.com/Brian-Jiang/SmartReference">https://github.com/Brian-Jiang/SmartReference</a>) make your game loads 10x faster.</p><p>1. Do not use Resources folder to store all your assets</p><p>Most beginners store assets in Resources folder and load assets using Resources.Load API call. This is convenient but the problem is when you load any assets in Resources, unity will load the whole Resources bundle, which basically means that all assets of your game will be loaded from the launch of your game. This terrible and is usually the reason that your game startup slowly.</p><p>Another thing I want to point out is that scenes are automatically included in resources, as for everything it references. So if you never think of asset management but your game can still work, that might be the reason. However, when your game grow, you’ll find asset management neccessary to keep expanding your content.</p><p>To resolve this issue, avoid using resources. Instead use asset bundle or addressable to organize your assets. Pure asset bundle is harder to manage and requires more programming skills, but you can get full control of your assets. Addressable, on the other hand, is built on top of asset bundle and simplifies the workflow, therefore I have been using addressable for my games. Check out manual on how to use it: <a href="https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/index.html">https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/index.html</a></p><p>2. Only load what you need and don’t forget to release them</p><p>In your game logic, do not load everything in start function, you can control which asset to load when player go through the level. The implementation is highly related to your game mechanics so it’s hard to give a general solution, but you can follow these rules:</p><ul><li>If your game is level based, make sure you know what the level should load and release unused assets when player finish one level by calling Resources.UnloadUnusedAssets</li><li>If your game is not level based, make sure there are times where assets unloading happen</li><li>Profile your game using <a href="https://docs.unity3d.com/Packages/com.unity.memoryprofiler@1.0/manual/index.html">MemoryProfiler</a>, it shows how your game uses memory. Profiler window is also helpful, it can display whether memory usage is keep going up with time</li></ul><p>3. Reduce dependency for your assets</p><p>This is usually a trap if you don’t handle it carefully and it once confused me for some time. Imagine that you use Scriptable Object to store data for your game. There is a class called Monster and it contains name, description, icon sprite, maxHp, 3d model, attack and defense. There are probably a total of 100 monsters and stores in 100 SO files respectively. Let’s say you want to get all names and descriptions of monsters, how long do you think it will take to load all 100 files? The result might be surprising if you test it. It will actually load 100 SO files, 100 sprite icon, 100 prefabs for models, 100 meshes, 100 or more materials, all shaders used for these materials, 100 textures used in material, more textures if have normal map or other maps. These are the dependencies of monster SO files. Besides, if you have your own MonoBehaviours attached to the prefab and it reference other assets, all of them and their dependencies will load as well. One more bad new is that when unity load asset, it loads the asset bundle which may contain other assets depending on how you organize. That&#39;s a whole bunch of memory and time taken just to load names and descriptions of all monsters.</p><p>The solution to this problem is straight forward: do not directly reference sprite and prefab in monster SO files. So how can you indirectly reference a prefab? The best way is to store path of the prefab and load prefab using path at runtime. With some editor code and runtime setup, it is possible to have exactly same workflow as direct referencing. The SmartReference package I mentioned ealier does exactly this. When you reference an asset, unity will serialize it like this and treat it as the dependency</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1dJZQxJ6rjNfUXjRF8gMcQ.png" /><figcaption>Unity’s default reference</figcaption></figure><p>If you use SmartReference, it will instead serialize to this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jwx-BDwtntwbMTqfVlRbTQ.png" /><figcaption>SmartReference uses path instead of direct reference</figcaption></figure><p>The guid, fileID, and type are all for editor use, the path property is what actually used in runtime. When you try to access the property, it will first load the asset at that path and then return it. The only thing you need to care is setting up load function when your game start. Now if you want to load 100 names and descriptions, only 100 SO files would be load. If later you want model as well, it will also load properly when you explicitly access them.</p><p>To conclude, you <strong>NEED</strong> to take care asset management in your game, any serious developer will consider it an important aspect. You can start by switch from Resources folder to addressable, profile your game and make sure unloading assets is include in the logic. Eventually, use <a href="https://github.com/Brian-Jiang/SmartReference">SmartReference</a> instead of direct referencing to prevent loading unused dependencies. With these practices, you can take your game quality to the next level.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15d33003eb79" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How does the binding of Unity’s timeline work?]]></title>
            <link>https://medium.com/@bjjx1999/how-does-the-binding-of-unitys-timeline-work-309213d1aad4?source=rss-db5f700816e7------2</link>
            <guid isPermaLink="false">https://medium.com/p/309213d1aad4</guid>
            <category><![CDATA[unity-timeline]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[unity-developers]]></category>
            <category><![CDATA[unity-development]]></category>
            <dc:creator><![CDATA[Xiao Jiang]]></dc:creator>
            <pubDate>Sun, 11 Jun 2023 03:39:46 GMT</pubDate>
            <atom:updated>2023-06-24T10:44:54.710Z</atom:updated>
            <content:encoded><![CDATA[<h3>How does the binding of Unity timeline work?</h3><p>Timeline is Unity’s solution that lets you play cinematic content. It supports playing animations, particle simulation, audio clip, object activeness, as well as recording directly in timeline window. With timeline, we can create sequences that can be triggered in-game or used for cutscenes. Although timeline can be easily created, playing it at runtime can be more tricky. It’s likely that you want to play a timeline sequence using the character controlled by player in the level and handle the control back once finish, all performed seamlessly. That’s where comes the runtime binding of timeline. To easily binds timeline at runtime, you can use this free tool: <a href="https://github.com/Brian-Jiang/PragmaTimeline">https://github.com/Brian-Jiang/PragmaTimeline</a>. The rest of this article will based on this tool.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7I_khVyBg50%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7I_khVyBg50&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7I_khVyBg50%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1c49363ae59d74bdfaa84ff099f4f263/href">https://medium.com/media/1c49363ae59d74bdfaa84ff099f4f263/href</a></iframe><p>The first type of binding is <strong>GenericBinding</strong>, which are the objects that binds to the track you see in timeline editor. In runtime, you may add a PlayableDirector component and set the timeline asset, or you may load the prefab that contains it directly. But either case you will find the objects you bind to the track are empty because they are scene objects that cannot be saved in assets. To play the timeline correctly, you need to get PlayableDirector component and call SetGenericBinding where the key is the track asset of that timeline(weird, but that’s how it works), and the value is the object you want to bind. Although it gives you a way to bind, how can you know which track asset is which track in your timeline? One way is to look up by track name(which I barely change and can mess up easily), but the better way is to record and store in a config file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*5Pdd-4IePdE1_imUzaARhA.png" /><figcaption>Binding you set on the track are stored as generic binding in PlayableDirector</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*sDRceI-EKHNMrkaPAaCAqg.png" /><figcaption>The above bindings are actually stored</figcaption></figure><p>In PragmaTimeline, I created a struct that stores this. It still uses a name, but you can easily edit it in inspector</p><pre>[Serializable]<br>public struct TrackBindInfo {<br>    public string key;<br>    public TrackAsset trackAsset;<br>}</pre><p>At runtime, you can iterate through all tracks and try find the generic binding of that track. BindingMap is a dictionary that you pass in to map name to object.</p><pre>foreach (var track in timelineAsset.GetOutputTracks()) {<br>    if (track == timelineAsset.markerTrack) continue;<br>    <br>    if (trackBindMap.TryGetValue(track, out var trackBindInfo)) {<br>        var key = trackBindInfo.key;<br>        if (bindingMap.TryGetValue(key, out var value)) {<br>            Director.SetGenericBinding(track, (Object) value);<br>        }<br>    }<br>}</pre><p>Then the second type of binding is <strong>ExposedReference</strong> which can be used anywhere in Unity although it’s barely mentioned. It allows you to reference scene object by serialize a name and look up the name in an IExposedPropertyTable which contains the object you set earlier. When you use control track, you can see that the object referenced in a clip is using ExposedReference rather than direct reference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*45W0wU8Adty_wX68FYm0dA.png" /><figcaption>A clip in control track uses exposed reference</figcaption></figure><p>In PragmaTimeline, I also used a struct to store this information.</p><pre>[Serializable]<br>public struct ControlBindInfo {<br>    public string key;<br>    public int hash;<br>    public ControlPlayableAsset playableAsset;<br>}</pre><p>And similarly at runtime, they are restored</p><pre>foreach (var controlBind in controlBindMap) {<br>    var controlBindInfo = controlBind.Value;<br>    var key = controlBindInfo.key;<br>    if (bindingMap.TryGetValue(key, out var value)) {<br>        Director.SetReferenceValue(controlBindInfo.hash, (Object) value);<br>    }<br>}</pre><p>Note that PropertyName is used as key which is a hashed string where the string is just a random guid generated when you edit timeline.</p><p>PragmaTimeline supports these two bindings that timeline uses and let you quickly edit it in inspector, by clicking the Update button, it will collection all bindings and let you name it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*X4P7WQjIACJF-xg6jHzQKA.png" /><figcaption>Click the Update button, it will collection all bindings and let you name it</figcaption></figure><p>While in runtime, you can just pass a dictionary map the name to real object</p><pre>var map = new Dictionary&lt;string, object&gt; {<br>    {&quot;LogoRenderer&quot;, go.GetComponentInChildren&lt;SpriteRenderer&gt;()},<br>    {&quot;LogoAnimator&quot;, go.GetComponent&lt;Animator&gt;()},<br>}<br>player = instance.GetComponent&lt;TimelinePlayer&gt;();<br>player.Init(map);<br>player.PlayTimeline(true);</pre><p>PragmaTimeline also supports nested timeline where you just need to use nested dictionary</p><pre>var map = new Dictionary&lt;string, object&gt; {<br>    {<br>        &quot;Logo&quot;, new Dictionary&lt;string, object&gt; {<br>            {&quot;LogoRenderer&quot;, go.GetComponentInChildren&lt;SpriteRenderer&gt;()},<br>            {&quot;LogoAnimator&quot;, go.GetComponent&lt;Animator&gt;()}<br>        }<br>    },<br>}</pre><p>In above example, Logo is map to the sub-timeline where two more object belong to it.</p><p>In conclusion, if you use PragmaTimeline, you can easily collect objects that need bindings, name them, and use dictionary to restore binding. Otherwise you will need to use your own way to restore them by calling SetReferenceValue and SetGenericBinding on PlayableDirector.</p><p>Try PragmaTimeline for free here: <a href="https://github.com/Brian-Jiang/PragmaTimeline">https://github.com/Brian-Jiang/PragmaTimeline</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kwdN2XKBSoKvp9NnsY-DVA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=309213d1aad4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>