<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ #Game Design - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ #Game Design - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 23 May 2026 19:41:40 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/game-design/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How I Developed My First Adventure Game ]]>
                </title>
                <description>
                    <![CDATA[ It's hard to tell exactly when my journey creating Occulto, a point and click adventure game, started. But I have a significant date in mind: 3 May 2018. Here's one thing that got the ball rolling: Luigi: Hello Andrea. Sorry to bother you. I would l... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-i-developed-my-first-game/</link>
                <guid isPermaLink="false">66d46011b6b7f664236cbe00</guid>
                
                    <category>
                        <![CDATA[ Art ]]>
                    </category>
                
                    <category>
                        <![CDATA[ C ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ lessons learned ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                    <category>
                        <![CDATA[ unity ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Andrea Koutifaris ]]>
                </dc:creator>
                <pubDate>Wed, 09 Mar 2022 20:05:24 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/03/presentazione-new.min.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>It's hard to tell exactly when my journey creating Occulto, a point and click adventure game, started. But I have a significant date in mind:</p>
<p>3 May 2018.</p>
<p>Here's one thing that got the ball rolling:</p>
<blockquote>
<p>Luigi: Hello Andrea. Sorry to bother you. I would like to learn how to develop an app. Am I crazy?</p>
<p>Me (Andrea): Hmm... I don't have your number... who are you?</p>
</blockquote>
<p>Reading those two WhatsApp messages now makes me smile. But there are also two other pieces of interesting information:</p>
<p>First, that was May 2018. Now it is 2022... 3 years and some months later, we have published our very first game DEMO. So yes, it took us 3 years to release a demo.</p>
<p>But we are now producing at a steady pace, and in the first months of 2023 we will release the whole game.</p>
<p>That said, if you are planning to develop a game yourself, it won't necessarily take you 4 years…and I have some advice that hopefully will help!</p>
<p>Second, an app – everyone wants to make an app. Do we really need another app? What about a game instead? What I mean is: an adventure game is like a book, you install it, play it, enjoy and eventually uninstall it. It is not yet another app polluting your phone's memory.</p>
<p>Before I start, let me step back and explain what this article is about.</p>
<h2 id="heading-what-well-discuss-in-this-article">What We'll Discuss in This Article</h2>
<p>This article is about how I (Andrea) and Luigi developed <em>Occulto</em>, our first adventure game.</p>
<p>It will cover some technical aspects of the project, as well as how we managed creating and developing it. I'll discuss both psychological and practical parts of the journey.</p>
<p>I'll also provide a shallow comparison between using web technologies (like WebGL) for development vs Unity 2D.</p>
<p>This article consists of:</p>
<ul>
<li><p>A brief story about my passion for Adventure P&amp;C games, and how I ended up developing my own game.</p>
</li>
<li><p>A section about <em>Occulto</em>, the game I am developing</p>
</li>
<li><p>A tech section with a comparison between web technologies and Unity 2D</p>
</li>
<li><p>A section about what I learned through the process, along with some advice if you're creating your own game.</p>
</li>
</ul>
<h2 id="heading-how-i-got-into-adventure-games">How I got Into Adventure Games</h2>
<p>Many years ago, a good friend introduced me to <a target="_blank" href="https://amanita-design.net/games/machinarium.html">Machinarium</a>. Machinarium is one of the best adventure games I've ever played.</p>
<p>After I finished it, I felt the need to create my own adventure game. This feeling was not immediate, but grew stronger over time. Eventually it led me to find Luigi and be actually able to create my own indie game.</p>
<h3 id="heading-first-adventure-game-attempt">First adventure game attempt</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/newton-scene.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>In my first attempt at building a game, I contacted some friends and created a small group of people who were enthusiastic about creating an artistic P&amp;C game.</p>
<p>We managed to create a draft of the first scene (see the illustration above). The idea was to make an apple fall on Newton's head, who is resting under the tree.</p>
<p>I used the <a target="_blank" href="https://github.com/playn/playn">Playn Java framework</a> to write in Java and export to Android, iOS and web. At the time I was a Java developer. Playn is still an active project, it may be worth considering if you are looking for a Java 2D game framework.</p>
<p>This first attempt didn't last long. We had a dinner all together, and asked two friends to present us with a draft story of the game. And then I didn't get any feedback from the others and the project vanished into nothing.</p>
<h3 id="heading-second-attempt">Second attempt</h3>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/cover-red-moony.min.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>In my second attempt I managed to create four scenes and some game-play among them. But the project failed because I wasn't ready to lead the project. You'll read about that soon.</p>
<p>Below you can see an image of one of the scenes of the game. It was intended to be a modern revisiting of Little Red Riding Hood were wolves were not bad :).</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/room.min.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-third-and-final-adventure-game-attempt-occulto">Third and Final Adventure Game Attempt: Occulto</h2>
<p>Developing <em>Occulto</em> is my 3rd attempt at creating an adventure game – and hopefully this one is successful!</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/village-editor.min.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Unity Editor: 1° Village</em></p>
<h3 id="heading-intro-to-the-game">Intro to the game</h3>
<p>It is a beautiful morning, and Eliot, a young mage apprentice, is going to the studio of his magister for a lesson about magical potions. Something is wrong from the first moment: why isn't the magister opening the door?</p>
<p>Inside the studio everything is a mess, and a note tells Eliot to go to the church in the village. What is going on? Where is the magister?</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/studio.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>2° Magister studio</em></p>
<p>Will you help Eliot in his journey to find his magister and regain possession of the powerful forbidden book titled "The never written book" that an evil figure is trying to steal?</p>
<p>The demo consists of four scenes:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/monastery.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>3° Monastery</em></p>
<p>and one secret passage between the monastery and the private studio of a monk.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/secret-passage.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>4° Secret passage</em></p>
<p>Below you can see the last scene of the demo.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/10/hunckback-studio.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>5° Monk private studio</em></p>
<h2 id="heading-tech-i-used-to-build-my-adventure-game">Tech I Used to Build My Adventure Game</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/03/unity-vs-pixijs.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p>We developed <em>Occulto</em> in the beginning using <a target="_blank" href="https://pixijs.com/">Pixi.JS</a> and HTML. Then, later, I switched to Unity using the 2D features that are now included as default in the editor.</p>
<p>Since this article is quite long, I will not enter in the details of the code. But I will provide a description of the technologies we used and the process of creating the game.</p>
<p>I am planning to write a second article for the technical part.</p>
<p>We are a group of 3 people:</p>
<ul>
<li><p>Myself, Andrea, the developer and project/technical manager. I contribute to the story and game/riddle design as well. I am a software engineer.</p>
</li>
<li><p>Luigi, the wonderful artistic designer who designs and draws the scenes. He is also responsible for the game story and game-play. If you like the illustrations above, then you like Luigi's work :). He graduated in Mathematics.</p>
</li>
<li><p>Antonio is the music and sounds designer. He is a software engineer.</p>
</li>
</ul>
<p>Luigi draws the scenes using <a target="_blank" href="https://www.adobe.com/products/photoshop.html">Photoshop</a> and makes the animations using <a target="_blank" href="https://www.adobe.com/products/aftereffects.html">After Effects</a>. Then he exports everything into images (jpg and png) that I later use to assemble the scenes.</p>
<p>In addition Antonio provides me with the sounds and music for the scenes. We are using mp3 files at the moment, but we are planning to switch to <a target="_blank" href="https://www.fmod.com/">FMOD</a> in the future.</p>
<p>The game uses FHD (1920x1080) images, and runs also on low end mobile devices. If you want to run on a device with 1 GB of RAM, you need to reduce the amount of FHD images. If you load in memory more than 50/60 FHD images, the game may crash on devices with not enough memory.</p>
<p>In normal Unity memory management, the entire scene is loaded on memory, so you have to pay attention to what you add to the scene.</p>
<p>A simple and classic solution to reduce the memory imprint, is to use sprite sheets for the animations. Most of the time an animation will fit in a 2048x2048 sprite. I use <a target="_blank" href="https://www.codeandweb.com/texturepacker">Texture Packer</a> to create and import animation sprite sheets in Unity.</p>
<p>In addition I use <a target="_blank" href="https://imagemagick.org/index.php">ImageMagick</a> <a target="_blank" href="https://en.wikipedia.org/wiki/Command-line_interface">CLI</a> to trim images with an object inside. My input is a FHD transparent PNG with an object inside placed in the right position. Then I use:</p>
<pre><code class="lang-bash">magick mogrify -trim -verbose *.png &gt; trim.txt
</code></pre>
<p>to trim the image and get the precise position of the object.</p>
<p>Finally I add the trimmed image to the scene and place it using a script I made that maps the coordinates inside <em>trim.txt</em> file to the x,y values of the Unity scene.</p>
<p>By trimming and using sprite-sheets, I solved all memory problems. Also smaller images means lower time when loading a scene. In cheap mobile devices, loading a scene can require like 5 or 6 seconds (whereas in more powerful devices it takes less than a second).</p>
<p>Regarding fps and performance, Unity is good – so basically you don't have to do anything special. You just need to avoid bad design. And pay attention to <a target="_blank" href="https://en.wikipedia.org/wiki/Time_complexity">time complexity</a>. For example, avoid searching for an element on every tick of the game loop.</p>
<p>As I mentioned earlier, I am planning to write a tech article about how I developed the game using Unity 2D. If you are interested, follow me or follow us on one of our social accounts.</p>
<h3 id="heading-unity-vs-webgl">Unity vs WebGL</h3>
<p>Even if I used both technologies, I am not an expert (this is my first game). So below I will just list some of the pro and cons of both technologies.</p>
<h4 id="heading-pros-of-webgl">Pros of WebGL</h4>
<ul>
<li><p>Easy to port everywhere with <a target="_blank" href="https://capacitorjs.com/">Capacitor</a> or <a target="_blank" href="https://www.electronjs.org/">Electron</a>.</p>
</li>
<li><p>Programmers friendly: <a target="_blank" href="https://pixijs.com/">PixiJS</a> makes it very easy.</p>
</li>
<li><p>Almost the only working solution if you need a web responsive version.</p>
</li>
<li><p>Continuous integration and delivery to web is very easy, since the output is a bunch of files.</p>
</li>
<li><p>Web development is mature, and you have access to tons of libraries, utilities as well as a web packers, like <a target="_blank" href="https://webpack.js.org/">Webpack</a>.</p>
</li>
<li><p>Collaboration is very easy and mature with Git. There is something about collaboration in Unity, I didn't explore it. I don't know what happens if two people work on the same scene.</p>
</li>
</ul>
<h4 id="heading-cons-of-webgl">Cons of WebGL</h4>
<ul>
<li><p>Slightly lower performances compared to more native frameworks.</p>
</li>
<li><p>Subject to WebViews bugs (which you cannot solve).</p>
</li>
<li><p>It can be difficult for programmers who do not know web development.</p>
</li>
<li><p>WebViews doesn't seem to be ready to perfectly support WebGL. The game wasn't working well on my Neffos, and who knows on which devices it had issues. Maybe WebViews are not yet ready for gaming, but they are definitely ready for HTML and hybrids app.</p>
</li>
</ul>
<h4 id="heading-pros-of-unity">Pros of Unity</h4>
<ul>
<li><p>Graphical editor: it is easier to visualize/update the scene and fine tuning.</p>
</li>
<li><p>Easy and complete: it has almost everything you need.</p>
</li>
<li><p>Good performance: 60 fps even on low end devices at 1920 x 1080 resolution.</p>
</li>
<li><p>Cross platform, but the WebGL version does not work well on mobile phones.</p>
</li>
<li><p>A lot of indie games are made using Unity. If the Unity team introduces a bug, it will be found very soon.</p>
</li>
</ul>
<h4 id="heading-cons-of-unity">Cons of Unity</h4>
<ul>
<li><p>Graphical editor: you need a working updated Unity editor in each of the computers you are going to use. With Linux it's not that simple.</p>
</li>
<li><p><a target="_blank" href="https://store.unity.com/compare-plans">Closed licence</a> but it has a free tier if you earned up to $100K in the last 12 months.</p>
</li>
<li><p>At the moment the mobile web version is not officially supported.</p>
</li>
<li><p>Linux Unity editor is alpha (and I managed to make it work after many attempts).</p>
</li>
<li><p>Not a lot of helpful info about it: most of the posts I read to find help about a particular topic were low quality or were videos. That's far away from stack overflow quality. But the documentation is well done.</p>
</li>
</ul>
<p>Keep in mind that this section is not intended to be an exhaustive comparison between Unity 3D and WebGl frameworks. Depending on your target, one technology could be better than the other.</p>
<p>That said, even if I am a web developer, I must admit that Unity is great for developing a 2D games (and I guess 3D games too).</p>
<h2 id="heading-what-i-learned-while-building-occulto">What I learned While Building Occulto</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/03/1_zGuG4nFo8O4e0WMoNWVbMA.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-someone-needs-to-lead-the-project">Someone needs to lead the project</h3>
<p>This is my first insight: if it is you who propose a project to others (a game, an app or whatever), they will assume you will lead the project.</p>
<p>At the time I was thinking that I was just a programmer, and didn't act like a project leader. It won't work if someone doesn't actively follow every person in the project.</p>
<h3 id="heading-have-the-right-attitude">Have the right attitude</h3>
<p>It is important to have the right attitude towards people that are participating in the project. You also need to understand if they can be productive.</p>
<p>In this context, "productive" does not have the same meaning it has at work. Productive means "actually able to produce". At work it means how much you produce and how good is your output.</p>
<p>Before I go on, let me tell you a story:</p>
<p>Before embarking on <em>Occulto</em> game development, I decided to help a guy develop the interface for his board game. I did it because I thought the game he invented was a good game that had some brilliant parts to it.</p>
<p>In this case I was the developer, and he was leading the project (being the inventor of a game, doesn't unfortunately imply that you are also good as a project leader).</p>
<p>In the beginning everything was good, and I enjoyed developing the game. In addition I was learning React, which I used as the framework to build the game app. (It is a board game, not a classic one, so React was a good choice, and also it had a lot of pages, not just the game page).</p>
<p>Then things started to become weird: he started asking for deadlines, complaining about delays on the development, and asking for features which I thought weren't really useful in the first version of the game.</p>
<p>In the end it didn't work out and I couldn't work well with him, so I blocked all communication. Remember that I worked on his game for free, and I even solved a nasty bug that caused the back end side of the game to stop working.</p>
<p>So, why this story? To tell you that making a game with a bunch of friends is a very different job than what you do at work. Some advice:</p>
<ul>
<li><p><strong>Don't push people too hard</strong>: if you are making a game for fun, it must be fun. Motivate people and help them. They are working (as you are) for free on a project they believe in.</p>
</li>
<li><p><strong>Don't act like a boss</strong>: even if you direct and follow every step of the game, people should regard you more as a project manager/team leader than a boss.</p>
</li>
</ul>
<h3 id="heading-work-in-your-spare-time">Work in your spare time</h3>
<p>Being able to be "productive" applies also to you. Are you able to work in your spare time on the game? Can you provide a steady output, without long periods of time away from the project?</p>
<p>This is the first obstacle I encountered in my previous attempts. I wasn't able to provide a constant, timely output and people thought the project was falling apart.</p>
<p>In this case, as a programmer, it is important to integrate the output of your other team members (images, animations and sounds) as soon as possible. People will be more engaged if they see their work quickly integrated in the game. Also the sooner you integrate others' work, the sooner you will find and solve problems.</p>
<h3 id="heading-remove-as-many-obstacles-as-you-can">Remove as many obstacles as you can</h3>
<p>In order to work in your spare time, you have to reduce or remove all the obstacles. These can be physical (slow computer, too small a screen, ...) or psychological. The psychological ones are the most subtle. I will try to list some of them:</p>
<p><strong>Feeling guilty for not working</strong>: this is hard, and I think is one of the main reasons for quitting. You have to enjoy working on your project. So deadlines, pushing others to produce more, threatening (like "If you don't work enough you are out") do NOT work.</p>
<p>It is better to motivate people and help them understand what's blocking them (or you) to produce some output.</p>
<p><strong>Obstacles that delays the moment you can actually work</strong>: you may think something like "I'd like to finish that thing I started, I think I can complete it in 10 minutes." Then you think: "But the PC is slow and it will take forever to start... may be tomorrow, now I'll just serf on Instagram".</p>
<p>It is important that when you think you can work a bit on the game, you can actually do it without any delay or obstacle.</p>
<p><strong>Too tired to work on the game</strong>: indeed you must not overdo it. It is important to find a balance between how much you work and how much you rest. But it is also important to avoid long periods of not working on the game.</p>
<p>I noticed that small actions can help: for example for me it is enough to start the Unity Editor to increase the chances that I'll actually work on the game.</p>
<p><strong>Share your results with the others</strong>: even though non technical people may not fully understand what you are doing (and vice-versa), it is satisfying to explain that you solved a performance problem, or that you reduced the bundle size, for example.</p>
<p>In fact, in agile methodologies, telling what you did and what your are going to do is one of the main points.</p>
<p><strong>Persist</strong>. Not everything will be easy. You will have to persist. Even though you are probably making a game because of passion, it is still requires a lot of work and sometimes you have to persevere and overcome problems/blocks. You probably do that all the time at work, you can do it also for your game.</p>
<p><strong>Not every moment is a moment of pleasure</strong>. Imagine when I discovered that the demo, almost ready to be published, wasn't working on some mobile devices and I had to rewrite everything in Unity. I really had a bad weekend.</p>
<p>But then I manage to change my attitude, start with Unity, and regain pleasure in working on the game.</p>
<p>Fortunately Luigi, my partner in the game, understood it and accepted that we needed to delay the release date of the game demo. While it took a lot of time to write the demo (2 years, if you count from the first commit), it took me 3 months to rewrite it.</p>
<h3 id="heading-focus-on-developing-the-game">Focus on developing the game</h3>
<p>It is extremely important to focus on making the game, and not the framework for the game.</p>
<p>Being a programmer you will probably want to write more code than necessary and use your preferred language. Chose a framework based on your needs (cross platform? 2D or 3D? ...) and try to develop a simple level to understand if you made the right choices.</p>
<p>When you start, you won't necessarily have a clear view of the possible frameworks/technologies available to build a game – and there are a lot. In addition you will be biased towards some languages/features.</p>
<p>About that, I can tell you 2 mistakes I made:</p>
<p>I used PixiJS and HTML technologies at first. As opposite as you may think, I was able to go at 60 fps with FHD (1920x1080) resolution even in medium performance mobile devices.</p>
<p>This is because most of the work is done by WebGL. But at a certain point the game started flickering on my old mobile phone (Neffos X1 Max) when ported to a mobile app using Capacitor (webview). But it was working well on the browser and on the other phones I had. Even on my Motorola Moto G first generation (2013 low end device).</p>
<p>I should have tested earlier on mobile (not just with the browser). Also the game wasn't smooth on the my lower end device Moto G (still it was running near 30 fps).</p>
<p>I decided that I wanted my game to run smoothly even on low end devices, so I switched to Unity 2D. Unity is used by a lot of indie game developers, and C# is quite easy. I didn't try Unreal Engine, because I am too rusty on C++. Now it runs smoothly also on my Moto G (60 FPS).</p>
<p>The second thing that was almost a mistake is that I developed a library to find the shortest path on polygon areas with polygon holes. <a target="_blank" href="https://github.com/Kouty/shortest-path-polygon-area">Here</a> you can find the JS code (I have ported it to C#, but not yet release on GitHub).</p>
<p>I took me 3 attempts to get it working properly, and a lot of time. Fortunately by the time I started developing <em>Occulto</em>, the library was ready and working. Now I can just draw the walkable area and have the main character move inside it, avoiding obstacles (polygon holes).</p>
<p>The fact is that having an algorithm to move things inside a walk-able area is not strictly necessary, and it is better to focus on actually making the game. Other P&amp;C games do not use this feature, they just move characters along predefined paths.</p>
<p>So, before you embark on something that is not strictly necessary for the game, see if you can find something already implemented or if it is really worth it.</p>
<h3 id="heading-release-a-one-scene-version-of-the-game">Release a one scene version of the game</h3>
<p>After you've chosen the right framework, take a scene, and develop the entire game which will consist on one scene plus a menu and every UI component that is cross scene. It is important to learn everything you need and to find problems as soon as possible.</p>
<p>Also, submit the game for internal testing (not public) to the stores you are going to use. Yes, do everything that's necessary from developing to publishing (privately) the game.</p>
<p>When I published the game demo on iOS, one animation wasn't working. It was working on Android, Desktop, and even on iPhone with the developer build. So yes, you need to test everything as soon as possible, even the process of publishing.</p>
<p>I made the mistake to first develop the whole demo (four scenes, plus menu and some other screens) just to find out that WebGL technology was not the right choice for my game.</p>
<h2 id="heading-final-notes">Final Notes</h2>
<p>I hope you enjoyed reading this article and found some interesting advice. Maybe I will write another article when I have published the whole game, sharing other insights.</p>
<p>If you are curious about <a target="_blank" href="https://www.sirioartgames.com/"><em>Occulto</em></a> game, follow us on:</p>
<ul>
<li><p>Twitter: <a target="_blank" href="https://twitter.com/SirioArtGames">https://twitter.com/SirioArtGames</a></p>
</li>
<li><p>Instagram: <a target="_blank" href="https://www.instagram.com/sirioartgames/">https://www.instagram.com/sirioartgames</a></p>
</li>
<li><p>Our website: <a target="_blank" href="https://www.sirioartgames.com/">https://www.sirioartgames.com</a></p>
</li>
</ul>
<p>or <a target="_blank" href="http://onelink.to/mxsak4">try the demo</a>: <a target="_blank" href="http://onelink.to/occulto">http://onelink.to/occulto</a>!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Learn to Code RPG Player Guide – How to Unlock All Achievements and Endings ]]>
                </title>
                <description>
                    <![CDATA[ In this guide, you'll learn to how to collect all 54 achievements and reach all six endings of the Learn to Code RPG.  According to the game's creator, Lynn Zheng, Learn to Code RPG is an interactive visual novel game where you will teach yourself t... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/learntocoderpg-player-guide-how-to-unlock-all-achievements-and-endings/</link>
                <guid isPermaLink="false">66b0c3a293daff72552fc865</guid>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Video games ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ilenia Magoni ]]>
                </dc:creator>
                <pubDate>Mon, 31 Jan 2022 21:32:45 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/01/Splash-Art-2.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this guide, you'll learn to how to collect all 54 achievements and reach all six endings of the Learn to Code RPG. </p>
<p>According to the game's creator, <a target="_blank" href="https://www.freecodecamp.org/news/author/lynn/">Lynn Zheng</a>,</p>
<blockquote>
<p><strong>Learn to Code RPG</strong> is an interactive visual novel game where you will teach yourself to code, make friends in the tech industry, and pursue your dream of becoming a developer. 🎯</p>
</blockquote>
<p>If this is the first time you're hearing about this game, you can <a target="_blank" href="https://freecodecamp.itch.io/learn-to-code-rpg">download it and play it first on your own</a>. </p>
<p>And if you want to learn more about the game from Lynn herself, <a target="_blank" href="https://www.freecodecamp.org/news/learn-to-code-rpg/">check out this introductory article</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/01/image-139.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-learn-to-code-rpg-story-milestones">Learn to Code RPG Story Milestones</h2>
<p>These are the achievements that you get for sure by following the storyline.</p>
<p><strong>3, 2, 1, Learn to Code!</strong> You'll get this achievement the first time you start working on the quizzes.</p>
<p><strong>Got My First Interview!</strong> You get this achievement once your character goes through their first interview after completing the curriculum.</p>
<p><strong>Got My First Offer!</strong> Once you receive your first job offer you get this achievement.</p>
<p><strong>Gotta Crush Those Technical Interviews!</strong> Once you start preparing for the technical interviews you get this achievement.</p>
<p><strong>Nailed the Curriculum!</strong> You unlock this achievement once you reach a CS Knowledge of 60 or more, enough to allow you to go to the next step. </p>
<p><strong>Now Streaming: My Dream Dev Job</strong> You unlock this achievement once you accept an offer for a dev job.</p>
<p><strong>Submitted My First Dev Job Application!</strong> When you submit your first job application, you get this achievement.</p>
<h2 id="heading-learn-to-code-rpg-story-easter-eggs">Learn to Code RPG Story Easter Eggs</h2>
<p>You can unlock these special achievements mostly by making certain choices in the game, by employing some skill, or in some cases by pure chance.</p>
<p><strong>Applied to CupcakeCPU Through a Recruiter</strong>: This achievement has the prerequisite of getting all the questions of the trivia quiz at the Hacker Space right. This will give you the opportunity to apply to CupcakeCPU.</p>
<p><strong>Asked My Tech-Savvy Friends about Tech Buzzwords</strong>: Ask about one of the buzzwords you discovered by eavesdropping on people's conversations.</p>
<p><strong>Barista Is My Undercover Identity for Collecting Buzzwords</strong>: You unlock this one during your first Barista shift.</p>
<p><strong>Beat Up AI at Pong</strong>: beat the Pong AI to unlock this achievement.</p>
<p><strong>Chill Beats to Code to</strong>: listen to music during one of your rest days.</p>
<p><strong>Chill Beats to Smash Keyboard to</strong>: play the rythm game during one of your rest days.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/01/Screen-Shot-2021-12-17-at-19.33.39.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><strong>Flunked All Quizzes in a Session</strong>: Get all questions in a session wrong.</p>
<p><strong>Got Beaten Up by AI at Pong</strong>: lose at Pong. </p>
<p><strong>Got a Nearly Perfect Score on ALL Music Tracks</strong>: Get above 95% for all tracks. See next achievements for details.</p>
<p><strong>Got a Nearly Perfect Score on My Favorite Music Track</strong>: Get this achievement for reaching a score above 95%. For reference to reach 90% you need at least 3/4 of your scores to be perfects (100pt each) and 1/4 to be goods (60pt each).</p>
<p><strong>Hanging Out at the Hacker Space</strong>: you get this achievement after hanging out at the Hacker Space for the first time.</p>
<p><strong>I Might Get a Puppy Just So I Can Go to the Park</strong>: Go take a walk on one of your rest days.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/01/image-140.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><strong>Late-night Cookie Crunch</strong>: When confronted with all the certifications available in the freeCodeCamp curriculum, choose Quality Assurance and go grab a cookie.</p>
<p><strong>Maxed Out ALL CS Knowledge Stats</strong>: Max out all of the CS Knowledge Stats.</p>
<p><strong>Maxed Out One CS Knowledge Stat</strong>: Max out one of the CS Knowledge Stats.</p>
<p><strong>Nailed All Quizzes in a Session</strong>: Get all quizzes in a session right.</p>
<p><strong>Referred by a VIP Member</strong>: In the intro, after the disaster of an interview you are asked how you came across the opportunity. If you say you were referred by certain people, for example, me, you can get the achievement. (Fine, the complete list of names is Quincy, Lynn, Abbey, Estefania, Jessica, Oliver, Ilenia, Dionysia, Naomi, Yoko, Daniel, Beau.)</p>
<p><strong>Rejected? Well, The First One Seldom Works Out</strong>: Be rejected by a job you applied to for the first time.</p>
<p><strong>Rejected Again? I Thought Third Time Was the Charm</strong>: Be rejected by a job you applied to for the third time.</p>
<p><strong>Set a New High Score in the Rhythm Game</strong>: available from the second time you play a song, just get a new high score!</p>
<p><strong>Tech Buzzword Encyclopedia</strong>: collect all buzzwords at the coffee shop.</p>
<p><strong>Tech Trivia Guru</strong>: Answer correctly to all questions in the Trivia quiz at the Hacker Space.</p>
<p><strong>The Hacker Space Is My Second Home Now</strong>: Experience all events at Hacker Space.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/01/Screen-Shot-2021-12-18-at-12.40.00-copy.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><strong>This Job Needs Me to... ?</strong>: there are 6 achievements of this kind, related to job interviews. You could find job postings that have strange skill requirements, and finding those you unlock these achievements. The whole list of skill requirements is: <strong>Brew Coffee</strong>, <strong>Fix Fax Machines</strong>, <strong>Fuse Cables</strong>, <strong>Handle Angry Customers</strong>, <strong>Pacify Office Pets</strong>, and <strong>Retrieve Lost Passwords</strong>.</p>
<p><strong>Travel in Time and SAVE the World</strong>: unlock one of the alternative endings (ones that are not getting a dev job) and then go back in time to continue playing.</p>
<p><strong>You Can Never Be Too Careful with Prod</strong>: get a dev job, and once it's time to push your code to production, check your code again and again as many times as possible.</p>
<h2 id="heading-quiz-question-easter-eggs">Quiz Question Easter Eggs</h2>
<p>These are achievements that are unlocked by chance while you complete the quizzes. If you get one of the questions about freeCodeCamp right, you unlock one of these achievements.</p>
<ul>
<li>Contribute to Open Source with freeCodeCamp!</li>
<li>Dr. DevDocs.io</li>
<li>Hello, Earth to Code Radio!</li>
<li>The Launch of freeCodeCamp</li>
<li>The Mission of freeCodeCamp</li>
<li>The Tech Stack of freeCodeCamp</li>
<li>What inspired freeCodeCamp?</li>
<li>freeCodeCamp Has a Chat Server? Fancy!</li>
<li>freeCodeCamp Has a Forum? Neat!</li>
<li>freeCodeCamp Has a Mascot? Cute!</li>
</ul>
<h2 id="heading-alternative-learn-to-code-rpg-endings">Alternative Learn to Code RPG Endings</h2>
<p>These are the achievements you unlock by playing the six different endings. There's one you can get to easily just by following the main storylines – but the others are all about chance. There is a small chance of the event that unlocks the ending happening in certain moments.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/01/Screen-Shot-2021-12-17-at-18.51.41.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><strong>Cat Who Codes</strong>: this ending involves Mint the cat, during the night you could be woken up by the cat doing something...<br>Coding It Forward: during dinner you could have the chance to become a coding tutor, accept the offer to unlock this ending.<br>Dev Who Brought Down Prod on the First Day: get a dev job and play till the end to unlock this one.<br>Just Another Day at the Office: while going through job postings you could find one unrelated to coding, for an office job. Accept that job to unlock this ending.<br>Nature Lover at Heart: each day of forced rest there is a small chance that the character may come to the conclusion that learning to code is too much and decide to do something different...<br>Now serving <code>0xc0ffee</code>: you could be offered a promotion at the Coffee Shop, accept it to unlock this ending.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>This is the list of achievements for the release on December 22nd. I hope you can satisfy your completionist spirit with this guide. Have nice replays!</p>
<p>If you want to learn more about the game you can read the article <em><a target="_blank" href="https://www.freecodecamp.org/news/learn-to-code-rpg-press-kit/">Learn to Code RPG – A Visual Novel Video Game Where you Learn Computer Science Concepts</a></em> from the game dev herself about the process of creating the game.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Learn to Code RPG – Press Kit ]]>
                </title>
                <description>
                    <![CDATA[ This is the press kit for the game, Learn to Code RPG. Fact Sheet Developer freeCodeCamp.org, a 501(c)(3) nonprofit Platform Windows/Mac/Linux Available on itch.io Price Free Source Code GitHub Release Date December 22, 2021 Developer Contact Quincy ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/learn-to-code-rpg-press-kit/</link>
                <guid isPermaLink="false">66d46021677cb8c6c15f315d</guid>
                
                    <category>
                        <![CDATA[ freeCodeCamp.org ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ GameDev ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Lynn Zheng ]]>
                </dc:creator>
                <pubDate>Wed, 22 Dec 2021 17:22:50 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/12/Splash-Art-1.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>This is the press kit for the game, <strong>Learn to Code RPG</strong>.</p>
<h2 id="heading-fact-sheet">Fact Sheet</h2>
<h3 id="heading-developer">Developer</h3>
<p><a target="_blank" href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwjljfGir-z0AhVBKn0KHWCOB9cQFnoECAUQAQ&amp;url=https%3A%2F%2Fwww.freecodecamp.org%2F&amp;usg=AOvVaw2O9Sbs3zh9NHmRpWZrEZt-">freeCodeCamp.org</a>, a 501(c)(3) nonprofit</p>
<h3 id="heading-platform">Platform</h3>
<p>Windows/Mac/Linux</p>
<h3 id="heading-available-on">Available on</h3>
<p><a target="_blank" href="https://freecodecamp.itch.io/learn-to-code-rpg">itch.io</a></p>
<h3 id="heading-price">Price</h3>
<p>Free</p>
<h3 id="heading-source-code">Source Code</h3>
<p><a target="_blank" href="https://github.com/freeCodeCamp/LearnToCodeRPG">GitHub</a></p>
<h3 id="heading-release-date">Release Date</h3>
<p>December 22, 2021</p>
<h3 id="heading-developer-contact">Developer Contact</h3>
<p>Quincy Larson, <a target="_blank" href="mailto:quincy@freecodecamp.org">quincy@freecodecamp.org</a></p>
<p>Lynn Zheng, <a target="_blank" href="mailto:lynn@freecodecamp.org">lynn@freecodecamp.org</a></p>
<h2 id="heading-description">Description</h2>
<p><strong>Learn to Code RPG</strong> is an interactive visual novel game where you will teach yourself to code, make friends in the tech industry, and pursue your dream of becoming a developer. 🎯</p>
<p>In this game, your choices shape and drive the story forward: What will you do on a day-by-day basis? Learn to code? Work as a barista? Visit the Hacker Space? Or chill, relax in the park, or cuddle with a kitten over some video games?</p>
<p>Will you stick to your dream – getting a job in the tech industry – and more importantly, keep that job? The choice is in your hands.</p>
<h2 id="heading-features">Features</h2>
<ul>
<li><p>2+ hours of gameplay 🎮</p>
</li>
<li><p>Original art and music 🎨</p>
</li>
<li><p>600+ CS quiz questions 📚</p>
</li>
<li><p>50+ Easter Eggs you can tweet about 🚀</p>
</li>
<li><p>6 different endings 👀</p>
</li>
<li><p>Friendly characters and an adorable cat 🐱</p>
</li>
<li><p>Minigames! 👾</p>
</li>
</ul>
<h2 id="heading-dev-log-article">Dev Log Article</h2>
<p><a target="_blank" href="https://www.freecodecamp.org/news/learn-to-code-rpg/">https://www.freecodecamp.org/news/learn-to-code-rpg/</a></p>
<h2 id="heading-screenshots">Screenshots</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Splash-Art-2.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Learn to Code RPG Splash art</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Learn-to-Code-RPG-Main-Menu-copy.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Learn to Code RPG Game Menu</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Screen-Shot-2021-12-18-at-12.40.00-copy.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Hanging out at the Hacker Space with your best friend Annika</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Screen-Shot-2021-12-17-at-09.43.14.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Chill at home with your cat Mint</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Screen-Shot-2021-12-20-at-18.30.58.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Take CS quizzes</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Screen-Shot-2021-12-17-at-09.43.50.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Quiz question explanation screen</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Screen-Shot-2021-12-17-at-18.51.41.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>NPCs</em></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Screen-Shot-2021-12-17-at-19.33.39.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Rhythm Minigame</em></p>
<h2 id="heading-videos">Videos</h2>
<h3 id="heading-trailer">Trailer</h3>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/vLK4fOeiIEk" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<h3 id="heading-lets-play">Let's Play</h3>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/b_IDdQzPRR4" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p> </p>
<h2 id="heading-logo">Logo</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/img_1.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/img_0.png" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-character-cards">Character Cards</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Lydia.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Annika.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Marco.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Layla.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/12/Mint.png" alt="Image" width="600" height="400" loading="lazy"></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ RNG Meaning – What does RNG Stand for in Gaming? ]]>
                </title>
                <description>
                    <![CDATA[ If everything is predictable in a game, that isn't much fun. RNGs, or Random Number Generators, are a way to introduce a touch of randomness and causality you need to spice it up. In this article, we'll learn how random number generators work. How an... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/rng-meaning-what-does-rng-stand-for-in-gaming/</link>
                <guid isPermaLink="false">66b0c3ab4d2b90ec4a447a58</guid>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ gaming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Python ]]>
                    </category>
                
                    <category>
                        <![CDATA[ random ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ilenia Magoni ]]>
                </dc:creator>
                <pubDate>Wed, 15 Sep 2021 21:55:10 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/09/pexels-pixabay-37534.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If everything is predictable in a game, that isn't much fun. RNGs, or Random Number Generators, are a way to introduce a touch of randomness and causality you need to spice it up.</p>
<p>In this article, we'll learn how random number generators work.</p>
<h2 id="heading-how-an-analogic-random-number-generator-works">How an Analogic Random Number Generator Works</h2>
<p>The simplest form of a RNG is throwing dice or flipping coins.</p>
<p>Using a single die or coin means that each value has the same probability of occurring. Using multiple dice or coins instead will give a lower probability to the highest and lower values, and a higher probability to the middle values.</p>
<p>The oldest known tabletop game, <a target="_blank" href="https://en.wikipedia.org/wiki/Royal_Game_of_Ur">the Royal Game of Ur</a>, uses four 4-sided dice. Each die can give a value of 0 or 1 meaning that the value obtained by a single dice throw can go from 0 to 4.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/09/image-1.png" alt="Image" width="600" height="400" loading="lazy">
<em>All the possible combinations obtained by throwing 4 dice, each can give a value of 0 or 1</em></p>
<p>There are 16 possible combinations, of which one gives a value of 0, 4 gives a value of 1, 6 gives a value of 2, 4 gives a value of 3, and one gives a value of 4.</p>
<p>In this case there is a 1/16 or 6.25% chance of getting 0, 1/4 or 25% chance of getting 1, 3/8 or 37.5% chance of getting 2, 1/4 or 25% chance of getting 3 and 1/16 or 6.25% change of getting 4.</p>
<p>More complex games have manuals full of tables to determine something randomly.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/09/image-2.png" alt="Image" width="600" height="400" loading="lazy">
<em>Part of a table for random effects after drinking a potion. <a target="_blank" href="https://luetkemj.github.io/160419/random-potion-effects-table">Here's the whole table</a>.</em></p>
<p>Any game that uses dice has an analogic random number generator.</p>
<h2 id="heading-how-random-number-generators-work-in-video-games">How Random Number Generators Work in Video Games</h2>
<p>In video games, RNGs are much less noticeable and more complex, and players might not even be aware they exist. <a target="_blank" href="https://www.freecodecamp.org/news/random-number-generator/">There are many ways you can generate a Random Number</a>, but how do you actually use one?</p>
<p>Breaking it down into the simplest terms, using a RNG is not dissimilar from what you saw above with the dice throw used to determine an effect from a table. You just don't see the dice throw.</p>
<p>In a video game, you can use a RNG to determine what kind of loot might be dropped by a fallen enemy, or what you can find in a chest, or what kind of random encounter will await you, or even what the weather will be.</p>
<p>RNGs are used, for example, to live up open world games without the developers having to code every single section of forests and roads and deserts. Instead, developers code some possibilities and let chance determine what happens when the player reaches a certain point in the map. </p>
<p>Will you meet a bear, a wolf pack, or some bandits? The game does its version of rolling a die to determine that.</p>
<p>Let's see how to code a simple example of a Random Number Generator to better understand how they actually work.</p>
<h2 id="heading-how-to-code-a-random-number-generator">How to Code a Random Number Generator</h2>
<p>Most programming languages contain a <code>random</code> function. This function returns a random number, and what kind of random number depends on its implementation.</p>
<p>For example, in <a target="_blank" href="https://www.freecodecamp.org/news/javascript-math-random-method-explained/">JavaScript</a>, <a target="_blank" href="https://www.freecodecamp.org/news/javascript-math-random-method-explained/"><code>Math.random()</code></a> returns a random number between 0 (included) and 1 (not included). In Python, <code>randint</code> from the <code>random</code> module returns a whole number in a range (Python has also a function that does the same as JavaScript's <code>Math.random</code>).</p>
<p>Let's consider a pretty common video game situation: we have an enemy that often drops a common item, but now and then drops something rare. This enemy may be, for example, a wolf that could drop a wolf pelt (common) or a wolf fang (rare). </p>
<p>How do you determine what is "rare"? That depends on you – it can be that 1 in 10 drops is a rare item, or that 1 in 100 drops is a rare item. A middle ground may be a chance of 1 in 25 for a rare items. And to complicate it a bit, there could be also a 1 in 10 chance of no item.</p>
<p>In this case you would need a function that returns a value between 0 and 1.</p>
<p>A chance of 1 in 25 is 4%, and a chance of 1 in 10 is 10%. In decimal form that would be 0.04 and 0.1, respectively. </p>
<p>In this case you can say that a number in the range from 0 to 0.04 gives the rare item, and a number in the range from 0.9 to 1 gives no item.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/09/image-3.png" alt="Image" width="600" height="400" loading="lazy">
<em>The percentage breakdown of the wolf drop</em></p>
<p>To avoid sticking to one language, let's first see how we can code this using <a target="_blank" href="https://www.freecodecamp.org/news/what-is-pseudocode-in-programming/">pseudocode</a>. This is not a real programming language – rather, it's a way to break down the code logic. It's like taking notes, as it's personal and will have varied syntax depending on the person writing it.</p>
<pre><code>FUNCTION wolfDrop
  randomNumber = random(<span class="hljs-number">0</span>,<span class="hljs-number">1</span>)
  IF
    randomNumber &lt; <span class="hljs-number">0.04</span>
    THEN
     -&gt; wolf fang
  ELSE IF
    randomNumber &lt; <span class="hljs-number">0.9</span>
    THEN
     -&gt; wolf pelt
  ELSE
    -&gt; empty
  END IF
END FUNCTION
</code></pre><p>Or a more verbose version:</p>
<blockquote>
<p>Create a function called <code>wolfDrop</code> and inside it store a random number between 0 (included) and 1 (excluded) in the <code>randomNumber</code> variable. If <code>randomNumber</code> has a value less than <code>0.04</code> the drop will be a wolf fang, else if the <code>randomNumber</code> has a value less than <code>0.9</code> the drop will be a wolf pelt, and otherwise there will be no drop.</p>
</blockquote>
<p>With the pseudocode ready, we can implement the code snippet in any language. Let's see, for example, how to code it in a few different languages:</p>
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">wolfDrop</span> (<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> randomNumber = <span class="hljs-built_in">Math</span>.random();
  <span class="hljs-keyword">if</span> (randomNumber &lt; <span class="hljs-number">0.04</span>) {
    <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf fang"</span>;
  } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (randomNumber &lt; <span class="hljs-number">0.9</span>) {
    <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf pelt"</span>;
  } <span class="hljs-keyword">else</span> {
    <span class="hljs-keyword">return</span>;
  }
}
</code></pre>
<pre><code class="lang-python"><span class="hljs-keyword">import</span> random
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">wolfDrop</span>():</span>
  randomNumber = random.random()
  <span class="hljs-keyword">if</span> randomNumber &lt; <span class="hljs-number">0.04</span>:
    <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf fang"</span>
  <span class="hljs-keyword">elif</span> randomNumber &lt; <span class="hljs-number">0.9</span>:
    <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf pelt"</span>
  <span class="hljs-keyword">else</span>
    <span class="hljs-keyword">return</span>
</code></pre>
<pre><code class="lang-clojure">(<span class="hljs-keyword">defn</span> <span class="hljs-title">wolf-drop</span> []
  (<span class="hljs-name"><span class="hljs-builtin-name">let</span></span> [random-number (<span class="hljs-name"><span class="hljs-builtin-name">rand</span></span>)]
    (<span class="hljs-name"><span class="hljs-builtin-name">cond</span></span> (<span class="hljs-name"><span class="hljs-builtin-name">&lt;</span></span> random-number <span class="hljs-number">0.04</span>) <span class="hljs-string">"Wolf fang"</span>
          (<span class="hljs-name"><span class="hljs-builtin-name">&lt;</span></span> random-number <span class="hljs-number">0.9</span>) <span class="hljs-string">"Wolf pelt"</span>)))
</code></pre>
<pre><code class="lang-go"><span class="hljs-function"><span class="hljs-keyword">func</span> <span class="hljs-title">wolfDrop</span><span class="hljs-params">()</span> <span class="hljs-title">string</span></span> {
    randomNumber := rand.Float64()
    <span class="hljs-keyword">switch</span> {
        <span class="hljs-keyword">case</span> randomNumber &lt; <span class="hljs-number">0.04</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf fang"</span>
        <span class="hljs-keyword">case</span> randomNumber &lt; <span class="hljs-number">0.9</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf pelt"</span>
        <span class="hljs-keyword">default</span>:
            <span class="hljs-keyword">return</span> <span class="hljs-string">""</span>
    }
}
</code></pre>
<pre><code class="lang-kotlin"><span class="hljs-function"><span class="hljs-keyword">fun</span> <span class="hljs-title">wolfDrop</span><span class="hljs-params">()</span></span>: String {
    <span class="hljs-keyword">val</span> randomNumber = Random.nextFloat()
    <span class="hljs-keyword">when</span> {
        randomNumber &lt; <span class="hljs-number">0.04</span> -&gt; <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf fang"</span>
        randomNumber &lt; <span class="hljs-number">0.9</span> -&gt; <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf pelt"</span>
        <span class="hljs-keyword">else</span> -&gt; <span class="hljs-keyword">return</span> <span class="hljs-string">""</span>
    }
}
</code></pre>
<pre><code class="lang-elixir"><span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">wolf_pelt</span></span>() <span class="hljs-keyword">do</span>
  random_number = <span class="hljs-symbol">:rand</span>.uniform()
  <span class="hljs-keyword">cond</span> <span class="hljs-keyword">do</span>
    random_number &lt; 0.04 -&gt; <span class="hljs-string">"Wolf fang"</span>
    random_number &lt; 0.<span class="hljs-number">9</span> -&gt; <span class="hljs-string">"Wolf pelt"</span>
    <span class="hljs-keyword">true</span> -&gt; <span class="hljs-keyword">nil</span>
  <span class="hljs-keyword">end</span>
<span class="hljs-keyword">end</span>
</code></pre>
<pre><code class="lang-c#"><span class="hljs-function"><span class="hljs-keyword">string</span> <span class="hljs-title">WolfPelt</span>(<span class="hljs-params"></span>)</span> {
  <span class="hljs-keyword">var</span> random = <span class="hljs-keyword">new</span> Random();
  <span class="hljs-keyword">double</span> randomNumber = random.NextDouble();
  <span class="hljs-keyword">if</span> (randomNumber &lt; <span class="hljs-number">0.04</span>) <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf fang"</span>;
  <span class="hljs-keyword">if</span> (randomNumber &lt; <span class="hljs-number">0.9</span>) <span class="hljs-keyword">return</span> <span class="hljs-string">"Wolf pelt"</span>;
  <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span>;
}
</code></pre>
<pre><code class="lang-rust"><span class="hljs-keyword">extern</span> <span class="hljs-keyword">crate</span> rand;

<span class="hljs-function"><span class="hljs-keyword">fn</span> <span class="hljs-title">wolf_drop</span></span>() -&gt; &amp;<span class="hljs-symbol">'static</span> <span class="hljs-built_in">str</span> {
  <span class="hljs-keyword">let</span> random_number: <span class="hljs-built_in">f64</span> = rand::random();
  <span class="hljs-keyword">if</span> random_number &lt; <span class="hljs-number">0.04</span> {
    <span class="hljs-string">"Wolf fang"</span>
  } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> random_number &lt; <span class="hljs-number">0.9</span> {
    <span class="hljs-string">"Wolf pelt"</span>
  } <span class="hljs-keyword">else</span> {
    <span class="hljs-string">""</span>
  }
}
</code></pre>
<pre><code class="lang-c"><span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;stdlib.h&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;string.h&gt;</span></span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;time.h&gt;</span></span>

<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">wolf_drop</span><span class="hljs-params">(<span class="hljs-keyword">char</span> *drop_item)</span> </span>{
  srand((<span class="hljs-keyword">unsigned</span>) time(<span class="hljs-number">0</span>));
  <span class="hljs-keyword">double</span> random_number = <span class="hljs-number">1.0</span> * rand() / RAND_MAX;
  <span class="hljs-keyword">if</span> (random_number &lt; <span class="hljs-number">0.04</span>) {
    <span class="hljs-built_in">strncpy</span>(drop_item, <span class="hljs-string">"wolf fang\0"</span>, <span class="hljs-number">10</span>);
  } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (random_number &lt; <span class="hljs-number">0.9</span>) {
    <span class="hljs-built_in">strncpy</span>(drop_item, <span class="hljs-string">"wolf pelt\0"</span>, <span class="hljs-number">10</span>);
  } <span class="hljs-keyword">else</span> {
    <span class="hljs-built_in">strncpy</span>(drop_item, <span class="hljs-string">"\0"</span>, <span class="hljs-number">1</span>);
  }
  <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<pre><code class="lang-julia"><span class="hljs-keyword">function</span> wolfdrop()
    randomnumber = rand()
    <span class="hljs-keyword">if</span> randomnumber &lt; <span class="hljs-number">0.04</span>
        <span class="hljs-keyword">return</span> <span class="hljs-string">"wolf fang"</span>
    <span class="hljs-keyword">elseif</span> randomnumber &lt; <span class="hljs-number">0.9</span>
        <span class="hljs-keyword">return</span> <span class="hljs-string">"wolf pelt"</span>
    <span class="hljs-keyword">else</span>
        <span class="hljs-keyword">return</span> <span class="hljs-string">""</span>
    <span class="hljs-keyword">end</span>
<span class="hljs-keyword">end</span>
</code></pre>
<p>(Thanks to <a target="_blank" href="https://forum.freecodecamp.org/u/alpox">alpox</a> for the code snippets in Clojure, Golang, Kotlin, Elixir and C#, and to <a target="_blank" href="https://www.freecodecamp.org/news/author/jeremylt/">Jeremy</a> for the snippets in Rust, C, and Julia.)</p>
<h3 id="heading-other-examples-of-mathrandom">Other examples of math.random</h3>
<p>If you want to learn more about all this, you can read this article about the <a target="_blank" href="https://www.freecodecamp.org/news/how-to-use-javascript-math-random-as-a-random-number-generator/">Math.random function in JavaScript</a> and create a Dice Rolling Game. </p>
<p>You can also read this <a target="_blank" href="https://www.freecodecamp.org/news/how-to-make-your-own-procedural-dungeon-map-generator-using-the-random-walk-algorithm-e0085c8aa9a/">article on using the random walk algorithm</a> and create a random dungeon map with JavaScript to experiment some more with RNGs.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Random Number Generators, or RNGs, are used in many games. In this article, you have learned how and why they are used, and you've seen an example implementation. </p>
<p>Next time you play a video game, will you be able to spot where a RNG may be used?</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Make a Bouncing Basketball in Unity with Materials and Textures 🏀 ]]>
                </title>
                <description>
                    <![CDATA[ By Rajat Kumar Gupta In this article, I'll teach you how to make a basketball using materials and textures in Unity. You can extend this micro-concept to create any kind of ball like a football, tennis ball, or snooker balls.  That said, these techni... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-make-a-basketball-in-unity-with-materials-and-textures/</link>
                <guid isPermaLink="false">66d45f6336c45a88f96b7ce1</guid>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ unity ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 27 May 2021 15:16:34 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/05/basketball-image.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Rajat Kumar Gupta</p>
<p>In this article, I'll teach you how to make a basketball using materials and textures in Unity. You can extend this micro-concept to create any kind of ball like a football, tennis ball, or snooker balls. </p>
<p>That said, these techniques aren't just limited to creating round 3D objects like balls. You should be able to use this concept to customize the look of any type of geometry (or mesh).</p>
<p>Here is what you will create👇🏻</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1.gif" alt="A basketball bouncing on a plane surface" width="600" height="400" loading="lazy">
<em>Basketball🏀</em></p>
<p>Think of the basketball as a sphere (that is, a mesh) wrapped up with a pretty paper (that is, a texture).</p>
<p>Let’s get started.</p>
<h3 id="heading-prerequisites">Prerequisites</h3>
<p>To make the bouncing ball, your sample scene should have  the following:</p>
<ol>
<li>A plane</li>
<li>A sphere with a custom material</li>
</ol>
<p>Let's see how to do that first.</p>
<h2 id="heading-step-1-how-to-add-a-plane-and-a-sphere-to-the-scene">Step 1: How to Add a Plane and a Sphere to the Scene</h2>
<p>First go to the Hierarchy Panel in Unity. Right click and select plane to drop a plane in your scene. Do the same to add a sphere.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/plane-and-sphere.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Add a plane and a sphere to the scene</em></p>
<h2 id="heading-step-2-how-to-create-a-folder-that-contains-all-the-colors">Step 2: How to Create a Folder that Contains All the Colors</h2>
<p>It’s always a good practice to begin by creating a folder that contains all your colors and materials. This helps you create a palette (or a collection of colors and materials) and makes it easier for you to apply the assets in your palette to the Game Objects.</p>
<p>Simply go to the Projects panel. Then right click in the assets sub-panel, click create, and then select folder. Name this folder "Materials".</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/ColorFolder-min.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Right-click in Assets Panel &gt; Create &gt; Folder &gt; Name it “Materials”</em></p>
<h2 id="heading-step-3-how-to-create-a-material-for-the-plane">Step 3: How to Create a Material for the Plane</h2>
<p>The next step is to create colors (or materials) for the plane.</p>
<p>Go inside the materials folder that you created in the above step by double clicking on it. Right click and select create. Then select "Material" from the dropdown.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1_5PyYNjCGe3_lYB4LYwb5KA.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Go inside Materials Folder &gt; Right-click &gt; Create &gt; Material &gt; Name it “MyColor”(or whatever you want)</em></p>
<h2 id="heading-step-4-how-to-change-the-albedo-property-of-the-material">Step 4: How to Change the Albedo Property of the Material</h2>
<p>Next select the created material and check out its properties in the Inspector Panel on the right-hand side. </p>
<p>Note that you only need to change the albedo property of the plane's material and <strong>not</strong> the sphere's material. We will create a material for the sphere later in this article.</p>
<p>It is important that your sphere has a custom material in this step. Otherwise, you will not be able to view or modify the various properties of the Material.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/change-albedo-property.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Change the “albedo” property to whatever color you want.</em></p>
<p>Great! Now you can create a collection of colors using the same technique.</p>
<p>Now we can apply the color to any Game Object like this👇.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1_n1b2BxGPRFe5hV6uiBMTCw.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Drag and drop the material into the Game Object (in our case it will be a plane instead of a cube)</em></p>
<h2 id="heading-step-5-how-to-add-the-rigidbody-component-to-the-ball">Step 5: How to Add the Rigidbody Component to the Ball</h2>
<p>Since we need our ball to obey the laws of physics, we will have to attach the Rigidbody component to it.</p>
<p>To do so, select the Sphere from your Scene Hierarchy panel. Click on Add Component and then make sure the "Use Gravity" box is checked. We don’t want the ball to float off into space 😅.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1_i5YL1YYQ5zDSYM2X3TCLFg.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Select the Sphere &gt; Add Component &gt; Rigid Body &gt; Keep “Use Gravity” box checked</em></p>
<h2 id="heading-step-6-how-to-create-a-bouncy-material">Step 6: How to Create a "Bouncy" Material</h2>
<p>Go to the assets panel. Right click and then click create. Make sure you select the "Physic Material" and <strong>not</strong> Material. Name the material anything you want to. I named it "Bouncy" for obvious reasons.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1_b_3AtywJx2c4owi9uGamOg.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Right-click in the assets panel &gt; Create &gt; Physic Material &gt; Name it “Bouncy”</em></p>
<h2 id="heading-step-7-how-to-change-the-properties-of-the-bouncy-material">Step 7: How to Change the Properties of the Bouncy Material</h2>
<p>Select the Bouncy Material. You should be able to view the properties of this material on the right-hand side in the the Inspector panel. Now change the properties.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1_D9khGemDSHYutFoTs08WzQ.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Set Friction to 0 and Bounciness to 1</em></p>
<h2 id="heading-step-8-how-to-apply-the-material-to-the-sphere">Step 8: How to Apply the Material to the Sphere</h2>
<p>Now apply this material to the sphere (that is, the ball) in our scene by simply dragging and dropping the bouncy material to the sphere.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1_cCrIarAzTFKxQJ0tOciSyQ.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Drag and drop the Bouncy Material into the Sphere</em></p>
<p>That’s it! 🎉 This step confirms that the sphere will bounce on the floor.</p>
<h2 id="heading-step-9-hit-the-play-button">Step 9: Hit the Play Button</h2>
<p>On top of the Game panel you will find the play button. Click on it and the ball will start bouncing. </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1_c0PLeoiv2A4LRUgu7s_zKw.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Our ball is bouncing now. Yayyy!</em></p>
<p>Notice how the bouncing stops after some time. This is expected behavior and we will fix this in the next step.</p>
<h2 id="heading-step-10-how-to-change-the-properties-of-the-bouncy-material">Step 10: How to Change the Properties of the "Bouncy" Material</h2>
<p>Different balls bounce differently. You can control the number of times the ball bounces. Try experimenting with different properties of the “Bouncy” material. </p>
<p>Select the "Bouncy" material in the Materials folder and try changing the values of the properties. If you want the ball to bounce forever set the value of Bounce Combine to Maximum.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/1_aH8Epn0bCvlrZEy-nn6WJQ.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Set the value of Bounce Combine to Maximum and our ball won’t stop bouncing at all</em></p>
<p>Alright. Now let's make that ball look like a real basketball. </p>
<h2 id="heading-step-11-how-to-create-a-folder-that-will-contain-all-your-textures">Step 11: How to Create a Folder that Will Contain All Your Textures</h2>
<p>To keep things organized, let’s create a folder that will contain all the textures.</p>
<p>To do so, go to the assets panel and create a new folder called "Textures". This is where we will store all our textures.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/2.gif" alt="Right-click in Assets Panel. Then select Create. Then select Folder. Name it &quot;Textures&quot;" width="600" height="400" loading="lazy">
<em>Right-click in Assets Panel &gt; Create &gt; Folder &gt; Name it “Textures”</em></p>
<h2 id="heading-step-12-how-to-download-a-texture">Step 12: How to Download a Texture</h2>
<p>Since we need a texture for a basketball, simply download one online. A texture is just an image in .png or .jpg format. For now, you can download the basketball texture from here:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.robinwood.com/Catalog/FreeStuff/Textures/TexturePages/BallMaps.html">https://www.robinwood.com/Catalog/FreeStuff/Textures/TexturePages/BallMaps.html</a></div>
<p>Make sure you have the appropriate license to use a texture that you download. The above textures are free to use.</p>
<h2 id="heading-step-13-how-to-drop-the-texture-into-your-unity-project">Step 13: How to Drop the Texture into your Unity Project</h2>
<p>Simply drag and drop the textures into the Textures folder as shown below👇</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/3.gif" alt="Image" width="600" height="400" loading="lazy">
<em>Drag and drop the downloaded texture into the “Textures” folder that you created in Step 1 above.</em></p>
<h2 id="heading-step-14-how-to-apply-the-downloaded-texture-to-the-sphere">Step 14: How to Apply the Downloaded Texture to the Sphere</h2>
<p>Select the sphere to view all its properties in the Inspector panel. Then drag and drop the "BasketballColor" texture to the square box on the left hand side of the Albedo property.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/4.gif" alt="Drag and drop the downloaded texture to the box at the left of the Albedo property." width="600" height="400" loading="lazy">
<em>Drag and drop the downloaded texture to the box at the left of the Albedo property.</em></p>
<p>You've successfully used Materials and Textures to create a basketball. Now you can do the same for all your games or AR/VR experiences that you develop.</p>
<p>Different types of balls behave differently. Try experimenting with the bounciness and tweaking the different parameters of the Rigid Body Component attached to the sphere to create a golf ball, a football, or a tennis ball.</p>
<p>Enjoy!👏🏻</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://buymeacoffee.com/knightcube">https://buymeacoffee.com/knightcube</a></div>
<h3 id="heading-you-can-connect-with-me-on-social-media-here">You can connect with me on social media here:</h3>
<ul>
<li>Twitter id: <a target="_blank" href="https://twitter.com/knightcube">@knightcube</a></li>
<li><a target="_blank" href="https://www.youtube.com/channel/UCvB2-KQUEwXSrzX4-lhEfPg?sub_confirmation=1">Subscribe to my YouTube channel to learn more about AR/VR</a></li>
<li>Read more articles <a target="_blank" href="https://knightcube.medium.com/">on my Medium profile here</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Three.js Tutorial – How to Render 3D Objects in the Browser ]]>
                </title>
                <description>
                    <![CDATA[ If you have ever wanted to build a game with JavaScript, you might have come across Three.js.  Three.js is a library that we can use to render 3D graphics in the browser. The whole thing is in JavaScript, so with some logic you can add animation, int... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/render-3d-objects-in-browser-drawing-a-box-with-threejs/</link>
                <guid isPermaLink="false">66c4c8174173ed342943d0c2</guid>
                
                    <category>
                        <![CDATA[ 3d ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ three.js ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Hunor Márton Borbély ]]>
                </dc:creator>
                <pubDate>Wed, 03 Feb 2021 23:06:37 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/02/Stack.002-1.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you have ever wanted to build a game with JavaScript, you might have come across Three.js. </p>
<p>Three.js is a library that we can use to render 3D graphics in the browser. The whole thing is in JavaScript, so with some logic you can add animation, interaction, or even turn it into a game. </p>
<p>In this tutorial, we will go through a very simple example. We'll render a 3D box, and while doing so we'll learn the fundamentals of Three.js. </p>
<p>Three.js uses WebGL under the hood to render 3D graphics. We could use plain WebGL, but it's very complex and rather low level. On the other hand, Three.js is like playing with Legos. </p>
<p>In this article, we'll go through how to place a 3D object in a scene, set up the lighting and a camera, and render the scene on a canvas. So let’s see how we can do all this.</p>
<h2 id="heading-define-the-scene-object">Define the Scene Object</h2>
<p>First, we have to define a scene. This will be a container where we place our 3D objects and lights. The scene object also has some properties, like the background color. Setting that is optional though. If we don't set it, the default will be black.</p>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> THREE <span class="hljs-keyword">from</span> <span class="hljs-string">"three"</span>;

<span class="hljs-keyword">const</span> scene = <span class="hljs-keyword">new</span> THREE.Scene();
scene.background = <span class="hljs-keyword">new</span> THREE.Color(<span class="hljs-number">0x000000</span>); <span class="hljs-comment">// Optional, black is default</span>

...
</code></pre>
<h2 id="heading-geometry-material-mesh">Geometry + Material = Mesh</h2>
<p>Then we add our 3D box to the scene as a mesh. A mesh is a combination of a geometry and a material.</p>
<pre><code class="lang-js">...

<span class="hljs-comment">// Add a cube to the scene</span>
<span class="hljs-keyword">const</span> geometry = <span class="hljs-keyword">new</span> THREE.BoxGeometry(<span class="hljs-number">3</span>, <span class="hljs-number">1</span>, <span class="hljs-number">3</span>); <span class="hljs-comment">// width, height, depth</span>
<span class="hljs-keyword">const</span> material = <span class="hljs-keyword">new</span> THREE.MeshLambertMaterial({ <span class="hljs-attr">color</span>: <span class="hljs-number">0xfb8e00</span> });
<span class="hljs-keyword">const</span> mesh = <span class="hljs-keyword">new</span> THREE.Mesh(geometry, material);
mesh.position.set(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>); <span class="hljs-comment">// Optional, 0,0,0 is the default</span>
scene.add(mesh);

...
</code></pre>
<h3 id="heading-what-is-a-geometry">What is a Geometry?</h3>
<p>A geometry is a rendered shape that we’re building - like a box. A geometry can be build from vertices or we can use a predefined one. </p>
<p>The BoxGeometry is the most basic predefined option. We only have to set the width, height, and depth of the box and that’s it. </p>
<p>You might think that we can't get far by defining boxes, but many games with minimalistic design use only a combination of boxes. </p>
<p>There are other predefined geometries as well. We can easily define a plane, a cylinder, a sphere, or even an icosahedron.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/freecodecamp-4.001.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<h3 id="heading-how-to-work-with-material">How to Work with Material</h3>
<p>Then we define a material. A material describes the appearance of an object. Here we can define things like texture, color, or opacity. </p>
<p>In this example we are only going to set a color. There are still different options for materials. The main difference between most of them is how they react to light. </p>
<p>The simplest one is the MeshBasicMaterial. This material doesn't care about light at all, and each side will have the same color. It might not be the best option, though, as you can’t see the edges of the box.</p>
<p>The simplest material that cares about light is the MeshLambertMaterial. This will calculate the color of each vertex, which is practically each side. But it doesn't go beyond that.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/freecodecamp-4.002.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>If you need more precision, there are more advanced materials. The MeshPhongMaterial not only calculates the color by vertex but by each pixel. The color can change within a side. This can help with realism but also costs in performance. </p>
<p>It also depends on the light settings and the geometry if it has any real effect. If we render boxes and use directional light, the result won't change that much. But if we render a sphere, the difference is more obvious.</p>
<h3 id="heading-how-to-position-a-mesh">How to Position a Mesh</h3>
<p>Once we have a mesh we can also position it within the scene and set a rotation by each axis. Later if we want to animate objects in the 3D space we will mostly adjust these values. </p>
<p>For positioning we use the same units that we used for setting the size. It doesn't matter if you are using small numbers or big numbers, you just need to be consistent in your own world. </p>
<p>For the rotation we set the values in radians. So if you have your values in degrees you have to divide them by 180° then multiply by PI.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/freecodecamp-3.004.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<h2 id="heading-how-to-add-light">How to Add Light</h2>
<p>Then let's add lights. A mesh with basic material doesn’t need any light, as the mesh will have the set color regardless of the light settings. </p>
<p>But the Lambert material and Phong material require light. If there isn't any light, the mesh will remain in darkness.</p>
<pre><code class="lang-js">...

<span class="hljs-comment">// Set up lights</span>
<span class="hljs-keyword">const</span> ambientLight = <span class="hljs-keyword">new</span> THREE.AmbientLight(<span class="hljs-number">0xffffff</span>, <span class="hljs-number">0.6</span>);
scene.add(ambientLight);

...
</code></pre>
<p>We'll add two lights - an ambient light and a directional light. </p>
<p>First, we add the ambient light. The ambient light is shining from every direction, giving a base color for our geometry. </p>
<p>To set an ambient light we set a color and an intensity. The color is usually white, but you can set any color. The intensity is a number between 0 and 1. The two lights we define work in an accumulative way so in this case we want the intensity to be around 0.5 for each.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/freecodecamp-3.003.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The directional light has a similar setup, but it also has a position. The word position here is a bit misleading, because it doesn’t mean that the light is coming from an exact position. </p>
<p>The directional light is shining from very far away with many parallel light rays all having a fixed angle. But instead of defining angles, we define the direction of a single light ray. </p>
<p>In this case, it shines from the direction of the 10,20,0 position towards the 0,0,0 coordinate. But of course, the directional light is not only one light ray, but an infinite amount of parallel rays. </p>
<p>Think of it as the sun. On a smaller scale, light rays of the sun also come down in parallel, and the sun’s position isn't what matters but rather its direction. </p>
<p>And that’s what the directional light is doing. It shines on everything with parallel light rays from very far away.</p>
<pre><code class="lang-js">...

const dirLight = <span class="hljs-keyword">new</span> THREE.DirectionalLight(<span class="hljs-number">0xffffff</span>, <span class="hljs-number">0.6</span>);
dirLight.position.set(<span class="hljs-number">10</span>, <span class="hljs-number">20</span>, <span class="hljs-number">0</span>); <span class="hljs-comment">// x, y, z</span>
scene.add(dirLight);

...
</code></pre>
<p>Here we set the position of the light to be from above (with the Y value) and shift it a bit along the X-axis as well. The Y-axis has the highest value. This means that the top of the box receives the most light and it will be the shiniest side of the box. </p>
<p>The light is also moved a bit along the X-axis, so the right side of the box will also receive some light, but less. </p>
<p>And because we don’t move the light position along the Z-axis, the front side of the box will not receive any light from this source. If there wasn't an ambient light, the front side would remain in darkness. </p>
<p>There are other light types as well. The PointLight, for instance, can be used to simulate light bulbs. It has a fixed position and it emits light in every direction. And the SpotLight can be used to simulate the spotlight of a car. It emits light from a single point into a direction along a cone.</p>
<h2 id="heading-how-to-set-up-the-camera">How to Set up the Camera</h2>
<p>So far, we have created a mesh with geometry and material. And we have also set up lights and added to the scene. We still need a camera to define how we look at this scene. </p>
<p>There are two options here: perspective cameras and orthographic cameras.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/Stack.010.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Video games mostly use perspective cameras, because how they work is similar to how you see things in real life. Things that are further away appear to be smaller and things that are right in front of you appear bigger. </p>
<p>With orthographic projections, things will have the same size no matter how far they are from the camera. Orthographic cameras have a more minimal, geometric look. They don't distort the geometries - the parallel lines will appear in parallel.</p>
<p>For both cameras, we have to define a view frustum. This is the region in the 3D space that is going to be projected to the screen. Anything outside of this region won't appear on the screen. This is because it is either too close or too far away, or because the camera isn't pointed towards it.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/02/freecodecamp-2.001.jpeg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>With perspective projection, everything within the view frustum is projected towards the viewpoint with a straight line. Things further away from the camera appear smaller on the screen, because from the viewpoint you can see them under a smaller angle.</p>
<pre><code class="lang-js">...

<span class="hljs-comment">// Perspective camera</span>
<span class="hljs-keyword">const</span> aspect = <span class="hljs-built_in">window</span>.innerWidth / <span class="hljs-built_in">window</span>.innerHeight;
<span class="hljs-keyword">const</span> camera = <span class="hljs-keyword">new</span> THREE.PerspectiveCamera(
  <span class="hljs-number">45</span>, <span class="hljs-comment">// field of view in degrees</span>
  aspect, <span class="hljs-comment">// aspect ratio</span>
  <span class="hljs-number">1</span>, <span class="hljs-comment">// near plane</span>
  <span class="hljs-number">100</span> <span class="hljs-comment">// far plane</span>
);

...
</code></pre>
<p>To define a perspective camera, you need to set a field of view, which is the vertical angle from the viewpoint. Then you define an aspect ratio of the width and the height of the frame. If you fill the whole browser window and you want to keep its aspect ratio, then this is how you can do it. </p>
<p>Then the last two parameters define how far the near and far planes are from the viewpoint. Things that are too close to the camera will be ignored, and things that are too far away will be ignored as well.</p>
<pre><code class="lang-js">...

<span class="hljs-comment">// Orthographic camera</span>
<span class="hljs-keyword">const</span> width = <span class="hljs-number">10</span>;
<span class="hljs-keyword">const</span> height = width * (<span class="hljs-built_in">window</span>.innerHeight / <span class="hljs-built_in">window</span>.innerWidth);
<span class="hljs-keyword">const</span> camera = <span class="hljs-keyword">new</span> THREE.OrthographicCamera(
  width / <span class="hljs-number">-2</span>, <span class="hljs-comment">// left</span>
  width / <span class="hljs-number">2</span>, <span class="hljs-comment">// right</span>
  height / <span class="hljs-number">2</span>, <span class="hljs-comment">// top</span>
  height / <span class="hljs-number">-2</span>, <span class="hljs-comment">// bottom</span>
  <span class="hljs-number">1</span>, <span class="hljs-comment">// near</span>
  <span class="hljs-number">100</span> <span class="hljs-comment">// far</span>
);

...
</code></pre>
<p>Then there’s the orthographic camera. Here we are not projecting things towards a single point but towards a surface. Each projection line is in parallel. That’s why it doesn’t matter how far objects are from the camera, and that’s why it doesn’t distort geometries. </p>
<p>For orthographic cameras, we have to define how far each plane is from the viewpoint. The left plane is therefor five units to the left, and the right plane is five units to the right, and so on.</p>
<pre><code class="lang-js">...

camera.position.set(<span class="hljs-number">4</span>, <span class="hljs-number">4</span>, <span class="hljs-number">4</span>);
camera.lookAt(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>);

...
</code></pre>
<p>Regardless of which camera are we using, we also need to position it and set it in a direction. If we are using an orthographic camera the actual numbers here don’t matter that much. The objects will appear the same size no matter how far away they are from the camera. What matters, though, is their proportion. </p>
<p>Through this whole tutorial, we saw all the examples through the same camera. This camera was moved by the same unit along every axis and it looks towards the 0,0,0 coordinate. Positioning an orthographic camera is like positioning a directional light. It's not the actual position that matters, but its direction.</p>
<h2 id="heading-how-to-render-the-scene">How to Render the Scene</h2>
<p>So we managed to put together the scene and a camera. Now only the final piece is missing that renders the image into our browser. </p>
<p>We need to define a WebGLRenderer. This is the piece that is capable of rendering the actual image into an HTML canvas when we provide a scene and a camera. This is also where we can set the actual size of this canvas – the width and height of the canvas in pixels as it should appear in the browser.</p>
<pre><code class="lang-js"><span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> THREE <span class="hljs-keyword">from</span> <span class="hljs-string">"three"</span>;

<span class="hljs-comment">// Scene</span>
<span class="hljs-keyword">const</span> scene = <span class="hljs-keyword">new</span> THREE.Scene();

<span class="hljs-comment">// Add a cube to the scene</span>
<span class="hljs-keyword">const</span> geometry = <span class="hljs-keyword">new</span> THREE.BoxGeometry(<span class="hljs-number">3</span>, <span class="hljs-number">1</span>, <span class="hljs-number">3</span>); <span class="hljs-comment">// width, height, depth</span>
<span class="hljs-keyword">const</span> material = <span class="hljs-keyword">new</span> THREE.MeshLambertMaterial({ <span class="hljs-attr">color</span>: <span class="hljs-number">0xfb8e00</span> });
<span class="hljs-keyword">const</span> mesh = <span class="hljs-keyword">new</span> THREE.Mesh(geometry, material);
mesh.position.set(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>);
scene.add(mesh);

<span class="hljs-comment">// Set up lights</span>
<span class="hljs-keyword">const</span> ambientLight = <span class="hljs-keyword">new</span> THREE.AmbientLight(<span class="hljs-number">0xffffff</span>, <span class="hljs-number">0.6</span>);
scene.add(ambientLight);

<span class="hljs-keyword">const</span> directionalLight = <span class="hljs-keyword">new</span> THREE.DirectionalLight(<span class="hljs-number">0xffffff</span>, <span class="hljs-number">0.6</span>);
directionalLight.position.set(<span class="hljs-number">10</span>, <span class="hljs-number">20</span>, <span class="hljs-number">0</span>); <span class="hljs-comment">// x, y, z</span>
scene.add(directionalLight);

<span class="hljs-comment">// Camera</span>
<span class="hljs-keyword">const</span> width = <span class="hljs-number">10</span>;
<span class="hljs-keyword">const</span> height = width * (<span class="hljs-built_in">window</span>.innerHeight / <span class="hljs-built_in">window</span>.innerWidth);
<span class="hljs-keyword">const</span> camera = <span class="hljs-keyword">new</span> THREE.OrthographicCamera(
  width / <span class="hljs-number">-2</span>, <span class="hljs-comment">// left</span>
  width / <span class="hljs-number">2</span>, <span class="hljs-comment">// right</span>
  height / <span class="hljs-number">2</span>, <span class="hljs-comment">// top</span>
  height / <span class="hljs-number">-2</span>, <span class="hljs-comment">// bottom</span>
  <span class="hljs-number">1</span>, <span class="hljs-comment">// near</span>
  <span class="hljs-number">100</span> <span class="hljs-comment">// far</span>
);

camera.position.set(<span class="hljs-number">4</span>, <span class="hljs-number">4</span>, <span class="hljs-number">4</span>);
camera.lookAt(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>);

<span class="hljs-comment">// Renderer</span>
<span class="hljs-keyword">const</span> renderer = <span class="hljs-keyword">new</span> THREE.WebGLRenderer({ <span class="hljs-attr">antialias</span>: <span class="hljs-literal">true</span> });
renderer.setSize(<span class="hljs-built_in">window</span>.innerWidth, <span class="hljs-built_in">window</span>.innerHeight);
renderer.render(scene, camera);

<span class="hljs-comment">// Add it to HTML</span>
<span class="hljs-built_in">document</span>.body.appendChild(renderer.domElement);
</code></pre>
<p>And finally, the last line here adds this rendered canvas to our HTML document. And that’s all you need to render a box. It might seem a little too much for just a single box, but most of these things we only have to set up once. </p>
<p>If you want to move forward with this project, then check out my YouTube video on how to turn this into a simple game. In the video, we create a stack building game. We add game logic, event handlers and animation, and even some physics with Cannon.js.</p>
<div class="embed-wrapper">
        <iframe width="560" height="315" src="https://www.youtube.com/embed/hBiGFpBle7E" style="aspect-ratio: 16 / 9; width: 100%; height: auto;" title="YouTube video player" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen="" loading="lazy"></iframe></div>
<p>If you have any feedback or questions on this tutorial, feel free to Tweet me <a target="_blank" href="https://twitter.com/HunorBorbely">@HunorBorbely</a> or leave a comment on <a target="_blank" href="https://www.youtube.com/channel/UCxhgW0Q5XLvIoXHAfQXg9oQ">YouTube</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Deploy a Live2D Web App Using Heroku ]]>
                </title>
                <description>
                    <![CDATA[ What is Live2D? Live2D is a technology that allows artists to easily transform traditional 2D illustrations to create fluid expressions and motions. The most popular software for Live2D modeling and animation is Cubism, which also provides well-docum... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-deploy-a-live2d-web-app-using-heroku/</link>
                <guid isPermaLink="false">66d4601d787a2a3b05af43d8</guid>
                
                    <category>
                        <![CDATA[ animation ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Cloud Computing ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Heroku ]]>
                    </category>
                
                    <category>
                        <![CDATA[ node ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Lynn Zheng ]]>
                </dc:creator>
                <pubDate>Mon, 28 Dec 2020 17:48:17 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/12/web-2.gif" medium="image" />
                <content:encoded>
                    <![CDATA[ <h2 id="heading-what-is-live2d">What is Live2D?</h2>
<p>Live2D is a technology that allows artists to easily transform traditional 2D illustrations to create fluid expressions and motions.</p>
<p>The most popular software for Live2D modeling and animation is Cubism, which also provides well-documented SDK for web, native apps, and the Unity game development engine.</p>
<p>In this tutorial, I will walk you through how to build on top of Cubism's official Live2D Web SDK sample and deploy it to Heroku, a popular cloud app-hosting platform.</p>
<h2 id="heading-how-to-set-up-the-environment">How to Set Up the Environment</h2>
<p>To follow along with this tutorial, clone my GitHub repo and checkout the <code>start</code> branch. The finished project is on the <code>develop</code> branch.</p>
<p>I've also recorded <a target="_blank" href="https://youtu.be/uH1IczzE_t4">a video tutorial on YouTube</a>.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/RuolinZheng08/heroku-live2d">https://github.com/RuolinZheng08/heroku-live2d</a></div>
<p> </p>
<pre><code class="lang-shell">git clone https://github.com/RuolinZheng08/heroku-live2d.git
git checkout start

# update the submodule, Cubism's Live2d Web Framework
git submodule update --init
</code></pre>
<p>Install Node.js and npm using Homebrew:</p>
<pre><code class="lang-shell"># if you need to install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# homebrew will install node and npm at the same time
brew install node
</code></pre>
<p>I'll be using Visual Studio Code as my main IDE, but you may follow along using any editor of your choice.</p>
<h2 id="heading-how-to-run-the-starter-code-locally">How to Run the Starter Code Locally</h2>
<p>The directory structure is as follows. Our web app will be served from <code>Samples/TypeScript/Demo</code>.</p>
<pre><code class="lang-pgsql">.
├─ .vscode          # Visual Studio Code project setting
├─ Core             # Live2D Cubism Core JavaScript <span class="hljs-keyword">and</span> TypeScript source code
├─ Framework        #  Source code <span class="hljs-keyword">for</span> the rendering <span class="hljs-keyword">and</span> animation features
└─ Samples
   ├─ Resources     # Live2D model files <span class="hljs-keyword">and</span> web image assets
   └─ TypeScript    # [IMPORTANT] TypeScript sample project
</code></pre>
<p>Inside the <code>heroku-live2d</code> directory, run the following commands:</p>
<pre><code class="lang-shell">cd Samples/TypeScript/Demo/

npm install

npm run-script build

npm run-script serve
</code></pre>
<p>Navigate to <a target="_blank" href="http://localhost:5000/Samples/TypeScript/Demo/">http://localhost:5000/Samples/TypeScript/Demo/</a> and you should be able to see a Live2D character.</p>
<p>To interact with the model, hold down your mouse cursor and the character's head and eyes will follow your cursor. Tap on the body of the character to see a special animation. Tap on the gear icon in the top right corner to switch between different models.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/12/web.gif" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Mark from</em> <code>Samples/Resources/Mark</code></p>
<h2 id="heading-how-to-deploy-to-heroku">How to Deploy to Heroku</h2>
<p>The starter code uses npm, TypeScript, and webpack.</p>
<p>To deploy our project to Heroku, we need to create a <code>package.json</code> file that Heroku can use to build our project in our project root directory. We also need to modify <code>Samples/TypeScript/Demo/package.json</code> and the webpack configuration in <code>Samples/TypeScript/Demo/webpack.config.js</code>.</p>
<h3 id="heading-top-level-packagejson">Top-level package.json</h3>
<p>The boilerplate <code>package.json</code> for a Node.js Heroku app looks like this:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"name"</span>: <span class="hljs-string">"heroku-live2d"</span>,
    <span class="hljs-attr">"description"</span>: <span class="hljs-string">"Live2D Cubism Heroku Demo"</span>,
    <span class="hljs-attr">"scripts"</span>: {
        <span class="hljs-attr">"start"</span>: ...,
        <span class="hljs-attr">"build"</span>: ...
    },
    <span class="hljs-attr">"dependencies"</span>: {
        ...
    }
}
</code></pre>
<p>Inspect the <code>dependencies</code> and <code>devDependencies</code> attributes in <code>Samples/TypeScript/Demo/package.json</code> and add both sets of dependencies as <code>dependencies</code> to <code>heroku-live2d/package.json</code>.</p>
<p>Remember that when building and serving locally, we used <code>npm run-script [build|serve]</code> from inside the <code>Samples/TypeScript/Demo</code> directory.</p>
<p>Therefore, to run these npm commands from the project root, we need to prepend <code>cd Samples/TypeScript/Demo</code> before the npm commands. The build command, for example, will become:</p>
<pre><code class="lang-shell">cd Samples/TypeScript/Demo &amp;&amp; npm run-script build
</code></pre>
<p>With these changes, the top-level <code>package.json</code> should look like this:</p>
<pre><code class="lang-json">{
    <span class="hljs-attr">"name"</span>: <span class="hljs-string">"heroku-live2d"</span>,
    <span class="hljs-attr">"description"</span>: <span class="hljs-string">"Live2D Cubism Heroku Demo"</span>,
    <span class="hljs-attr">"scripts"</span>: {
        <span class="hljs-attr">"start"</span>: <span class="hljs-string">"cd Samples/TypeScript/Demo &amp;&amp; npm run-script start"</span>,
        <span class="hljs-attr">"build"</span>: <span class="hljs-string">"cd Samples/TypeScript/Demo &amp;&amp; npm run-script build"</span>
    },
    <span class="hljs-attr">"dependencies"</span>: {
        <span class="hljs-attr">"@typescript-eslint/eslint-plugin"</span>: <span class="hljs-string">"^2.18.0"</span>,
        <span class="hljs-attr">"@typescript-eslint/parser"</span>: <span class="hljs-string">"^2.18.0"</span>,
        <span class="hljs-attr">"eslint"</span>: <span class="hljs-string">"^6.8.0"</span>,
        <span class="hljs-attr">"eslint-config-prettier"</span>: <span class="hljs-string">"^6.10.0"</span>,
        <span class="hljs-attr">"eslint-plugin-prettier"</span>: <span class="hljs-string">"^3.1.2"</span>,
        <span class="hljs-attr">"prettier"</span>: <span class="hljs-string">"^1.19.1"</span>,
        <span class="hljs-attr">"rimraf"</span>: <span class="hljs-string">"^3.0.1"</span>,
        <span class="hljs-attr">"serve"</span>: <span class="hljs-string">"^11.3.0"</span>,
        <span class="hljs-attr">"ts-loader"</span>: <span class="hljs-string">"^6.2.1"</span>,
        <span class="hljs-attr">"typescript"</span>: <span class="hljs-string">"^3.7.5"</span>,
        <span class="hljs-attr">"webpack"</span>: <span class="hljs-string">"^4.41.5"</span>,
        <span class="hljs-attr">"webpack-cli"</span>: <span class="hljs-string">"^3.3.10"</span>,
        <span class="hljs-attr">"webpack-dev-server"</span>: <span class="hljs-string">"^3.10.1"</span>,
        <span class="hljs-attr">"whatwg-fetch"</span>: <span class="hljs-string">"^3.0.0"</span>
    }
}
</code></pre>
<h3 id="heading-samplestypescriptdemopackagejson">Samples/TypeScript/Demo/package.json</h3>
<p>On localhost, we were running on port 5000. However, Heroku will dynamically assign our web app a port stored in a variable <code>$PORT</code>. Therefore, we need the <code>npm run-script start</code> command inside <code>Samples/TypeScript/Demo/package.json</code> to start the webpack server on port <code>$PORT</code>.</p>
<p>Append to <code>scripts &gt; start &gt; webpack-dev-server --progress</code> so it looks like this:</p>
<pre><code class="lang-json"><span class="hljs-string">"scripts"</span>: {
    <span class="hljs-attr">"start"</span>: <span class="hljs-string">"webpack-dev-server --progress --port $PORT"</span>,
    ...
}
</code></pre>
<h3 id="heading-samplestypescriptdemowebpackconfigjs">Samples/TypeScript/Demo/webpack.config.js</h3>
<p>Add <code>disableHostCheck</code> to the configuration of <code>devServer</code> and remove <code>port</code> since we have configured it dynamically above.</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">module</span>.exports = {
    ...,
    <span class="hljs-attr">devServer</span>: {
        <span class="hljs-attr">contentBase</span>: path.resolve(__dirname, <span class="hljs-string">'../../..'</span>),
        <span class="hljs-attr">watchContentBase</span>: <span class="hljs-literal">true</span>,
        <span class="hljs-attr">inline</span>: <span class="hljs-literal">true</span>,
        <span class="hljs-attr">hot</span>: <span class="hljs-literal">true</span>,
        <span class="hljs-attr">port</span>: <span class="hljs-number">5000</span>, <span class="hljs-comment">// delete this line</span>
        <span class="hljs-attr">host</span>: <span class="hljs-string">'0.0.0.0'</span>,
        <span class="hljs-attr">disableHostCheck</span>: <span class="hljs-literal">true</span>, <span class="hljs-comment">// add this line</span>
        <span class="hljs-attr">compress</span>: <span class="hljs-literal">true</span>,
        <span class="hljs-attr">useLocalIp</span>: <span class="hljs-literal">true</span>,
        <span class="hljs-attr">writeToDisk</span>: <span class="hljs-literal">true</span>
    },
    ...
}
</code></pre>
<p>Add <code>watchOptions</code> so that our <code>node_modules</code> won't be watched. If we don't do this, we will run into an error about exceeding the maximum number of watchers when we deploy to Heroku.</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">module</span>.exports = {
    ...,
    <span class="hljs-attr">watchOptions</span>: {
        <span class="hljs-attr">ignored</span>: <span class="hljs-regexp">/node_modules/</span>
    },
    ...
}
</code></pre>
<h3 id="heading-deploy-to-heroku">Deploy to Heroku</h3>
<p>To download the Heroku command line client, run</p>
<pre><code class="lang-shell">brew tap heroku/brew &amp;&amp; brew install heroku
</code></pre>
<p>Log into Heroku from the command line using <code>heroku login</code>.</p>
<p>Create a Heroku app and append some numbers (for example, 123) to the app name to ensure uniqueness.</p>
<pre><code class="lang-shell">heroku create heroku-live2d-NUMBERS
</code></pre>
<p>Set up Node.js as the buildpack:</p>
<pre><code class="lang-pgsql">heroku buildpacks:<span class="hljs-keyword">set</span> heroku/nodejs
</code></pre>
<p>Add and commit your project using git. Note that we don't necessarily need <code>git push</code>:</p>
<pre><code class="lang-shell">git add .
git commit -m "Ready to deploy to heroku"
</code></pre>
<p>Push the project to Heroku, assuming you are following along on the <code>start</code> branch. You can always check the branch you are on and push from that branch.</p>
<pre><code class="lang-shell"># check which branch we are on
git branch

# the syntax is
# git push heroku GIT_BRANCH_NAME:HEROKU_BRANCH_NAME
git push heroku start:master
</code></pre>
<p>You may need to wait for a few minutes for the build process to complete.</p>
<p>After that, navigate to <code>YOUR-HEROKU-APP-NAME.herokuapp.com/Samples/TypeScript/Demo</code>. In my case, the URL is <a target="_blank" href="https://heroku-live2d.herokuapp.com/Samples/TypeScript/Demo/">https://heroku-live2d.herokuapp.com/Samples/TypeScript/Demo/</a>. The Live2D characters will be there to greet you :)</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/12/Screen-Shot-2020-12-27-at-16.13.19.png" alt="Image" width="600" height="400" loading="lazy"></p>
<p><em>Notice that the highlighted URL is already on Heroku</em></p>
<h3 id="heading-how-to-redirect-indexhtml-to-samplestypescriptdemo">How to Redirect index.html to Samples/TypeScript/Demo</h3>
<p>You might have noticed that <code>YOUR-HEROKU-APP-NAME.herokuapp.com</code> shows a list of the directory structure instead of the Live2D models. We can solve this by adding a dummy top-level <code>index.html</code> that redirects to <code>Samples/TypeScript/Demo</code>.</p>
<pre><code class="lang-html"><span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">html</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
    <span class="hljs-comment">&lt;!-- Just a dummy html to redirect to my subdirectory --&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">http-equiv</span>=<span class="hljs-string">"refresh"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"0; url=Samples/TypeScript/Demo"</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>

<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>Rerun the deployment command <code>git push heroku start:master</code>. Now when you visit <code>YOUR-HEROKU-APP-NAME.herokuapp.com</code>, you will be automatically redirected to the Live2D model page.</p>
<p>Congratulations on making it to the end of this tutorial! You now have a Live2D Web App deployed to Heroku.</p>
<p>I hope you enjoyed this tutorial. Let's keep in touch! Connect with me on <a target="_blank" href="https://www.linkedin.com/in/ruolin-zheng/">LinkedIn</a>, <a target="_blank" href="https://github.com/RuolinZheng08">GitHub</a>, <a target="_blank" href="https://medium.com/@ruolinzheng">Medium</a>, or check out <a target="_blank" href="https://ruolinzheng08.github.io/">my personal website</a>.</p>
<h3 id="heading-resources-amp-links">Resources &amp; Links</h3>
<p><a target="_blank" href="https://github.com/RuolinZheng08/heroku-live2d/tree/develop">My GitHub repo for this tutorial</a></p>
<p><a target="_blank" href="https://heroku-live2d.herokuapp.com/">My Heroku App</a></p>
<p><a target="_blank" href="https://youtu.be/uH1IczzE_t4">My YouTube Video Tutorial</a></p>
<p><a target="_blank" href="https://docs.live2d.com/cubism-sdk-tutorials/sample-build-web/">Cubism's Official SDK Documentation</a></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Unity Game Engine Guide: How to Get Started with the Most Popular Game Engine Out There ]]>
                </title>
                <description>
                    <![CDATA[ Game Development with Unity Unity is a cross-platform game engine developed by Unity Technologies, which is primarily used to develop video games and simulations for computers, consoles and mobile devices. First announced only for OS X, at Apple’s Wo... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/unity-game-engine-guide-how-to-get-started-with-the-most-popular-game-engine-out-there/</link>
                <guid isPermaLink="false">66c36412b737bb2ce70731ff</guid>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ toothbrush ]]>
                    </category>
                
                    <category>
                        <![CDATA[ unity ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 13 Feb 2020 18:47:00 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/5f9c9c98740569d1a4ca3316.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <h2 id="heading-game-development-with-unity"><strong>Game Development with Unity</strong></h2>
<p>Unity is a cross-platform game engine developed by Unity Technologies, which is primarily used to develop video games and simulations for computers, consoles and mobile devices. First announced only for OS X, at Apple’s Worldwide Developers Conference in 2005, it has since been extended to target 27 platforms.</p>
<h2 id="heading-overview"><strong>Overview</strong></h2>
<p>Unity is an all purpose game engine that supports 2D and 3D graphics, drag and drop functionality and scripting through <a target="_blank" href="https://guide.freecodecamp.org/csharp">C#</a>.</p>
<p>Unity is particularly popular for mobile game development and much of their focus is on mobile platforms. Unity3D’s 2D pipeline is a more recent addition to the engine, and is less mature than the 3D pipeline. Despite this Unity is an adequate platform for developing 2D games even when compared to other dedicated 2D engines, particularly if you plan to release the game across multiple mobile devices.</p>
<p>Unity is also a good choice for VR development, although VR is a very small market at the moment. The mobile and PSVR markets are the largest in VR, and Unity is already well positioned to port games to many platforms such as PS4 and PC, or many different mobile markets.</p>
<p>The engine targets the following graphics APIs: Direct3D on Windows and Xbox One; OpenGL on Linux, macOS, and Windows; OpenGL ES on Android and iOS; WebGL on the web; and proprietary APIs on the video game consoles.</p>
<p>Additionally, Unity supports the low-level APIs Metal on iOS and macOS and Vulkan on Android, Linux, and Windows, as well as Direct3D 12 on Windows and Xbox One. Within 2D games, Unity allows importation of sprites and an advanced 2D world renderer.</p>
<p>For 3D games, Unity allows specification of texture compression and resolution settings for each platform that the game engine supports, and provides support for bump mapping, reflection mapping, parallax mapping, screen space ambient occlusion (SSAO), dynamic shadows using shadow maps, render-to-texture and full-screen post-processing effects.</p>
<p>Unity also offers services to developers, these are: Unity Ads, Unity Analytics, Unity Certification, Unity Cloud Build, Unity Everyplay, Unity IAP, Unity Multiplayer, Unity Performance Reporting and Unity Collaborate. Besides this, Unity has an asset store where the developer community can download and upload both commercial and free third party resources such as textures, models, plugins, editor extensions and even entire game examples.</p>
<p>Unity is notable for its ability to target games for multiple platforms. The currently supported platforms are Android, Android TV, Facebook Gameroom, Fire OS, Gear VR, Google Cardboard, Google Daydream, HTC Vive, iOS, Linux, macOS, Microsoft HoloLens, Nintendo 3DS family, Nintendo Switch, Oculus Rift, PlayStation 4, PlayStation Vita, PlayStation VR, Samsung Smart TV, Tizen, tvOS, WebGL, Wii U, Windows, Windows Phone, Windows Store, and Xbox One.</p>
<p>Unity is the default software development kit (SDK) for Nintendo’s Wii U video game console platform, with a free copy included by Nintendo with each Wii U developer license. Unity Technologies calls this bundling of a third-party SDK an “industry first”.</p>
<h2 id="heading-interface"><strong>Interface</strong></h2>
<p><img src="https://github.com/pawelszpiczakowski/PublicStuff/raw/master/unityInterface.png" alt="Unity Interface" width="600" height="400" loading="lazy"></p>
<p>In picture above, you will notice five section:</p>
<ol>
<li>Section 1. <strong>Scene View</strong>: This is where you will be creating level for your game, scene or 3D project. All of your Game Objects will be placed and manipulated right here.</li>
<li>Section 2. <strong>Game View</strong>: This is where you will see your results, how your level or scene looks like. You need to have a Camera on the scene to see how it looks like. Sometimes its called Camera View.</li>
<li>Section 3. <strong>Hierarchy</strong>: This window will display all Game Objects placed directly on the scene. Basically everything that you see in Game View, needs to be listed here. This will include non-visual and visual game objects.</li>
<li>Section 4. <strong>Project</strong>: This is your project window. Basically it show whats inside Assets folder on your disk. Everything from Game Objects, Scripts, Textures, Folders, Models, Audio, Video and etc… will be accessible from this window.</li>
<li>Section 5. <strong>Inspector</strong>: This panel will display different attibutes and properties of selected Game Objects. Depending on the selection, the appropriate attributes and components will be listed.</li>
</ol>
<h2 id="heading-noteworthy-games"><strong>Noteworthy Games:</strong></h2>
<ul>
<li>Assassin’s Creed: Identity</li>
<li>Temple Run Trilogy</li>
<li>Battlestar Galactica Online</li>
<li>Hearthstone: Heroes of Warcraft</li>
<li>Inside</li>
<li>Cuphead</li>
</ul>
<h2 id="heading-history"><strong>History</strong></h2>
<p>Two other programming languages were supported: Boo, which was deprecated with the release of Unity 5 and UnityScript which was deprecated in August 2017 after the release of Unity 2017.1.</p>
<p>Unity formerly supported 7 other platforms including its own Unity Web Player.</p>
<p>Unity Web Player was a browser plugin that was supported in Windows and OS X only, which has been deprecated in favor of WebGL.</p>
<p>Unity is the engine used by Rust, Kerbal Space Program, and Cup Head.</p>
<h2 id="heading-more-info-on-unity">More info on Unity:</h2>
<ul>
<li><a target="_blank" href="https://www.freecodecamp.org/news/the-ultimate-beginners-guide-to-game-development-in-unity-f9bfe972c2b5/">Ultimate beginner's guide to game dev in Unity</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/how-to-create-a-2d-card-game-in-unity/">How to create a 2D game in Unity</a> (video)</li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/take-a-tour-of-unity-2d/">Take a tour of Unity 2D</a> (video)</li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/how-i-made-a-2d-prototype-in-different-game-engines/">Comparison of Unity and other game engines</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Best Game Engines for Video Game Development ]]>
                </title>
                <description>
                    <![CDATA[ In this article, we'll look at some of the most popular game engines for video game development. You'll get a brief overview of each engine so you can choose which to use for your project. Unity Probably the most popular engine, Unity, has its own ar... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/best-game-engines-for-video-game-development/</link>
                <guid isPermaLink="false">66c345864f7405e6476b0182</guid>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ toothbrush ]]>
                    </category>
                
                    <category>
                        <![CDATA[ unity ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 04 Feb 2020 19:49:00 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/5f9c9ccb740569d1a4ca343d.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>In this article, we'll look at some of the most popular game engines for video game development. You'll get a brief overview of each engine so you can choose which to use for your project.</p>
<h2 id="heading-unity">Unity</h2>
<p>Probably the most popular engine, Unity, has its own article <a target="_blank" href="https://guide.freecodecamp.org/game-development/unity/">here</a>. Check it out and learn all about its many features.</p>
<h2 id="heading-gamemaker-studio"><strong>GameMaker Studio</strong></h2>
<p>GameMaker Studio, previously known as GameMaker, is a cross-platform game development software primarily focused on creating 2d games using drag and drop action sequences or a scripting language known as Game Maker Language (GML).</p>
<h3 id="heading-overview"><strong>Overview:</strong></h3>
<p>GameMaker allows it’s users to create and prototype games quickly without the need to learn a programming language. GameMaker games usually consists of at least 3 things: sprites (images &amp; animations), objects (logic &amp; interactivity) and rooms (screens &amp; levels). Each game needs at least one room which is used for both menus and levels, and the transitioning between each.</p>
<p>GameMaker Studio 2 released on 2 November 2016.</p>
<h3 id="heading-supported-platforms"><strong>Supported Platforms:</strong></h3>
<ul>
<li>Microsoft Windows</li>
<li>macOS</li>
<li>Ubuntu</li>
<li>HTML5</li>
<li>Android</li>
<li>iOS</li>
<li>Amazon Fire TV</li>
<li>Android TV</li>
<li>Microsoft UWP</li>
<li>PlayStation 4</li>
<li>PlayStation Vita</li>
<li>Nintendo Switch (September 2018)</li>
</ul>
<p>PlayStation Portable and Raspberry Pi support was demonstrated but not released.</p>
<h3 id="heading-popular-games-made-with-gamemaker-studio"><strong>Popular games made with GameMaker Studio:</strong></h3>
<ul>
<li>Spelunky</li>
<li>Hotline Miami</li>
<li>Hyper Light Drifter</li>
<li>Crashlands</li>
<li>VA-11 Hall-A</li>
<li>Undertale</li>
<li>Nuclear Throne</li>
</ul>
<h2 id="heading-unreal-engine"><strong>Unreal Engine</strong></h2>
<p>Unreal Engine is a cross-platform game engine developed by Epic Games. The Unreal Engine was initially developed for the 1998 FPS title Unreal, but has been subsequently used for many thousands of commercial and non-commercial titles. The most recent version of the engine, Unreal Engine 4, targets PC, PlayStation 4, Xbox One, Mac OS X, iOS, Android, many VR systems, Linux, SteamOS, and HTML5, and the editor can run on Windows, OS X and Linux.</p>
<p>Uscript is the engine’s native scripting language, used for creating game code and gameplay events before the release of Unreal Engine 4, and was designed for high level programming. The script was written and programmed by Tim Sweeney, also the creator of another scripting language, ZZT-oop.</p>
<p>Since 2015 the Unreal Engine has been free to use, with Epic charging a 5% royalty on sales of titles produced using the engine. Epic make the majority of their codebase freely available via their Github, although source for closed platforms such as the Playstation 4 and Xbox One is only available for registered platform developers.</p>
<h3 id="heading-unreal-versions"><strong>Unreal Versions</strong></h3>
<p>Unreal has gone through 4 major revisions. Although some code is common between releases, each major version is a separate engine and projects cannot be moved between them. Within each major engine release, there are multiple minor versions.</p>
<ul>
<li>Unreal Engine 1 Released in 1998 and targeted Windows PC, Linux, Mac, PlayStation 2 and Dreamcast. The engine was written in C++, and easily moddable using the Unreal Script language.</li>
<li>Unreal Engine 2 Released in 2002 and targeted Windows PC, Linux, Mac, Playstation 2 and Xbox. The engine was written in C++, utilized the Unreal Script language.</li>
<li>Unreal Engine 3 Released in 2004 and targeted Windows PC, Linux, Mac, iOS, Playstation 3 and Xbox 360. Development is split between Unreal Script and C++, with an additional visual scripting interface called Kismet.</li>
<li>Unreal Engine 4 Released in 2015 and targets PC, PlayStation 4, Xbox One, Mac OS X, iOS, Android, many VR systems, Linux, SteamOS, and HTML5, and the editor can run on Windows, OS X and Linux. Unreal Script has been removed and replaced with dynamically reloaded C++ modules, and a more advanced visual scripting interface called Blueprints.</li>
</ul>
<h3 id="heading-popular-games-made-in-unreal"><strong>Popular Games made in Unreal</strong></h3>
<ul>
<li>Batman Arkham City</li>
<li>Mass Effect</li>
<li>Bioshock</li>
<li>Borderlands</li>
<li>Gears of War</li>
</ul>
<h2 id="heading-pygame"><strong>Pygame</strong></h2>
<h3 id="heading-game-development-with-pygame"><strong>Game Development with Pygame</strong></h3>
<p>Pygame is an open source, cross platform python library used for game development, written by Pete Shinners. The Pygame documentation and more information can be found on their website at <a target="_blank" href="https://pygame.org/">https://pygame.org</a>.</p>
<h3 id="heading-overview-1"><strong>Overview</strong></h3>
<p>The project started in the year 2000 as a result of the death of PySDL. The Pygame library version 1.0 was released after six months development in April of 2001.</p>
<h2 id="heading-libgdx"><strong>libGDX</strong></h2>
<p>libGDX is a free and open-source game-development application framework written in the Java programming language with some C and C++ components for performance dependent code.</p>
<h3 id="heading-overview-2"><strong>Overview</strong></h3>
<p>LibGDX supports both 2d and 3d game development, and is written in Java. In addition to Java, other JVM languages, such as Kotlin or Scala can be used to program libGDX games. At it’s core, libGDX uses LWJGL 3 to handle basic game functions such as graphics, input, and audio. LibGDX offers a large API to simplify game programming. LibGDX has an informative <a target="_blank" href="https://github.com/libgdx/libgdx/wiki">wiki</a> on it’s Github page, and there are many tutorials on the internet.</p>
<h2 id="heading-phaser"><strong>Phaser</strong></h2>
<p>Phaser is an open source framework for developing HTML5 games for desktop and mobile. You can read more about it on their website <a target="_blank" href="https://phaser.io/">here</a>.</p>
<h2 id="heading-minecraft-forge">Minecraft Forge</h2>
<p>If you've heard of Minecraft, chances are you've also heard of and used Forge. It allows you to mod your Minecraft game to make it do a bunch of cool stuff. Check it out in this article <a target="_blank" href="https://guide.freecodecamp.org/game-development/minecraft-forge/">here</a>.</p>
<h2 id="heading-something-a-little-different-terasology">Something a little different: Terasology</h2>
<p>An open-source voxel sandbox game!</p>
<p>The Terasology project was born from a Minecraft-inspired tech demo and is becoming a stable platform for various types of gameplay settings in a voxel world. The creators and maintainers are a diverse mix of software developers, designers, game testers, graphic artists, and musicians. We encourage others to join!</p>
<p>Source: <a target="_blank" href="http://terasology.org/">http://terasology.org/</a></p>
<p>Terasology is an open-source platform for gameplay of any kind in a voxel world. If you read that sentence attentively you can see I did not use the word ‘Game’. The reason behind that is the fact that Terasology itself is not a finished game! It’s merely a platform for you to modify yourself with your own code or pre-made modules. Do not worry though, there are loads of modules constantly developed by the multidisciplinary team.</p>
<h3 id="heading-the-open-source-spirit"><strong>The open-source spirit</strong></h3>
<p>Another really cool aspect of this game is fact that MovingBlocks (the organisation behind Terasology) participates in large events such as GCI (Google Code-In), GSOC (Google Summer of Code) and more! This makes the environment especially lively and it really empowers the community spirit. This is not some random product made by a greedy multinational, this is the work of a team. A team with a passion.</p>
<h3 id="heading-want-to-contribute"><strong>Want to contribute?</strong></h3>
<p>You too can contribute! Check out the repository here on GitHub and start hacking into the code! Make sure you format everything properly, use clear code and follow all of the repository-specific conventions! <a target="_blank" href="https://github.com/MovingBlocks/Terasology/wiki">https://github.com/MovingBlocks/Terasology/wiki</a></p>
<h2 id="heading-more-info-on-game-development">More info on Game Development:</h2>
<ul>
<li><a target="_blank" href="https://www.freecodecamp.org/news/what-is-game-development/">What is Game Development?</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/learn-unreal-engine-by-creating-three-games/">Learn Unreal Engine by coding 3 games (video)</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/the-ultimate-beginners-guide-to-game-development-in-unity-f9bfe972c2b5/">Ultimate beginner's guide to game dev in Unity</a></li>
<li><a target="_blank" href="https://www.freecodecamp.org/news/code-a-super-mario-brothers-game-to-learn-game-development/">Code a Super Mario Bros game to learn game dev (video)</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ An Embarrassing Tale: Why my server could only handle 10 players ]]>
                </title>
                <description>
                    <![CDATA[ By Jason Chitla What might be even more embarrassing is that at one point I had convinced myself that 10 players per server was normal. It all started with an idea at the beginning of the summer. I was standing in my room trying to think of an io gam... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/an-embarrassing-tale-why-my-server-could-only-handle-10-players-3b83b6fa8136/</link>
                <guid isPermaLink="false">66c343d9ccd54aa295e92c86</guid>
                
                    <category>
                        <![CDATA[ Game Preview ]]>
                    </category>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Games ]]>
                    </category>
                
                    <category>
                        <![CDATA[ indie game ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sun, 20 Aug 2017 20:17:06 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*HcpeaKYBaTboHEs654ICcQ.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Jason Chitla</p>
<p>What might be even more embarrassing is that at one point I had convinced myself that 10 players per server was normal.</p>
<p>It all started with an idea at the beginning of the summer. I was standing in my room trying to think of an io game to make (I decided if I were to make a game, I constrained myself to making an io game for maximum viral potential — that’s a thing, I swear).</p>
<p>So, I began analyzing what made certain io games (agar.io, slither.io, etc.) addictive. I was finding comparisons and similarities between such games, as seen in the picture below:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/rkAzNXqwIAcH2zfY9tDJ5G2rF1uc7T3G2nKb" alt="Image" width="800" height="284" loading="lazy">
<em>“Would Joey play it?” -&gt; Joey is my little brother in middle school. Writing this question on the board forced me to always make a decision with the end users (users of the Joey type) in mind. Smart huh.</em></p>
<p>Finally, after a little more brainstorming, I landed on <a target="_blank" href="http://knckout.io">knckout.io</a>. It’s the name of the game. Try to stay on the map, and knock others off. I loved it. Simple controls, clear objective, and a beautiful game mechanic.</p>
<p>After laying out how I wanted the game to look and feel, I got to work. I would come home from my summer internship everyday, work out, then code.</p>
<p>I first got the player to move how I wanted. Then I handled the boosting. Then the collisions. Finally the game was all done and ready to be tested out by the public. Or so I thought…</p>
<p>Last weekend (about a week ago), I was all amped and ready to show the world what I made. So I took to the interwebs and found a small subreddit called “playmygame.” I wrote up a short summary and <a target="_blank" href="https://www.reddit.com/r/playmygame/comments/6tr4o2/knckoutio/">posted</a> it (p.s. in the post’s comments you can clearly see I was stressing about the ability of my server). I waited patiently, then HUZZAH! A player had joined.</p>
<p>We were going back and forth at each other in the game. All the meanwhile, I was stressing and worried about what this player was thinking. After this player lost all their lives and was booted from the match we were in, I waited to see if they would come back. And they did! But even better: the player set their name to “ilikethisgame.” My eyes grew wide and I had a rush of adrenaline! I was the happiest boy in the world.</p>
<p>Soon other players joined and some left comments on the Reddit post. More players said they had enjoyed the game! I was ecstatic. Then I checked on how my server was holding up (on 8/15)…</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/QMRyiXB8dpEPTICQBm4PSy1w0kUrJfnJmai4" alt="Image" width="800" height="252" loading="lazy">
<em>From a 1 GB, 1 vCPU Digital Ocean NYC server running Ubuntu NodeJS 6.9.5 on 14.04</em></p>
<p>It felt like someone had knocked the wind out of me. Was this real? This had to be fake, I thought to myself. Just two games and the server is having a hard time processing them.</p>
<p>I started thinking about where I went wrong in my code. I thought collision detection, for sure, had to be the bottleneck. But I was already using quadtrees to help narrow down the number of collision detection passes.</p>
<p>I had to do some dirty work, so I spun up a new Digital Ocean server to use as my development server. I then temporarily disabled collision detection completely and saw the problem was still there.</p>
<p>OK — if collision detection was not the problem, then what else could it be?</p>
<p>I thought about how much information I was sending from the server to each client every second. I had this broadcast function that sent out the state of the game every 22 milliseconds to each client. In this function, I was unnecessarily filtering out the given client’s local player in an <code>allPlayers</code> property, just to put the local player in its own property. So, not only was I putting a for loop (the filtering) in another for loop (the broadcast for each client), I was also customizing the data to be sent out by this broadcast function for each client.</p>
<p>This customization was not necessary. I should just be able to send out the state of the game to everyone with no customization. Everyone should get the same data (and the data should not be tailored to a specific client). This had to be where the CPU is being eaten up. So I optimized this function, pushed it up to the dev server, and checked the CPU graph. No fix.</p>
<p>With my ignorance, I began to convince myself that ~10–20 players per 1 core server was good. Now, how do I come to such a conclusion? Well, my extreme confidence in my technical abilities was clearly blinding me from reality. I stumbled onto a <a target="_blank" href="https://news.ycombinator.com/item?id=13266692">post</a> where the creator of agar.io said his 1 core server can handle about 190 players. I quickly snapped out of it.</p>
<p>The next culprit I had lined up was: socket.io. I was using socket.io to manage the real-time communication between the client and the server. I had heard before that socket.io was not as lightweight as other alternatives.</p>
<p>Back in the day, if you wanted to send a message asynchronously, you had to implement some sort of hack: long polling or flash sockets. This was because not all web browsers supported websockets. But most browsers now offer native support. But in order for socket.io to establish a connection, it first does so by using one of the available hacks mentioned, and then upgrades the connection if the client supports a better way. Even though websockets are already widely supported. This approach comes at the expense of CPU and memory. But not as much as I had thought…</p>
<p>I hopped online and naively typed “socket io cpu problem” into Google. The first couple results were entitled “<a target="_blank" href="https://serverfault.com/questions/498707/how-to-debug-node-socket-io-cpu-issues">Node.js — How to debug Node + Socket.io CPU Issues — Server Fault</a>” and “<a target="_blank" href="https://stackoverflow.com/questions/8687434/socket-io-node-server-using-high-cpu?rq=1">Node.js — Socket.io node server using high cpu — Stack Overflow</a>.” My eyes lit up. I was reassured that this was the culprit to my problem. But I clicked on the first article and the author mentioned he was dealing with ~1,500 concurrent socket connections. I’m no math major, but 20 players is significantly less than 1,500 players.</p>
<p>Just for the heck of it, I switched my server-side Node app to use <a target="_blank" href="https://github.com/uNetworking/uWebSockets">tiny websockets</a>, then switched the client-side Node app to use native websocket support, right inside the browser. I pushed the changes up to the dev server, and checked the CPU graph. No fix.</p>
<p>My morale was at an all time low. I began to cringe every time I had to check the darn CPU graph. I thought I was never going to get that blue line to stop running away from me. This was the only time I ever felt completely incapable of handling some technical task. But then it happened…</p>
<p>I was sitting in front of the CPU graph wallowing in my misery when I noticed something. It didn’t matter how many full games were running or how close together they were all started. The CPU was increasing steadily at a constant rate. I had never stayed around long enough to observe this. Memory leak!</p>
<p>I scanned my code, line by line, looking for the bug (which I should have done at the very beginning). There it was.</p>
<p>In my game, an event is an object that captures info about things like player deaths, boosts, and collisions. So an event is created every time one of those things happens.</p>
<p>I have this loop that goes through each event and updates it. It’s called every 16 ms. After an event fulfills its duty, it’s supposed to be deleted. Keywords: “supposed to.”</p>
<p>Bingo. I had memory piling up as well as an increasing amount of unnecessary for-loop passes. I inserted a line of code and voila!</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/L8CFMJtioPQcWPBaK12MQcUO8ytlQIs3N1Rx" alt="Image" width="800" height="261" loading="lazy">
<em>well i’ll be</em></p>
<p>Huge sigh of relief.</p>
<p>My next task is to see just how many games (4 players per game) one server can now smoothly support. (I know its at least 12 games, but I haven’t tried more yet). Now that I know the number of events makes a huge impact on CPU… what will happen in production when all players are firing off boosting, collision, and death events every second? My tests have not accounted for that.</p>
<p>Also, after this post goes viral, and my game follows suit, I will need to quickly scale the number of servers available. I will make that the topic of a future post along with: “How <a target="_blank" href="http://knckout.io">knckout.io</a> grew to millions of players.” Follow me here for updates. :)</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Best Gitter channels for: Game Developers ]]>
                </title>
                <description>
                    <![CDATA[ By Gitter Today we have probably the most fun collection of Gitter communities — those for game developers. No matter if you’ve already spent hours developing and playing games, or if you are looking to get started; no matter if you are into indie fa... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/best-gitter-channels-for-game-developers-49ca45c92351/</link>
                <guid isPermaLink="false">66c345905ced6d98e4bd32a2</guid>
                
                    <category>
                        <![CDATA[ #Game Design ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Game Development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Mobile Game Development ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 22 Mar 2016 12:14:24 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*NEcmXRZYM4RIJgOYsSfmUg.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Gitter</p>
<p>Today we have probably the most fun collection of Gitter communities — those for game developers. No matter if you’ve already spent hours developing and playing games, or if you are looking to get started; no matter if you are into indie fantasy games or tic tac toe — you will find something for yourself. (Our team’s personal favourite is Particle Clicker — game teaching the history of high energy particle physics). Get lost in the open source world of gamers on Gitter, and be prepared to stay there for hours…</p>
<ul>
<li><a target="_blank" href="https://gitter.im/FreeCodeCamp/GameDev?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>FreeCodeCamp/GameDev</strong></a> <strong>—</strong> FreeCodeCamp’s chat about designing and developing video games.</li>
<li><a target="_blank" href="https://gitter.im/Cockatrice/Cockatrice"><strong>Cockatrice/Cockatrice</strong></a> <strong>—</strong> A cross-platform virtual tabletop for multiplayer card games.</li>
<li><a target="_blank" href="https://gitter.im/superpowers/dev?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>superpowers/dev</strong></a> <strong>—</strong> 2D+3D game making for indies. Free and open source.</li>
<li><a target="_blank" href="https://gitter.im/mono/MonoGame?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>MonoGame</strong></a> <strong>—</strong> One framework for creating powerful cross-platform games. The spiritual successor to XNA with 1000’s of titles shipped across desktop, mobile, and console platforms. <a target="_blank" href="http://www.monogame.net/">MonoGame</a> is a fully managed .NET open source game framework without any black boxes.</li>
<li><a target="_blank" href="https://gitter.im/GlowstoneMC/GlowstonePlusPlus?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>GlowstonePlusPlus</strong></a> <strong>—</strong> The enhanced Glowstone fork with an emphasis on performance, control and compatibility.</li>
<li><a target="_blank" href="https://gitter.im/PrismarineJS/flying-squid?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>flying-squid</strong></a> <strong>—</strong> A minecraft server written in node.js, modularized.</li>
<li><a target="_blank" href="https://gitter.im/craftyjs/Crafty?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>craftyjs/Crafty</strong></a> <strong>—</strong> JavaScript Game Engine.</li>
<li><a target="_blank" href="https://gitter.im/emadurandal/GLBoost?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>GLBoost</strong></a> <strong>—</strong> GLBoost is a new WebGL library for realtime 3D graphics geeks. It’s a low-level library that takes away the pain of having to deal with routine WebGL API tasks without limiting your expressive power.</li>
<li><a target="_blank" href="https://gitter.im/Planimeter/grid-sdk?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>Planimeter/grid-sdk</strong></a> <strong>—</strong> The Grid SDK — A 2D game engine built on LÖVE. Grid makes powerful concepts from 3D game engines accessible in a 2D game environment. It’s a lightweight and fast engine, and it provides many abstractions that you would otherwise need to write by hand for your projects or game jams.</li>
<li><a target="_blank" href="https://gitter.im/SiliconStudio/xenko?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>SiliconStudio/xenko</strong></a> <strong>—</strong> Xenko is a powerful cross-platform game engine.</li>
<li><a target="_blank" href="https://gitter.im/FreezingMoon/AncientBeast?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>FreezingMoon/AncientBeast</strong></a> <strong>—</strong> Ancient Beast is free and open source turn based strategy indie game project, being developed by <a target="_blank" href="http://www.freezingmoon.org/">Freezing Moon</a> and community. It uses web technologies such as HTML, PHP, JavaScript and Node.js, so that it’s playable from modern browsers without requiring plugins.</li>
<li><a target="_blank" href="https://gitter.im/Circular-Studios/Dash?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>Circular-Studios/Dash</strong></a> <strong>—</strong> A free and open 3D game engine written in D.</li>
<li><a target="_blank" href="https://gitter.im/JoelOtter/termloop?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>JoelOtter/termloop</strong></a> <strong>—</strong> Termloop is a pure Go game engine for the terminal, built on top of the excellent <a target="_blank" href="https://github.com/nsf/termbox-go">Termbox</a>. It provides a simple render loop for building games in the terminal, and is focused on making terminal game development as easy and as fun as possible.</li>
<li><a target="_blank" href="https://gitter.im/ebkalderon/amethyst?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>ebkalderon/amethyst</strong></a> <strong>—</strong> Amethyst aims to be a fast, data-oriented, and data-driven game engine suitable for rapid prototyping and iteration. It also tries to push the <a target="_blank" href="https://www.rust-lang.org/">Rust programming language</a> to its limits, driving further improvement and hopefully attracting more game developers toward the young and vibrant Rust ecosystem.</li>
<li><a target="_blank" href="https://gitter.im/orx/orx?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>orx/orx</strong></a> <strong>—</strong> Orx is a 2D-oriented, data-driven, portable game engine focused primarily on ease of use and powerful features.</li>
<li><a target="_blank" href="https://gitter.im/PrismarineJS/prismarine-server?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>PrismarineJS/prismarine-server</strong></a> <strong>—</strong> NodeJS Game Server compatible with Minecraft Client.</li>
<li><a target="_blank" href="https://gitter.im/Curvytron/curvytron?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>Curvytron/curvytron</strong></a> <strong>—</strong> A web multiplayer Tron game like with curves.</li>
<li><a target="_blank" href="https://gitter.im/yeahrb/yeah?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>yeahrb/yeah</strong></a> <strong>—</strong> Practical Ruby video game framework.</li>
<li><a target="_blank" href="https://gitter.im/particle-clicker/particle-clicker?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>Particle-clicker</strong></a> — An addictive incremental game that teaches players the history of high energy particle physics</li>
<li><a target="_blank" href="https://gitter.im/moorepants/ieee-tic-tac-toe?utm_source=blog&amp;utm_medium=content&amp;utm_campaign=gamedev"><strong>ieee-tic-tac-toe</strong></a> <strong>—</strong> The CSU IEEE TIC-TAC-TOE game.</li>
</ul>
<p>Looking for something else? Check out our <a target="_blank" href="https://gitter.im/explore/tags/javascript,php,ruby">Explore</a> section or easily <a target="_blank" href="https://gitter.im/home#createroom">start your own channel here.</a></p>
<p>Did we miss an channel that you think should be featured? Drop us a line in the <a target="_blank" href="https://gitter.im/gitterHQ/gitter">Gitter HQ</a> and we will add it to the list.</p>
<p>Happy gaming!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
