<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bruno Guedes on Medium]]></title>
        <description><![CDATA[Stories by Bruno Guedes on Medium]]></description>
        <link>https://medium.com/@brazmogu?source=rss-13c1d2baffe2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Z6Q9xM3mCbIhqL_zOaYsjQ.jpeg</url>
            <title>Stories by Bruno Guedes on Medium</title>
            <link>https://medium.com/@brazmogu?source=rss-13c1d2baffe2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 08:15:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brazmogu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Physics for Game Dev — A Platformer Physics Cheatsheet]]></title>
            <link>https://medium.com/@brazmogu/physics-for-game-dev-a-platformer-physics-cheatsheet-f34b09064558?source=rss-13c1d2baffe2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f34b09064558</guid>
            <category><![CDATA[game-programming]]></category>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[platformer]]></category>
            <dc:creator><![CDATA[Bruno Guedes]]></dc:creator>
            <pubDate>Wed, 06 Nov 2019 14:53:36 GMT</pubDate>
            <atom:updated>2019-11-06T14:53:36.037Z</atom:updated>
            <content:encoded><![CDATA[<h3>Physics for Game Dev — A Platformer Physics Cheatsheet</h3><h3>A Prelude</h3><p>Hello, everyone. You might know me from other such hit articles such as <a href="https://medium.com/@brazmogu/your-first-godot-game-a-live-tutorial-2a0423243f0e">my tutorial on making a Godot game</a> and… that&#39;s about it so far. See, this is why I&#39;m making this, because I&#39;ve figured that, as far as sidegigs go, I can write tutorials and educational articles a lot better than I can make assets or art commissions, although I&#39;d love to. One has to play to their strengths, I suppose.</p><p>So, this is another article on my way to figuring my own pace and style, and maybe even becoming kind of pro at this. I like the idea of teaching, and especially teaching game development. Nowadays is so much easier than it was when I wanted to learn about it, but still it&#39;s good to contribute to the effort. So, if you&#39;re here making valuable use of my knowledge… I&#39;m very glad. Enjoy yourself!</p><p>All that said, let’s begin. Today’s lecture is going to be about… Physics!</p><h3>Principles of Platforming Physics</h3><p>Platformers are, essentially, all about jumping. Jumping is basically a parable, specifically one that curves downward, with vertical velocity starting up and gradually being pulled down again until the character hits the ground. In other words…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*F8hRSZLTF8D3-Rg3GQosPg.png" /><figcaption>All graphics cooked up in Wolfram Alpha</figcaption></figure><p>In generic terms, a downward parable can be defined by a second degree equation, as such:</p><p><strong><em>f(x)</em></strong><em> = ax² + bx + c</em></p><p>With the only limitation being that the value of <em>a</em> must be negative; if it’s positive, your curve will point upwards, and if it’s zero, then you have a straight line instead of a curve. Being more specific, even, all of these values actually have a specific meaning:</p><ul><li><em>f(x)</em> is the vertical position, relative to the ground</li><li><em>x</em>, a bit confusingly, is the time since the start of the jump</li><li><em>a</em> relates to gravity (it&#39;s negative, because it points downwards)</li><li><em>b</em> relates to velocity, or more specifically, the initial jump velocity (it&#39;s positive, because it points upwards)</li></ul><p>So, if we&#39;re to rewrite this equation to seem more familiar, you can say that the jump is described as:</p><p><em>y = -0.5gt² + v&#39;t</em></p><p>From this one equation we can derive a lot of others, although those of you with some cursory knowledge of Basic Mechanics might argue it&#39;s the opposite¹. It doesn&#39;t matter much. Let&#39;s get to the math!</p><h4>Gravity</h4><p>Ok, before we get to the math, let&#39;s discuss this parameter. The gravity in a platformer game pulls downward, much like it does in the real world². While the value of gravity will influence the movement, in reality we&#39;ll be working in a way that it won&#39;t. But it will.</p><p>Sorry, that got confusing. The role of gravity in the design of platforming movement is that the larger gravity is, the quicker the jump will be. That will have the effect of making the curve of the parable wider or narrower. A little bit ahead we&#39;ll see that we can determine the height of the jump independent of the gravity itself, so what will happen is that changing gravity while keeping the same jump velocity will make the jump shorter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*tH43XXMukNwGhDvo4kotag.png" /><figcaption>Gravity varying through 0.5, 1 and 2, same jump speed</figcaption></figure><p>Meanwhile, if you maintain the jump height (by varying the jump speed accordingly), you&#39;ll end up with a jump that&#39;s more… &quot;floaty&quot; the smaller the gravity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*gTE8PEFkL4cK4h_udWxqlA.png" /><figcaption>gravity varying through 0.5, 1 and 2, same jump height</figcaption></figure><p>As for how to maintain the same height for varying values of gravity, well…</p><h4>Jump Height (and Velocity)</h4><p>Knowing how high your character can jump is a very important point of design in platforming games, for reasons that should be obvious. You can determine that by experimenting with gravity and jump speed, yes, but you can also use math to just figure out whatever your jump speed needs to be for your character to go exactly as high as you want them to.</p><p>For that, we&#39;ll take two equations, namely:</p><ul><li>The equation of vertical position by time, i.e. <em>y = 0.5gt² + v&#39;t</em></li><li>The equation of vertical speed by time, i.e. <em>v = v&#39;+ gt</em></li></ul><p>Remembering, of course, that gravity is negative. So, we need to figure out at what time the character is at the highest point given whatever value of gravity, and that can be easily determined if you remember how vertical velocity works on a jump: the character starts moving up, velocity is gradually reduced by gravity and then becomes 0, until it starts pointing down and increasing again, and the character moves downward. <em>Ergo</em>, we need to figure out at what time <em>v = 0</em>. Using the second equation, we have that…</p><p><em>v = v&#39; + gt = 0</em>, thus <em>gt = -v&#39;</em> and finally³ <em>t = -v&#39;/g</em></p><p>Applying that enigmatic time signature into the first equation will give us the height of the character when velocity is 0, i.e., the highest it&#39;ll ever be. So, given a value <em>g </em>of gravity, our character will jump <em>H</em> units if the initial velocity <em>v&#39;</em> is…</p><p><em>H = 0.5gt² + v&#39;t = 0.5g(-v&#39;/g)² + v&#39;(v&#39;/g) = -0.5v&#39;²/g + v&#39;²/g = 0.5v&#39;²/g</em></p><p>Thus, <em>v&#39;² = 2Hg</em> which means that the initial velocity for the character to jump <em>H</em> high is the square root of <em>2 * H * g.</em></p><h4>Jump Time (and Distance)</h4><p>Next up, you’ll want to know how far the character goes when they jump. The trick to this is that what you want to determine here is the jump time, and to affect the jump time while keeping the same jump height is… gravity.</p><p>So, back to tweaking gravity, we&#39;ll want to change gravity in order to match a certain given air time. We start by picking that value of jump velocity that we found in the previous section and putting it right back in the equation that told us the time to reach the peak of the jump. That is…</p><p><em>t = -v&#39;/g =&gt; t² = -2Hg/g² = -2H/g</em></p><p>So, given we want the time of the jump to be twice the time it takes to reach the topmost part of it <em>t&#39;</em>, we have…</p><p><em>t² = (2t&#39;)² = 4t&#39;² = -2H/g =&gt; g = -2H/4t² = H/2t²</em></p><p>And with this, you can determine the basic constant of platforming movement (gravity) given whatever height and duration of jump, creating a customizable physics component that can be easily tweaked without the need of complicated calculations just to find the right basic parameters.</p><h3>TL;DR (or: Recap)</h3><p>So, to recap all we&#39;ve been through, or in case you&#39;re just here to copy these basic equations to use in your game⁴:</p><p>Given a chosen height of jump <em>H </em>and duration <em>t</em>, the parameters of your physics system should be:</p><p><strong><em>gravity</em></strong><em> = H/2t²</em></p><p><strong><em>jump speed</em></strong><em> = sqrt(2Hg)</em></p><p>This is not <em>all </em>that goes into a platformer, mind you… but dealing with friction, terminal velocity and other concepts are significantly more trivial, and then I can write a new tutorial only to discuss those concepts. :V</p><p>Anyway, this has been an educational article on gamedev things. May you have learned something useful, leave your questions if you have any and let&#39;s hope to meet again, in the near future. o/</p><p>¹ Technically speaking, you derive the velocity equation from the gravity, and the position equation from the velocity by means of integration.</p><p>² Again, to be pedantic, it pulls into the center of mass of the largest body around which in our case is the Earth. It would be more accurate to say that “down” is defined as wherever gravity pulls towards.</p><p>³ This is as a good time as any to remember that g is negative relative to the jump velocity, and thus <em>-v’/g</em> will be positive, as expected of jump time.</p><p>⁴ No judging, I’m sure I myself will refer back to this about any time I need to find these again in a platforming physics game :P</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f34b09064558" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your First Godot Game: a Live Tutorial]]></title>
            <link>https://medium.com/@brazmogu/your-first-godot-game-a-live-tutorial-2a0423243f0e?source=rss-13c1d2baffe2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a0423243f0e</guid>
            <category><![CDATA[godot]]></category>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[first-game]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[game-programming]]></category>
            <dc:creator><![CDATA[Bruno Guedes]]></dc:creator>
            <pubDate>Wed, 13 Mar 2019 14:34:55 GMT</pubDate>
            <atom:updated>2019-03-13T14:34:55.611Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>This is a “live” tutorial in the sense that I’m doing it as I write. The intention is to try and follow the development process as it feels, and detect possible points of difficulty and lack of clarity. Also, to not forget to document it as I go.</p><p>Some things are done in advance, though. The basic index of this piece, for example, and the assets. All else is basically improvised and condensed into a coherent and informative summary of what I’m doing, and the final result shall be very similar to what I also have produced. This should be nice.</p><p>So, you’ve decided to learn <a href="https://godotengine.org/">Godot</a>! That’s wonderful! It’s a very cool engine with opensource code and supports every major OS marvelously (which means it has the best parts of both Unreal and Unity; it’s <em>unreal</em>!), but I don’t think I need to call upon the technical and philosophical marvels of the engine to justify the urge to learn to use it. The simple act of learning a new engine is stimulating and enriching enough! Excellent! Now where to start from?</p><p>Well, from my own experience, when I decided to learn Unity, I did so in a very simple manner: by challenging myself to make <a href="http://www.onegameamonth.com/">one game per month</a> in Unity! In a similar manner, when I decided to learn <a href="https://love2d.org/">LÖVE2D</a> (and, by extension, Lua itself), I challenged myself in a similar manner (but only managed to get 4 games done before I had to let go of the tight schedule).</p><p>The point is: you learn programming by making programs. You can do all the preliminary reading and studying you wish, but you’ll probably only really learn and commit to it when you get doing it. So this tutorial has this very simple goal: to learn Godot by making a game in it.</p><p>Here are a few things this tutorial will do:</p><ul><li>Teach Godot by making, step by step, a full game</li><li>Show, by example, some useful Godot concepts and design philosophies</li><li>Give you a sense of accomplishment for having made a game</li></ul><p>Here are some things this tutorial won’t do:</p><ul><li>Teach advanced concepts of Godot</li><li>End with a polished product ready to be sold as a new <em>Triple-I</em> masterpiece</li></ul><p>Expectations curbed? Good. Let’s begin learning!</p><h3>Game Design</h3><p>First of all, let’s have guidelines. This is important because for two reasons:</p><ol><li>it’ll give us a clear idea of when the game is <em>done</em>.</li><li>it’ll stop us from adding features and never <em>finishing</em> the game.</li></ol><p>Nothing fancy, nothing too structured.</p><h4>The Pitch</h4><p>The final delivery of this project will be… Pong, but one-player. Which means it’s “Squash Pong”.</p><h4>Features</h4><ul><li>The game happens on a 16:9 window</li><li>The player controls a paddle that goes up and down on the screen</li><li>A ball travels uniformly, bouncing off the top and bottom walls, the right wall and the player</li><li>Each time the ball hits the player, one point is added to the score</li><li>When the ball hits the left wall, it disappears and the score is reset</li><li>A high score holder keeps track of the maximum score the player has achieved without letting the ball pass through the left wall</li><li>When the ball hits the player or the top and bottom walls, it bounces normally.</li><li>When the ball hits the right wall, it increases in speed.</li><li>Pressing the ESC key quits the game</li></ul><p>There we go. There are some requisites that could be added to this list, but they either were left out to keep the scope manageable, or we’re going to come back to them later on. Be patient.</p><p>With this list of goals to attend, we can start working with purpose. Let’s get started!</p><h3>Starting the Project</h3><p>…in the very beginning. Open Godot, and you will be greeted with a window like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZVCDOhvpHNBQTZbMnvOV_A.png" /></figure><p>Nevermind the fact that I have <em>a few</em> unfinished projects going on. Click the <em>New Project </em>button there and let’s set up the project somewhere. I’m calling mine “ProtoPong”. :V</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/0*SnIHLK8BsozpXxOU" /></figure><p>Now that we’re in the Editor, you’ll want to set Godot to 2D mode. This will make things so much easier, trust me.</p><h3>Setting up the Canvas</h3><p>One thing we can take care of right now is the size of our screen. Go into the <em>Project</em> menu, click <em>Project Settings</em> and find the <em>Display &gt; Window </em>category. The first properties we’ll edit are Width and Height. To create a space that adheres to our ideal of 16:9 aspect, let’s make it 640 by 360.</p><p>And now, believe it or not, we can <em>test</em> it! Click the play button on the top right corner and… surprise! It wants you to save this scene so you can set it as your starting scene! Call it whatever (<em>Game.tscn</em> is a good name) and now you have… this magnificent expanse of gray!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*gCk6r553UqUaedCzw94w_A.png" /><figcaption>Oh, hi there!</figcaption></figure><p>Close it when you start to feel overwhelmed by all the <em>nothing</em> going on and let’s move on!</p><h3>Building the Scene</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*FF7A4tVYY1aLJJ8SOI43IA.png" /><figcaption>The Scene tab (and one pesky tooltip)</figcaption></figure><p>Now you have the Scene Editor open and it’s time to make a scene! And here’s a cool thing about Godot: it’s all about <em>nodes</em>. It gives you a blank scene and you first start by clicking the + button right there on the right (presumably), in the <em>Scene</em> tab. That’ll open the <em>Create New Node </em>dialog, with loads of options of node types to be created. We’ll just pick the “Node” type, and… now we have a node! Fantastic.</p><p>This will be the root node of our tree, and so we’ll call it “Root”. Rename it by double-clicking it and changing its name, and that’s done!</p><p><strong><em>NOTE: </em></strong><em>I’m not sure if this changed recently or if I just imagined it, but I was quite sure that Godot required at least one root node in a scene to run it. Apparently now it’ll create a root automatically on run, so you wouldn’t need this Root… but we’ll actually use it later on, so hang on to it!</em></p><p>We’ll go ahead and create the rest of the scene, which will be composed of the paddle and the ball</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/239/1*z2BMWtMPidGzlSwIjYaC1Q.png" /><figcaption>The Final (for now) Scene</figcaption></figure><p>In the end, you’ll have the scene you see at the side, and I’ll describe each node so you can add and configure them properly.</p><ul><li><strong>Root:</strong> The root of the scene. Every scene in Godot needs a root, which is where everything else is anchored, so we need this. It’s a common Node, because we just need it as a starting point (and a place to attach some of our game logic, as we’ll see…)</li><li><strong>Paddle:</strong> The paddle, i.e., the player. It’s a Node2D, i.e., a Node in 2D space, because we’re actually going to see and move it in the screen. Set its transform position to (120, 180), a suitable location near the middle left.</li><li><strong>PaddleShape: </strong>Could be a sprite, but for our purposes we’ll make this a simple vector shape. It’s specifically a Polygon2D node, and you can alter it’s Polygon (an array of points) to have 4 points, (8, 64), (8, -64), (-8, -64), (-8, 64), i.e. a rectangle of size 16x128.</li><li><strong>Ball:</strong> The ball. It’s the thing we’ll bounce around. Also a Node2D.</li><li><strong>BallShape:</strong> Again, the graphical shape of the ball. It is also a Polygon2D, and it has points (4, 4), (4, -4), (-4, -4), (-4, 4). A square of size 8.</li></ul><p><strong><em>NOTE:</em></strong><em> Yes, the ball is a square. Try as I might, I couldn’t find a good way to draw a circle right away in Godot, and I didn’t think we’d get much mileage out of having an actual sprite. A square will also be a better abstraction once we get to the game logic, and even give our game a retro feel! :V</em></p><h3>“Get the Ball Running”: an intro to GDScript</h3><p>If you run the game, you’ll see… a rectangle and a square.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*ZwTI1ReYXSCSCvYNWJRUrQ.png" /><figcaption>The thrills!</figcaption></figure><p>And they do a total of zero things, if you don’t count the draw calls being made. Certainly not quite what we want, right? The thing we’re lacking here, you see, is <em>behavior.</em></p><p>In Godot, we can assign scripts to a node, and said script will add behavior to that node. So what we’ll do now is create a few scripts… well, one script, that will add some behavior to our ball. Namely:</p><ul><li>It’ll start with a given speed;</li><li>It’ll bounce on the top, bottom and right walls;</li><li>It’ll vanish beyond the left wall</li></ul><p>Select the <em>Ball</em> node and click the button to add a script, on the top right of the Scene tab (right to the right of the <em>Filter Nodes </em>search box). It’ll open a dialog to create a new script. You can leave the options as they are, and create <em>Ball.gd</em>.</p><p>Copy the following text, either by typing or copy-pasting it, into the editor that has now appeared (if you copy-paste it, remember to paste it over the text that’s there already).</p><pre># Base Class for this script; in this case the same as the node you&#39;re attaching it to<br>extends Node2D</pre><pre># Class variables go here</pre><pre># &#39;export&#39; makes the variable visible in the Inspector for that node, so it can be configured in the editor<br># It also allows the variable to have an expected type and other stuff (check the docs!)</pre><pre># Starting Speed of the ball<br>export(int) var startingSpeed = 64</pre><pre># Horizontal Speed of the Ball<br>var hspeed<br># Vertical Speed of the Ball<br>var vspeed</pre><pre># Called when the object is introduced in the scene, or at the start of the scene<br>func _ready():<br>    # start with a random angle between 30 and 60<br>    randomize()<br>    # get the random starting angle... in radians!<br>    var startingAngle = deg2rad(rand_range(30, 60))<br>    self.hspeed = cos(startingAngle) * startingSpeed<br>    self.vspeed = sin(startingAngle) * startingSpeed</pre><pre># Called at every update step, has the amount of time passed until the last update (delta)<br>func _process(delta):<br>    # Move itself based on its speed components<br>    self.translate(Vector2(delta * hspeed, delta * vspeed))<br>    <br>    # Check collision with the game walls<br>    if self.position.y &lt;= 4:<br>        self.bounce_vertically()<br>    elif self.position.y &gt;= 360 - 4:<br>        self.bounce_vertically()<br>    elif self.position.x &gt;= 640 - 4:<br>        self.bounce_horizontally()<br>    <br># Bouncing functions<br>func bounce_vertically():<br>    self.vspeed = -self.vspeed</pre><pre>func bounce_horizontally():<br>    self.hspeed = -self.hspeed</pre><p>With this code attached to the Ball, you should have it moving diagonally, bouncing off the walls and then disappearing off the left. Great!</p><p>Great? Well, not great. But good.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fglitteringimpoliteleech&amp;url=https%3A%2F%2Fgfycat.com%2Fglitteringimpoliteleech&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FGlitteringImpoliteLeech-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="640" height="360" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cbcbec1e93ef41aea5cdc3298966770/href">https://medium.com/media/2cbcbec1e93ef41aea5cdc3298966770/href</a></iframe><h3>Setting Up Input</h3><p>One thing you might have noticed is that our paddle can’t move. Another you may have noticed is that, in fact, there’s no way to make it move! For that, we’ll set up inputs for Godot to accept! Let’s go into the <em>Project Settings</em> window and to the <em>Input Map.</em></p><p>(There are, in fact, lots of inputs set up by default in Godot, but we’ll set our own up for educational reasons.)</p><p>We’ll add two actions named “paddle_up” and “paddle_down”. Using the + button to the right of the tabs named after them, you can add a key to be bound to it. Or more than one, just for fun.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*W_ik4hAvTKnoNbcPaTxf8g.png" /><figcaption>Pictured: Fun(?)</figcaption></figure><p>Now we’re going to add a script to incorporate behavior to our paddle. We can call it <em>Paddle.gd</em>:</p><pre>extends Node2D</pre><pre># Speed of the paddle, in pixels per second<br>export(int) var paddleSpeed = 64</pre><pre># Current vertical speed of the paddle<br>var vspeed = 0</pre><pre># Called at every update step, has the amount of time passed until the last update (delta)<br>func _process(delta):<br>    self.position.y += delta * vspeed<br>    <br>    # Correct position if paddle is out of bounds<br>    if self.position.y &lt; 64:<br>        self.position.y = 64<br>    if self.position.y &gt; 360 - 64:<br>        self.position.y = 360 - 64</pre><pre># Called on every input event, including key presses and releases<br>func _input(event):<br>    # Check event for up key<br>    if event.is_action_pressed(&quot;paddle_up&quot;):<br>        self.vspeed = -paddleSpeed<br>    if event.is_action_released(&quot;paddle_up&quot;):<br>        self.vspeed = 0<br>    <br>    if event.is_action_pressed(&quot;paddle_down&quot;):<br>        self.vspeed = paddleSpeed<br>    if event.is_action_released(&quot;paddle_down&quot;):<br>        self.vspeed = 0</pre><p>And now you have it: when you press up, the paddle goes up! When you press down, down it goes! It has some weird behavior when you press them both at once and release, but that’s not important. The important thing is that the ball passes right through the paddle, and we’re going to work on it right away.</p><h3>Collision checks</h3><p>If you have some experience with programming, you might have realized one thing about all this code: it’s kind of messy with magic numbers and undocumented constants. That’s because we’re checking for the boundaries manually, while we could be using the engine to our advantage. Doing that with collisions will also add some interesting design decisions to be made.</p><p>So, what we’ll be adding to the game is a set of colliders, to cover the cases of interaction we’ll need to deal with:</p><ul><li>The ball bouncing on walls (top, bottom, right)</li><li>The ball bouncing on the paddle</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*xc-vDcXTTW10ukBP7Ylu7w.png" /></figure><p>I’m not going to go into the specifics of Godot’s collision system (especially because I don’t really know it that much), so in summary, what we want her are three static colliders for the walls and two kinematic bodies for the ball and paddle. We’ll have to add more nodes to the root for the static ones and change the Ball and Paddle nodes to be KinematicBody2D nodes (using the <em>Change Type</em> option in their right-click context menu) and add child nodes to define their collision shapes. In the end, your tree should look like the one you can see to the left.</p><p>The Bottom and the Top wall should be almost the same, with the collision box defined as a Rectangle with extents (320, 1), the TopWall node set with transform at (320, 0) and the BottomWall at (320, 360). The RightWall node will have the collision shape set as a Rectangle with extents (1, 180), and its transform will be positioned at (640, 180).</p><p>The Ball and Paddle colliders will have extents (4, 4) and (8, 64), filling their shapes respectively.</p><p><strong><em>NOTE:</em></strong><em> Watch out if you decide to copy-paste the nodes that are the same. Godot WILL copy the reference to the shape inside them, and changing it will also change the same reference in other nodes. You can click the down arrow in the Shape definition and use the </em>Make Unique <em>option to create a copy of the shape so you can change independently.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*JOnfrzamo7Qe7UIp0MDUyQ.png" /><figcaption>As you can see here</figcaption></figure><p>Another thing we’ll do is set up the collision layers, which is what tells Godot how to handle collisions and what collides with what. Basically, what we want is to have layers for the ball, the paddle and the walls, and set it all up so the ball collides with the walls and the paddle, and the paddle also collides with the walls. Go to <em>Project Settings</em> &gt; <em>Layer Names</em> &gt; <em>2d Physics</em> and let’s set up the physics layers as such:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*-v5Zwwmadqj34DgLKZZBEw.png" /></figure><p>And set up the physics objects (KinematicBody and StaticBody) of each object to match their respective values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*shyrPPguH-5J8_HTtpjEtg.png" /><figcaption>Layer configuration for Paddle</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/1*KOliF4inGFZfs8CZ5Vf7PA.png" /><figcaption>Mask configuration for Paddle</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*RkFTljTSG0LvAlmF56nQzQ.png" /><figcaption>Layer Configuration for Ball</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*6yc3hPWH_aM9xYefm6S5Dg.png" /><figcaption>Mask configuration for Ball</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*NWwiZO3z0-tQD38xNSlpPA.png" /><figcaption>Layer configuration for the walls</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*LPX3400_4dQjTqxjmy5OSw.png" /><figcaption>Mask configuration for the walls</figcaption></figure><p><strong><em>NOTE: </em></strong><em>Once again you might have noticed something quite peculiar about this setup: every layer collides with every other layer! We wouldn’t even need to set up layers in this case, as everything would just collide normally. It’s a good exercise, though.</em></p><p>Those were some tedious images, I know. I’m sorry. Now, to the fun part! First we’re going to change the _process method on the Ball and Paddle scripts, so they’ll move using the move_and_collide function instead of just moving. Then we’ll handle the <em>KinematicCollision2D </em>objects that come out of the <em>move_and_collide </em>function in case a collision did happen, so the objects will behave accordingly.</p><p><strong><em>NOTE: </em></strong><em>From now on, the code I’m presenting will be replacing or adding to the code already implemented, unless it’s a new file that wasn’t created at. The editor should tell you if you redefine existing functions, but still be careful to replace the correct ones.</em></p><p>For <em>Ball.gd</em>:</p><pre># Called at every update step, has the amount of time passed until the last update (delta)<br>func _process(delta):<br>    # Move itself based on its speed components<br>    var collision = self.move_and_collide(delta * Vector2(hspeed, vspeed))<br>    <br>    # Deal with the collision if it happens<br>    if collision:<br>        self.handle_collision(collision)<br>    <br># Handle collision<br>func handle_collision(collision):<br>    # If normal is horizontal, the wall is vertical<br>    if collision.normal.x != 0:<br>        self.hspeed = -self.hspeed<br>        <br>    # If normal is vertical, the wall is horizontal<br>    if collision.normal.y != 0:<br>        self.vspeed = -self.vspeed</pre><p>For <em>Paddle.gd</em>:</p><pre># Called at every update step, has the amount of time passed until the last update (delta)<br>func _process(delta):<br>    # Just move and stop if hit a wall, no need to deal with the collision at all<br>    self.move_and_collide(delta * Vector2(0, vspeed))</pre><p>A quick play shows that this code <em>works</em>. The ball’s code does the job of bouncing around, and the paddle is stopped by the Physics engine itself upon hitting the walls. There’s just one more thing we’ll want to do, and it has to do with one acceptance criterion: “<em>When the ball hits the right wall, it increases in speed.</em>”</p><p>There are different ways of doing this, but one that I <em>want </em>to implement is to define the walls in such a way that they can hold information. To be precise, they’ll have an elasticity coefficient so that when the ball hits, it may bounce back with different momentum.</p><p>Let’s create a new scrip in the Editor, and call it <em>ElasticWall.gd</em>. It’ll be a StaticBody2D, and it’ll be as such:</p><pre>extends StaticBody2D</pre><pre># Elastic coefficient<br>export(float) var elasticity = 1.0</pre><pre># Colliding with this causes the ball to bounce horizontally?<br>export(bool) var horizontalCollision<br># Colliding with this causes the ball to bounce vertically?<br>export(bool) var verticalCollision</pre><p>If it seems odd that this script has no functions, don’t worry: it means it doesn’t add behavior to the node. It only adds data, and data is what we’ll use.</p><p>Now attach the script to all the Wall nodes in the tree, either by using the Script property in the Inspector, or dragging the script onto the node.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Ftanorderlybigmouthbass&amp;url=https%3A%2F%2Fgfycat.com%2Ftanorderlybigmouthbass&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FTanOrderlyBigmouthbass-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="1920" height="1056" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a49fc9f95d5b5e298120f1cd6029e91/href">https://medium.com/media/7a49fc9f95d5b5e298120f1cd6029e91/href</a></iframe><p>And now all of the Wall nodes will have a few extra properties to be tweaked in the Inspector!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/1*DnZgcvgErib9iNtYj1PTAA.png" /><figcaption>Exquisite!</figcaption></figure><p>So we’ll check the <em>Vertical Collision</em> box for the Top and Bottom walls and the <em>Horizontal Collision </em>box for the Right Wall, as well as set the <em>Elasticity</em> property to <em>1.25</em>.</p><p>And, finally, we’ll change the Ball script to take advantage of this data:</p><pre># Load the ElasticWall class<br>const ElasticWall = preload(&quot;ElasticWall.gd&quot;)</pre><pre># Handle collision<br>func handle_collision(collision):<br>    if collision.collider is ElasticWall:<br>        if collision.collider.horizontalCollision:<br>            self.hspeed = -self.hspeed<br>        if collision.collider.verticalCollision:<br>            self.vspeed = -self.vspeed<br>            <br>        # Multiply speed by the elasticity coefficient<br>        self.hspeed *= collision.collider.elasticity<br>        self.vspeed *= collision.collider.elasticity<br>    else: # Then it&#39;s the paddle<br>        # Only reflect if colliding with the paddle horizontally<br>        if collision.normal.x != 0:<br>            self.hspeed = -self.hspeed</pre><p>In summary, we’re telling the ball that, upon collision, it should check if what it’s colliding with is an instance of ElasticWall and, if it is so, to use the data from that script to bounce (and build up in speed if it’s the right wall). Otherwise, we know it was the paddle and we don’t want to ball to reflect from it unless hitting on the right side, so we only deal with that case.</p><p>We’re almost done. Well, <em>almost </em>almost. There are a few things to do…</p><h3>Tally up the score</h3><p>Right, we were supposed to be keeping scores! Let’s set up the stage, so to speak. Namely, let’s set up a UI.</p><p><strong><em>NOTE: </em></strong><em>This is the part where I admit that I have never used Godot’s UI creation before and to be honest it baffled me. It doesn’t quite work like the Unity UI creation, and it seems that I’d need to study it better to make an elaborate HUD. that’s why what we’re making here is very, very basic.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/215/1*OQ9wPWVNKIVgC8q5AkhAFA.png" /></figure><p>Our UI is basically just a container with the Score panel which contains both the current score and the highest score. It’s not an elaborate UI, so we aren’t going to design it a lot. The one thing that I would advise is to select the Score Container node and use the Layout menu to set it up on Top Wide. Set the bottom margin to 32 and then the Score label will probably center itself nicely. Setting the minimum size of the label to (32, 16) also will probably help.</p><p>Now, for scripts, we’ll have three things: two new scripts and one change in an existing one. First thing we’ll do is add a script to the Root. It’s what I like to call a “controller”, a script without a real presence in the game world.</p><pre>extends Node</pre><pre>var score = 0<br>var highestScore = 10</pre><pre>func _ready():<br>    pass</pre><pre># Start of a new game<br>func reset():<br>    score = 0</pre><pre># Update the score<br>func addScore():<br>    score += 1<br>    if score &gt; highestScore:<br>        highestScore = score</pre><pre># Returns the score formatted for our UI holder<br>func getScore():<br>    return &quot;%04d / %04d&quot; % [self.score, self.highestScore]</pre><p>Next is the Score label’s script, which serves to update its contents. It’s pretty simple:</p><pre>extends Label</pre><pre># This variable will contain the root node<br>onready var root = get_node(&quot;../..&quot;)</pre><pre>func _process(delta):<br>    self.text = root.getScore()</pre><p>And, finally, one change to the Ball node. We’ll add a different behavior when the ball hits the paddle. Remember the specs: we want to add points when the paddle hits the ball.</p><pre>onready var root = get_node(&quot;..&quot;)</pre><pre># Handle collision<br>func handle_collision(collision):<br>    if collision.collider is ElasticWall:<br>        if collision.collider.horizontalCollision:<br>            self.hspeed = -self.hspeed<br>        if collision.collider.verticalCollision:<br>            self.vspeed = -self.vspeed<br>            <br>        # Multiply speed by the elasticity coefficient<br>        self.hspeed *= collision.collider.elasticity<br>        self.vspeed *= collision.collider.elasticity<br>    else: # Then it&#39;s the paddle<br>        # Only reflect if colliding with the paddle horizontally<br>        if collision.normal.x != 0:<br>            root.addScore()<br>            self.hspeed = -self.hspeed</pre><p>I’ll take just a quick while to mention the get_node function there. Godot’s node tree is a very central point to its architecture, and so it provides ways of traversing the node hierarchy (so you can, for instance, affect hte child nodes of an actor). And just like in the filesystem tree, “..” denotes the previous level in the tree. That’s why <em>Root</em> is “../..” from the Score label, and also “..” from the Ball node.</p><p>And no you’ll have this gameplay going on. Success!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fwarmheartedjadedcottontail&amp;url=https%3A%2F%2Fgfycat.com%2Fwarmheartedjadedcottontail&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FWarmheartedJadedCottontail-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="640" height="360" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0eda4b5c0efb0e634ab29868eb74a93/href">https://medium.com/media/c0eda4b5c0efb0e634ab29868eb74a93/href</a></iframe><p>Wait, success?</p><h3>Rinse and repeat</h3><p>Okay, reviewing the feature list all the way up there, we have remaining…</p><ul><li>When the ball hits the left wall, it disappears and the score is reset</li><li>Pressing the ESC key quits the game</li></ul><p>Let’s do the easier one first: set up an input that we’ll call “quit” and assign it to the ESC key. Then we’ll add the _input function in the gameplay controller so it’ll finish the game instantly.</p><pre>func _input(event):<br>    if event.is_action_pressed(&quot;quit&quot;):<br>        get_tree().quit()</pre><p>But we don’t want to open the game again to play again when the ball goes over the left side, right? So now we’re going to do two things: firstly, have the ball tell our gameplay controller that the game is over; and then make the gameplay controller actually reset the game to its initial position, beyond just the score.</p><pre># Called when the object is introduced in the scene, or at the start of the scene<br>func _ready():<br>    # start with a random angle between 30 and 60<br>    randomizeMovementAngle(30, 60)</pre><pre># Called at every update step, has the amount of time passed until the last update (delta)<br>func _process(delta):<br>    # Move itself based on its speed components<br>    var collision = self.move_and_collide(delta * Vector2(hspeed, vspeed))<br>    <br>    # Finish the game if too far to the left<br>    if self.position.x &lt;= -128:<br>        root.reset()<br>    <br>    # Deal with the collision if it happens<br>    if collision:<br>        self.handle_collision(collision)</pre><pre># Let&#39;s isolate this routine in a function<br>func randomizeMovementAngle(minAngle, maxAngle):<br>    randomize()<br>    # get the random starting angle... in radians!<br>    var startingAngle = deg2rad(rand_range(minAngle, maxAngle))<br>    self.hspeed = cos(startingAngle) * startingSpeed<br>    self.vspeed = sin(startingAngle) * startingSpeed</pre><p>The reason why we have isolated that logic in a new function will become clear enough very soon. What we did here was have the ball reset the game when it goes far enough to the left. The next step is to change our gameplay controller to do something else in reset()</p><pre># Start of a new game<br>func reset():<br>    # Reset the current score<br>    score = 0<br>    <br>    # Reset the ball at the middle of the screen<br>    var ball = get_node(&quot;Ball&quot;)<br>    ball.position = Vector2(320, 180)<br>    ball.randomizeMovementAngle(30, 60)</pre><p>And now… you have a game that actually starts over when it finishes! Yay!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgfycat.com%2Fifr%2Fzealousremarkableasiantrumpetfish&amp;url=https%3A%2F%2Fgfycat.com%2Fzealousremarkableasiantrumpetfish&amp;image=https%3A%2F%2Fthumbs.gfycat.com%2FZealousRemarkableAsiantrumpetfish-size_restricted.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=gfycat" width="640" height="360" frameborder="0" scrolling="no"><a href="https://medium.com/media/13831e5c94dc305c12b792ef769739c3/href">https://medium.com/media/13831e5c94dc305c12b792ef769739c3/href</a></iframe><h3>You are now officially a Godot Developer!</h3><p>What you have right now is, basically, a complete game that fills all of those requirements we set out at the beginning of this tutorial. Hence… congratulations, you’ve just developed a game in Godot. You are now a Godot Game Developer!</p><p>Now, whether this is the first time you’re meddling with Godot or if this is the merely the first game you ever<em> complete</em> in Godot, then this is just the beginning. There are lots of resources that the engine offers. Lots of things to learn. Lots of ways of doing things! I was going to include some addenda to this article with improvements to this game that also explored more concepts and principles of design in Godot. I’ve decided to leave that for another article for a couple of reasons:</p><ol><li>This tutorial is long enough on its own and it serves its purpose;</li><li>I’ve actually understood some of those concepts wrong and I feel like I need to grasp them better before teaching about them.</li></ol><p>So… this is it for now. Have a lovely day and keep on learning, y’all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a0423243f0e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A LÖVE2D Tutorial — Screen Stack]]></title>
            <link>https://medium.com/@brazmogu/a-l%C3%B6ve2d-tutorial-screen-stack-fc34375c22a1?source=rss-13c1d2baffe2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc34375c22a1</guid>
            <category><![CDATA[love2d]]></category>
            <category><![CDATA[lua]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Bruno Guedes]]></dc:creator>
            <pubDate>Mon, 28 May 2018 17:35:18 GMT</pubDate>
            <atom:updated>2018-05-28T17:35:18.324Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m not sure if I ever got to write an article about game engines with the bottom line being that, while you should never write your own engine from scratch, you’ll definitely end up creating workflows and modules that will, in the end, work as a sub-engine of sorts. Reusing is part of good architecture, after all.</p><p>The Screen Stack is one of those things for me, a common design that I use in many of my LÖVE2D games in order to manage multiple screens and moving through them. I recognize it’s not even an original idea by myself, being actually derived from the code a classmate wrote in college for our silly <em>Breakout</em> clone, and it’s certainly a paradigm older than that. Still, it’s a good teaching experience.</p><p>Thus, let’s begin. This will be a LÖVE2D course in making a Screen Stack and, while it’ll include some nuggets of explanation regarding Lua’s very fascinating table design (metatables included), it assumes a basic knowledge of programming and Lua’s statements and structures. So, if you’re a total newbie, you can study a lot of it <a href="https://www.lua.org/pil/">in here</a> before you dive in.</p><h3>The Concept</h3><p>The Screen Stack is exactly what it sounds like: a stack of screens. I’ll explain what a screen is in this case, but a stack is a more basic programming concept that can be explained in a paragraph or so.</p><p>A stack is a list where you add and remove items from the same end. The abstraction, as one can imagine, is that you put items on the top and take them from there. You never have direct access to any other element but the one at the top, unless you remove the elements above.</p><p>So, the screen stack is a stack of the game screens. Imagine that you start with the main menu, and when you click any of the options, the screen that you should be taken to is placed “above” the main menu, so what you see and manipulate now is this new screen. Of course, this can be accomplished by simply switching the screen entirely by the new one, but the stack abstraction gives us a few design advantages:</p><ul><li><strong>You can return to the previous in the same state it was before.</strong> This is very important to the following point, but also useful for menus that have sprawling tree structures or multiple sections. It also is great for mobile games.</li><li><strong>It allows overlays to be implemented in a natural way.</strong> And the first point makes a lot more sense: if you pause the game, for example, you wan everything to be just as it was before. And this allows for pause menus/screens that are “see-through”.</li></ul><p>So, let’s start from the beginning…</p><h3>Designing The Screen</h3><p>The screen stack will work by giving the main engine an abstraction to invoke its callbacks into the current working screen, instead of having to know what screen we are. For that, we’ll design a Screen class in the way it’s usually done in Lua: by making a class table.</p><pre>Screen = {}<br>Screen.meta = {<br>   __index = Screen<br>}</pre><pre><strong>function </strong>Screen.new()<br>   newScreen = {}<br>   <em>setmetatable</em>(newScreen, Screen.meta)<br>   <strong>return </strong>newScreen<br><strong>end</strong></pre><pre><strong>function </strong>Screen:init()<br><strong>end</strong></pre><pre><strong>function </strong>Screen:show()<br><strong>end</strong></pre><pre><strong>function </strong>Screen:update(dt)<br><strong>end</strong></pre><pre><strong>function </strong>Screen:input(event)<br><strong>end</strong></pre><pre><strong>function </strong>Screen:draw()<br><strong>end</strong></pre><pre><strong>function </strong>Screen:quit()<br><strong>end</strong></pre><p>That’s a lot of empty functions, but that’s alright, because they’re all placeholders. They’re there so the derived Screen instances won’t crash when we try to call a function that was never defined.</p><p>If you’ve studied Lua, you’ll recognize the “:” as being a membership operator that defines a “self” argument as part of the function, meaning the function refers to the object that called it.¹ You may also recognize metatables from the Lua docs, but here’s a summary of what’s going on there: the table <em>Screen.meta</em> is the metatable that will define that any object created with the function <em>Screen.new</em> will refer to the Screen table when trying to access any indexes. That means, e.g. if you try to call <em>update </em>on the new screen you’ve created and there was no update definition for the table itself, then it’ll call <em>Screen.update </em>instead.</p><p>It’s easier seen than said, really.</p><p>What really matters in the Screen table definition are two things:</p><ul><li>The <em>new </em>function which will be used to create new instances of the Screen table.</li><li>The empty functions that will define behavior to be implemented later.</li></ul><h4>Screen Behavior Functions</h4><p>Essentially, we’re laying down a preliminary design for the Screen table. Let’s see what we have planned here:</p><p><strong>init:</strong> called when the screen is added to the stack.</p><p><strong>show:</strong> called when the screen is on the top of the stack. The crucial difference between this and <em>init</em> is that this one will also be called when the screen above it is removed.²</p><p><strong>update:</strong> used to delegate <em>love.update </em>to the top screen of the stack.</p><p><strong>input:</strong> used to delegate all of the engine’s input handling. Implementation here is particular to the developer, but I usually use a table with information such as the type of the event and event data (key code, button code, etc.) as the input argument.</p><p><strong>draw:</strong> used to delegate <em>love.draw</em> to the top screen of the stack, but it may be called for screens inside the stack, too… we’ll see about that later.</p><p><strong>quit: </strong>called when the screen is removed from the top of the stack.</p><p>Now, what these functions <em>do</em> is to be defined on each specific instance of Screen. You probably want to include player input in the Game Screen, while dealing with mouse input in the Mode Selection Screen, and obviously each one will draw different things. What we have to do now is actually implement the stack itself.</p><h3>The Stack Itself</h3><p>Good news is the Screen Stack is what we’d call a Singleton³, so that means, in Lua, that it’ll just be a common table. The (not so) bad news is that it actually has code in it.</p><pre>ScreenStack = {<br>   size = 0,<br>   screens = {}<br>}</pre><pre><strong>function </strong>ScreenStack:push(screen)<br>   <em>self</em>.size = <em>self</em>.size + 1<br>   table.<em>insert</em>(<em>self</em>.screens, <em>self</em>.size, screen)<br>   screen:init()<br>   screen:show()<br><strong>end</strong></pre><pre><strong>function </strong>ScreenStack:pop()<br>   <strong>if </strong><em>self</em>.size &gt;= 1 <strong>then</strong><br>      removed = <em>self</em>.screens[<em>self</em>.size]<br>      table.<em>remove</em>(<em>self</em>.screens, <em>self</em>.size)<br>      <em>self</em>.size = <em>self</em>.size - 1<br>      removed:quit()<br>      <strong>if </strong><em>self</em>.size &gt; 0 <strong>then</strong><br>         <em>self</em>.screens[<em>self</em>.size]:show()<br>      <strong>else</strong><br>         <em>love.event.quit</em>()<br>      <strong>end</strong><br>      <strong>return </strong>removed<br>   <strong>end</strong><br><strong>end</strong></pre><pre><strong>function </strong>ScreenStack:peek()<br>   <strong>if </strong><em>self</em>.size &gt; 0 <strong>then</strong><br>      <strong>return </strong><em>self</em>.screens[<em>self</em>.size]<br>   <strong>else</strong><br>      <strong>return </strong>nil<br>   <strong>end</strong><br><strong>end</strong></pre><p><strong>NOTE 1:</strong> here’s a good point to remember that Lua arrays usually start at 1, and not 0 like most programming languages</p><p><strong>NOTE 2:</strong> note that I very much favor the approach of declaring table functions outside of the table definition. This not only makes the definition clearer(because we use the <em>function table.function_name(args)</em> syntax instead of making an anonymous function), but it makes the whole code better organized, <em>IMHO.</em></p><p>So, <strong>push, pop </strong>and <strong>peek</strong> are the fundamental stack data structure functions, here serving as the means to access the stack itself. They also deal with calling the functions that are supposed to be called when the screens are added and removed from the stack. Peek is an optional stack function that I’ve implemented because it really helps the implementation to have a way to quickly get the topmost item in the stack.</p><p>This covers the basic of the stack. Now, to actually make it usable:</p><pre><strong>function </strong>ScreenStack:update(dt)<br>   <strong>if </strong><em>self</em>.size &gt; 0 <strong>then</strong><br>      <em>self</em>:peek():update(dt)<br>   <strong>end</strong><br><strong>end</strong></pre><pre><strong>function </strong>ScreenStack:draw()<br>   <strong>if </strong><em>self</em>.size &gt; 0 <strong>then</strong><br>      <em>self</em>:peek():draw()<br>   <strong>end</strong><br><strong>end</strong></pre><pre><strong>function </strong>ScreenStack:input(event)<br>   <strong>if </strong><em>self</em>.size &gt; 0 <strong>then</strong><br>      <em>self</em>:peek():input(event)<br>   <strong>end</strong><br><strong>end</strong><br></pre><p>That about covers it. Basically these functions will be called at each of the LÖVE callbacks, essentially saying that, in each update call of the game, the ScreenStack will be updated. In all these functions, we’re only calling the callbacks for the topmost screen, because we presume we don’t care about the screens down below.⁴ The only function that really warrants a bit of explanation in how to call would be <em>input.</em></p><p>LÖVE handles input via several different callbacks: <em>mousepressed</em>,<em> keypressed</em>, <em>keyreleased</em>,<em> textinput</em>… The idea here is to pass the input of these as tables to input, and then input can handle everything, checking the event type in the input table. We could make many different callbacks for the ScreenStack and each Screen… but I think that’s overdesigning, really.</p><pre><strong>function </strong>love.keypressed(key, scancode, isrepeat)<br>   ScreenStack:input({type=&quot;key&quot;, key=key, scancode=scancode})<br><strong>end</strong></pre><pre><strong>function </strong>love.mousepressed(x, y, button, istouch)<br>   ScreenStack:input({type=&quot;mouse&quot;, x=x, y=y, button=button})<br><strong>end</strong></pre><h3>Transparency</h3><p>This is the last detail of the ScreenStack, and it deals with those features I mentioned way back above. As the Stack is implemented right now, only the topmost screen gets dealt with at all, and that includes drawing. So how are we supposed to make that fancy transparent menu screen I mentioned before?</p><p>Well, first we add one argument to the Screen creation function…</p><pre><strong>function </strong>Screen.new(transparent)<br>   newScreen = {transparent=transparent <strong>or </strong><em>false</em>}<br>   <em>setmetatable</em>(newScreen, Screen.meta)<br>   <strong>return </strong>newScreen<br><strong>end</strong></pre><p>That adds one more field to the table, and that is the key to what we’re going to implement. By default, all screens will be “opaque”, so they block the vision of the screens below. But by calling new() with a <em>true </em>argument, we’ll define a transparent screen, and it should draw the screen right below it as well.</p><p>Now, for the biggest change: the <em>ScreenStack:draw</em> function!</p><pre><strong>function </strong>ScreenStack:draw()<br>   first = <em>self</em>.size<br>   <strong>for </strong>first = <em>self</em>.size,1,-1 <strong>do</strong><br>      <strong>if not </strong><em>self</em>.screens[first].transparent <strong>then break end</strong><br>   <strong>end</strong><br>   <br>   <strong>for </strong>screen = first,<em>self</em>.size,1 <strong>do</strong><br>      <em>self</em>.screens[screen]:draw()<br>   <strong>end</strong><br><strong>end</strong></pre><p>Alright, let’s see what’s happening here now! First, we’re defining the <em>first</em> index, which means <em>the first screen, from the top, that is opaque</em>,<em> </em>by starting at the top and going all the way down until we find a non-transparent screen. Note that it may as well be the topmost screen, if none of them are transparent! Also note that, even if every single screen is transparent, the index will be 1.</p><p>The next step then is going in the opposite direction: we’ll invoke the draw callback in every screen from the <em>first </em>all the way to the top, making it so that each screen is drawn on top of the ones before it, without clearing the screen as it’s done in the start of every drawing cycle. Success!</p><p><strong>NOTE: </strong>This can be implemented in <em>any</em> of the ScreenStack callbacks, as a matter of fact. By extending that into the update function, for example, you could create a game with that same <em>Dark Souls</em> mechanic where opening the menu doesn’t actually stop the game. Or you could have the mouse input go trough the multiple screens opened.</p><h3>Is that it?</h3><p>Yes, that is it. Honestly, the ScreenStack itself is a very simple structure, almost so simple that I usually go through the trouble of reimplementing it from scratch in my projects instead of copy-pasting my own work.⁵ It’s better understood when seen in an actual project that makes use of it via Screen implementations. That said, here’s my very own variation on chess, which I call <a href="http://bitbucket.org/pro_mole/chessjam_friendchess"><em>FriendChess</em></a>. Yes, the source code is open, so you <em>can </em>see the files in the <em>screen</em> subfolder where my Screens are actually implemented.</p><p>Feel free to use this model, and to improve on it. Let me know if it was useful to you, too, it’d definitely make my day a lot better. Anyway… keep on making games and never stop learning!</p><p>¹ Better saying, a function declared with <em>:</em> is identical to a function declared with <em>.</em> with an extra first argument called <em>self</em>. You can also call a member function normally with <em>.</em> if you add the table itself as the first argument.</p><p>² A <em>hide</em> function could be used to deal with what happens when the screen is “covered” by another… but in this case it should be specific behavior for each specific case.</p><p>³ With the advantage that it’s not really a singleton, so it does not carry the problems associated with it… for more information on what Singletons are and why not use them, check out the excellent online book <em>Game Programming Patterns</em> at <a href="http://gameprogrammingpatterns.com/singleton.html">http://gameprogrammingpatterns.com/singleton.html</a></p><p>⁴ You’re probably thinking something is wrong here, but I’m getting to that. Trust me.</p><p>⁵ It may also happen that, when I do that, I sometimes add improvements in the code while rewriting. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc34375c22a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Unintended Consequences of Idle F2P]]></title>
            <link>https://medium.com/@brazmogu/the-unintended-consequences-of-idle-f2p-642e249c7236?source=rss-13c1d2baffe2------2</link>
            <guid isPermaLink="false">https://medium.com/p/642e249c7236</guid>
            <category><![CDATA[advertisement]]></category>
            <category><![CDATA[gaming-market]]></category>
            <category><![CDATA[mobile-games]]></category>
            <dc:creator><![CDATA[Bruno Guedes]]></dc:creator>
            <pubDate>Wed, 30 Aug 2017 20:19:17 GMT</pubDate>
            <atom:updated>2017-08-30T20:19:17.342Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been playing <a href="https://www.reddit.com/r/CrabWar/"><em>Crab War</em></a> lately and, yes, feel free to judge me. It’s a Free to Play idle clicker that revolves around the aesthetic wrapper of a war between crabs and reptiles(that look more like just a reptile/amphibian head with legs), with all the increasing numbers, bloated scales and loops within loops that the genre entails.</p><p>Now, I do have a fascination with this style of game, and I even envision making one just for the fun of it. Designing is kind of harder than it seems, though. But anyway: that’s not the point of this article. One thing that playing this game has given me was a rather unexpected insight into the game industry.</p><p>See, one of the usual obstacles of idle game design is how to keep your player actually playing and not just leaving the game running on the background. This is usually done by adding random events that must be engaged with, which in Crab War are butterflies. Yes, they go wild with their animal themes, here. Now, these butterflies have bonuses, and most of them require you to pay a toll to activate. The toll is not money, but time: you have to watch a 10–40 second ad to activate it. You also get to watch ads in order to get other bonuses like an hour-long 50% bonus to idle gold. And that’s where the interesting things came from.</p><p>The ads.</p><p>As you’d expect, the ads served in a mobile game are in their vastly majority ads for mobile games. And by watching those ads I was exposed to tons of games that I’d never care about because I never even browse the front page of most mobile app stores. I swear, I didn’t even know there was a new Angry Birds around! So these ads have been a showcase of new tendencies.</p><p>At least from Crab War ads, I surmise there are mainly two big trends in mobile free games lately: card-game battle gauntlets(especially those based on blackjack) and breakout-like puzzles that consist in throwing a ricocheting character on groups of monsters/baddies(that’s the genre of that new Angry Birds game, in fact). Those are honestly two game genre mixes that I’d never care about, but from the point of view of becoming an indie dev, knowing that is very, very important. And I’d never have the interest of knowing that.</p><p>Of course, this trend will change (or, at least, I <em>hope </em>it does), and it’s very likely I’ll get my updates exactly from the same place: the finger on the pulse that are F2P ads.</p><p>So thanks, Crab War. For the fun, the evolving crabs, and being a window into the F2P market for me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=642e249c7236" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Review: Hey! Pikmin]]></title>
            <link>https://medium.com/@brazmogu/review-hey-pikmin-ef0c4a70f8dd?source=rss-13c1d2baffe2------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef0c4a70f8dd</guid>
            <category><![CDATA[review]]></category>
            <category><![CDATA[nintendo]]></category>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[pikmin]]></category>
            <dc:creator><![CDATA[Bruno Guedes]]></dc:creator>
            <pubDate>Tue, 15 Aug 2017 16:24:10 GMT</pubDate>
            <atom:updated>2017-08-18T01:03:44.422Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*p11KdOtELX9-9VlS.jpg" /><figcaption><em>Pikmin, for the Gamecube</em></figcaption></figure><p><em>Pikmin</em> was a very new concept that came to the Gamecube in the wake of the third millenium (i.e. 2001). If I did, at the time, understand the “Nintendo way” of creating games, I’d know that this is basically Miyamoto creating a suitable character for the RTS genre, since pretty much no other character would properly fit (case in point: the game was born on top of a prototype that involved controlling more than a 100 Marios at once). It’s a game about an alien astronaut crash-landing on an unknown planet inhabited by, among other creatures, the plant-like Pikmin, which are small and feeble and preyed by about anything else, but can quickly grow in numbers if properly coordinated. That is Olimar’s role, basically: as a means to find the parts of his broken ship, he has to help the Pikmin fend for themselves and grow in numbers.</p><p>The main objective of the game is finding the parts of the ship that will allow it to fly away into space and get Olimar back home before he dies due to the planet’s atmosphere containing a deadly gas: oxygen. Since both him and the Pikmin are very small, you have to be cunning in order to hunt and convert the planet’s creatures into more Pikmin and achieve your objective. You also have to go back to your ship every night in order the escape the huge predators in this place, and get your Pikmin back too, as well, or else. It was a very challenging game that favored planning, exploration and in fact was fun to play again with prior knowledge and better strategy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*fbUNgKgLQqrECXsF.jpg" /><figcaption>Pikmin 2, also for the Gamecube</figcaption></figure><p>It was a great success, for its quality and innovation, and so it was given a sequel. <em>Pikmin 2</em> saw Olimar back in his home planet, where his boss sends him back to the unknown planet he just came from, together with the boss’s son Louie, to collect the treasures scattered there… said treasures, btw, are basically human garbage and trinkets, which lends to the idea that the planet is actually Earth, but all humanity was wiped out, animals have evolved in weird ways and Olimar is very very tiny. Anyway, Pikmin 2 had a few major changes:</p><ul><li>The game’s objective changed from one of pure survival to another of accumulation: you have to pay your boss’s debt by hunting treasure; later you’d go back home, but Louie would stay, so you had a new objective (and could take your time looking for every treasure)</li><li>Two characters meant you could manage two armies of Pikmin at once, working on two different places.</li><li>Two more kinds of Pikmin were added to the roster of fire affiliated red, high soaring yellow and amphibious blue Pikmin: the poisonous white and heavyweight purple.</li><li>Inside each big sprawling environment you would find caves, which where dungeons filled with treasure and monsters, where you could only take a limited number of Pikmin, but had no time limit for exploration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*hoYy4cH8GnN3SEuw.jpg" /><figcaption>Pikmin 3, (miraculously) for the Wii U</figcaption></figure><p>Pikmin 2 is pretty good, albeit not as fresh. Still, a very good game, and eventually Nintendo made <em>Pikmin 3</em>, for the Wii U, AKA the main reason why I even bought one to begin with. Among the changes in the plot and gameplay, there was:</p><ul><li>New characters, new story: a trio of aliens from another planet, crash landing into another place in search for food. Again, you have to progress or fail in your quest, which is both getting food (fruit) and finding missing components of your ship to leave.</li><li>New Pikmin: the white and purple Pikmin were sadly removed (except in the challenge/multiplayer mode) and replaced with crystal-breaking rock Pikmin and flying Pikmin.</li><li>Three characters mean even more efficiency, and gamepad allows you to check your map and remotely control characters. It’s pretty great.</li></ul><p>Also removed from the game were the caves, with the gameplay all happening in time-constrained large spaces to explore and open up bit by bit. It’s great and for me it’s as good, maybe even better than the original. It’s, at least,a great improvement on the concept.</p><p>All that said, one thing I’ve always wished for was seeing the game in the DS/3DS. The touch based dual screen paradigm seemed <em>perfect</em> for the RTS genre, despite the failed efforts of the <em>Settlers II</em> port and the pitiful <em>Ant Nation</em> 3DS version. A Pikmin game would be great, and it took this long for it to come into the portable.</p><p>And it’s a 2D platformer. Huh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*IJfUb6AnpX4EmXkj." /><figcaption>Hey! Pikmin, right now for the Nintendo 3DS!</figcaption></figure><p>So, <em>Hey! Pikmin</em> was presented at the 2017 E3, and its trailer worked really well to sell a few of its features: boss fights that used the dual screen in a way similar to some of the 3D Zelda games in the 3DS (conveying the enormity of bosses by way of its two-story viewport), platforming challenges including water you could swim in, and the return to trinkets and the great writing of their descriptions.</p><p>Then came a demo which was… not good. It failed to convey the features of the main game, with not even a single boss fight to it. It made me unsure about the quality of the game, and yet I trusted the trailer and Nintedo’s quality control enough to get it.</p><p>Final veredict: it’s good, with flaws.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*amHXUsruy6RI2ckPonqg4A.png" /><figcaption>And some enemies are way blown out of scale, for some reason</figcaption></figure><p>Essentially, <em>Hey! Pikmin</em> changed the traditional RTS gameplay to a platforming sort of strategy. It has a level system somewhat reminiscent of Pikmin 2’s caves, with a start and ending point and limited number of Pikmin in each level. The game also goes back to the “we need to get out of here” plot, with a slight twist at the end. At its core, it’s a fun game, but I think the main problem is that it feels like… not a Pikmin game, maybe.</p><p>Rather, it feels like a Pikmin game a lot more than, say, <em>Kirby Mass Effect</em> as a Kirby game. But some of the features added don’t make up for those removed. For me, the ideal 2D platformer Pikmin game would have a set of big sprawling Metroidvania-esque levels to be explored, instead of making small sections with defined beginnings and endings. The fact that you collect Pikmin in the stages instead of making them also means you have less control over their numbers, which is a bigger problem for people like me who like to maintain a balance or prefer one type of Pikmin over the others, and still is another big staple of the franchise that was cut out for gameplay constraints.</p><p>It’s still a very good game. It has that beautiful miniature world aesthetic all over it, once in a while it does throw a clever puzzle on your face and even the worst sector of them all, the last one with its sudden spike in difficulty, includes one of the best levels of them all, with <em>actual</em> backtracking. Also, the excellent writing and humor that comes from Olimar’s entries on what the strange objects he finds are is back again, and so is the snark of the S. S. Dolphin’s module, as seen in <em>Pikmin 2</em>.</p><p>Honestly, the two very sour points in the game for me are just: Pikmin Park, which serves little purpose and is a deep well of wasted potential (as a sim/management game-within-a-game instead of an alternative and intermittent source of Sparklium that’s not needed at all) and a lot of Amiibo tied content. Like, a lot, and it’s all very explicit: there’s a whole tab of your logs dedicated to Amiibos (with an Amiibo icon) and the secret areas that are opened with Amiibos are clearly marked in the map, teasing you, who either can’t buy Amiibos because they’re expensive as heck in your country, or don’t own a New 3DS.</p><p>That, and once again the white and purple Pikmin are left out. Poor guys.</p><p>Let me say this again: <em>Hey! Pikmin</em> is a very good game. It’s a good platforming adventure, with secrets to be found, and fun to be had. It has good writing and it is, in fact, a lot longer than I expected. It does a good job.</p><p>Most of my own points against it are based on my expectations on the franchise, and it’s unfair to judge the game for what I wish it was. Rather, I think those expectations would be more fair towards the next console title in the series. I do have ideas about how it could be better, sure (again: Pikmin Metroidvania), but aside from the last two points that I take real issue with, I’m fine.</p><p>In doubt, play the demo, as flawed as I believe it is. It’ll certainly give you a good feel of the gameplay. But, for my word, this game is worth it. Another good job, Nintendo.</p><p>(I’ve been barely maintaining this blog as a gateway for my gamedev learning experiences and analysis of my own hits and misses, but, seeing that this isn’t quite working (i.e. this blog has stopped ever since I got stuck writing my second postmortem) I’ve decided a different direction is in place. So I plan on having about 4 things here:</p><ol><li>Postmortem and Dev Blog</li><li>Tutorials on things I’ve learned/figured myself</li><li>Opinion pieces</li><li>Game reviews</li></ol><p>The last one may seem the least “indie game dev” topic. It is. I just like games and I suppose I dig conveying my opinion on them, too. It’ll also help me develop my writing and game analysis skills, and that surely will help with my game design as well, understanding what makes or breaks a title.)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef0c4a70f8dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BrazMogu Postmortems: Pixel Pop Defense Zone]]></title>
            <link>https://medium.com/@brazmogu/brazmogu-postmortems-pixel-pop-defense-zone-493ad398cb68?source=rss-13c1d2baffe2------2</link>
            <guid isPermaLink="false">https://medium.com/p/493ad398cb68</guid>
            <category><![CDATA[indie-game-dev]]></category>
            <category><![CDATA[postmortem]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Bruno Guedes]]></dc:creator>
            <pubDate>Thu, 09 Jun 2016 14:43:04 GMT</pubDate>
            <atom:updated>2016-06-09T14:43:04.517Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*AqqXxtMuJiYR2K0n7C96_Q.png" /></figure><p>So, when I decided to move my written production into Medium I was in the middle of a series of <em>postmortem</em> posts about all the games I got done so far. Well, most of them are little more than demos or prototypes, but when you started taking game making <em>seriously</em> a little time ago, these really count and you learn a lot. I’ll try to relay all of that learning experience through a long series of posts that so far will feature about 16 of such accounts.</p><p>The one thing I’m still shaking off is the impression that I’m starting exactly with the best game I ever made.</p><p>One aside, so I can talk about games I made before <em>Pixel Pop Defense Zone</em>. That is to say, games I’ve worked on before deciding to take the <em>One Game A Month</em> challenge in 2014, and fail it.</p><p>I will skip all of my failed Game Maker projects, RPG Maker projects, Stencyl projects and even stuff before that (at some point I used “Klik n Play”; not sure if that even exists anymore). There are a few exceptions, but most of them never got really far. Those who did were refurbished later on, so I’ll have posts for the new versions up and about in the future. Gotta have patience.</p><p>So, I had a couple of game clones(notably, my first ALLEGRO game was a PONG clone I even published for someone to use as a teaching implement) and I even started creating my own engine at some point, in C++. The reason? I really missed Game Maker, but I was a full-time Linux user at the time, so I started to cook up an engine with a similar structure and inner working.</p><p>I went as far as three tech demos, one featuring shapes drawn on screen; one featuring a ball bouncing around the screen; and one featuring multiple balls bouncing against each other. Slick physics! Surprisingly, I got the chance to use my own engine in a college project, an AI assignment to create a <em>Reversi/Othello</em> game. Our group made it Spiderman themed, and it was copyright infringementally delicious to make!</p><p>On the subject of college assignments, my biggest game at the time was a <em>Pikmin</em> inspired 3D that got me learning Blender and Panda, together with Pygame. It didn’t go that far, it performed horribly in my own computer and apparently the game loop scaled with the clock speed, so the presentation went… weird. It was a nice idea, though.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*8Kl9ErKE1fDj1KmR0IKLYg.png" /><figcaption>It featured a floating grub drone as the player character; it was just that awesome :V</figcaption></figure><p>At some point I decided I wanted to ship a game, so I went and made a Flash game in Stencyl for a jam. It was <a href="http://www.kongregate.com/games/promole/mole-folk-drilldown"><em>Mole Folk Drilldown</em></a>, a sort of “infinite digger” starring a group of moles that mined for ores and jewels. It had some really primitive proc gen, and I think the character designs were a lot more interesting than the gameplay I managed to get through in time. And, unfortunately, I never got to really add more stuff to the game. Maybe some day…</p><p>And that’s what I’ve done before March 2014, when I went through some stuff in my life and I decided I needed to <em>do something</em>. I decided it was about time I got myself together and really started making games, somehow. I caught wind of the <em>One Game A Month</em> page and decided to accept that challenge. I’ll spare you from a poorly drawn meme here.</p><p>I took the challenge rather seriously. The 1GAM page states you don’t have to really make a game in that month, and you can submit ongoing works and updates, but I decided I wouldn’t give myself that benefit. I would design and develop the game in that amount of time, so concessions would be made in complexity and visuals, but the whole process would be contained in that time constraint. I also decided to use <a href="https://love2d.org/">LÖVE 2D</a>, despite the fact that not only I knew nothing of the engine, but I have never programmed in Lua before.</p><p>Nope, I don’t know when to quit.</p><p>The thing is, I somehow succeeded greatly, thanks to a lot of rational decisions that I don’t believe I ever matched again. All the graphics were vector functions(<em>btw</em>, a very much neglected area in Unity’s API), the game was a few screens and featured very simple gameplay: you had to click on giant pixels coming from the borders of the screen, before they reached the center and attacked your base. It got gradually harder and harder as the pixels started to spawn more frequently, and you’d eventually lose. It’s one of those gameplay concepts that look a lot like classic arcade games, but I don’t think I ever played a game that was literally this simplified.</p><p>And so I managed to finish it in one month, and I called it <a href="http://brazmogu.com.br/game/monthly/april2014"><em>Pixel Pop Defense Zone!</em></a>. Because you <em>defend </em>a <em>zone</em> from the onslaught of <em>pixels</em> by <em>popping</em> them. Bonus: it sounds like an anime title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*GH8riPI0oC72pfOEPIeqZQ.png" /><figcaption>I never even took it out of Alpha, to be honest :P</figcaption></figure><p>It was a project focused on learning both a language and an engine, and while I didn’t really master neither, it was great. I made a credits scene without knowing about LÖVE’s graphics stacks, I made gameplay without understanding Lua’s tables and metatables to its fullest, I even had a very rudimentary particle system. I added a few special pixels that gave you power ups and let the RNG do the rest.</p><p>Again: it might be the best game I ever done, so much that I’ve so far revisited it twice, but I’ll deal with that later. Point is, in hindsight that’s not so bad a thing. To think you have reached your prime at the very beginning can be depressing, but to me it was the boost I needed. I could make this very simple but also very complete game in one month.</p><p>So, a postmortem is about all that was learned and all the challenges involved in making a game, but I don’t know what to put here. Of course, I did learn all I knew of Lua and LÖVE through this, including how to use the <em>love.conf</em> structure, how to make modules in Lua, how to use the Lua table data type(basically the only type at all in Lua)… but I think the most important thing this game gave me was <em>validation</em>.</p><p><em>Seems like I am a Game Developer after all</em>, this told me. And so I kept on making games.</p><p><em>Pixel Pop Defense Zone is available for download </em><a href="http://brazmogu.com.br/brazmogu-monthlies-pixel-pop-defense-zone/"><em>right there in my own site</em></a><em> and should be playable in Windows, Mac or Linux!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=493ad398cb68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Talpa brasiliens (or: Hello World!)]]></title>
            <link>https://medium.com/@brazmogu/talpa-brasiliens-or-hello-world-2ef12f4b036f?source=rss-13c1d2baffe2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ef12f4b036f</guid>
            <dc:creator><![CDATA[Bruno Guedes]]></dc:creator>
            <pubDate>Tue, 24 May 2016 15:52:25 GMT</pubDate>
            <atom:updated>2016-05-24T15:52:25.396Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve debated with myself for a while on the need of an introductory post. I feel that introduction posts are only a little more useful than apologies for not producing anything, at least they have some new content. But, truth be said, we need a place to start, and what better place to start than with introductions. Thus, I apologize for the clunky introduction, and let’s start from the beginning.</p><p>My name’s Bruno Guedes, I’m a Brazilian software developer, amateur independent game developer and a bit of an artist and writer on the side. I’ve been trying to make games for a good while, and lately have been trying to make that into a real thing. As in, a real revenue producing thing, or at least an official skill to add to my resumé. And for reasons I cannot explain anymore a mole has been my avatar for a while. Hence, all the mole references.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*Mf2WRz8jt_valc2_FPfjFA.png" /></figure><p><a href="http://game.brazmogu.com.br/">I have not just started making games</a>, and this is not even my first gamedev blog. This is, in fact, a relocation of my blog(currently running in Wordpress) to a new medium(pun mostly unintended), while my official blog will be totally dedicated to being a portfolio. It feels “more right” to leave the words alone and separate from the games, and Medium feels a lot fluid. A lot better than most blog interfaces, to be honest. This can work.</p><p>If everything goes well and I manage to get myself in a regular writing mood, this blog will soon be filled with postmortems of prototypes, development diaries, thought experiments and the occasional game review. And as this is still the Web 2.0(3.0 never came along, so it seems), everything is up to discussion, so from here we start.</p><p>Now that you know me, let’s have a chat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ef12f4b036f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>