<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Lucas Coelho</title>
    <description>Where I share some thoughts about software and other personal interests</description>
    <link>https://cucadev.ggdaltoso.dev/blog</link>
    
      <item>
        <title><![CDATA[Cool things we can do with automated workflows]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/automated-workflows</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/automated-workflows</guid>
        <pubDate>Wed, 07 May 2025 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Takeda_Oumi_karakuri.jpg/1920px-Takeda_Oumi_karakuri.jpg" class="post-image" alt="A Japanese automata theater in Osaka, drawn in 18th century. The Takeda family opened their automata theater in 1662." title="A Japanese automata theater in Osaka, drawn in 18th century. The Takeda family opened their automata theater in 1662."></img>
<sub>A Japanese automata theater in Osaka, drawn in 18th century. The Takeda family opened their automata theater in 1662.
By 竹原春朝斎 - 摂津名所図会, Public Domain, <a href="https://commons.wikimedia.org/w/index.php?curid=39232059">Link</a></sub>
<br /><br /></p>
<p>One of the things I have played a lot with at work and on personal projects recently is the automation of tasks using GitHub Actions. Maybe you&#39;ve done the same elsewhere, such as in Argo Workflows, Jenkins, CircleCI... But so far the experience with GitHub Actions has been the best for me and given they&#39;re <a class="anchor" href="https://docs.gitea.com/usage/actions/comparison" target="_blank">mostly compatible</a> with Gitea make it a bigger deal for me personally, as I wouldn&#39;t like to be &quot;locked-in&quot; on proprietary software.</p>
<p>Recently I had to integrate <a class="anchor" href="https://github.com/benc-uk/workflow-dispatch" target="_blank">benk-uk/workflow-dispatch</a> at <a class="anchor" href="https://github.com/timescale/docs/commit/a301849dfc2942483fdc903a5a135da5265a82b7" target="_blank">timescale/docs</a>, so we could trigger internal builds on our private documentation website repo adding newer content from this public docs content repo.</p>
<p>Since it&#39;s all <a class="anchor" href="https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_dispatch" target="_blank">workflow_dispatch</a>, you can still define inputs to be sent. In our case, we send the origin branch name and PR number from the docs, so we can generate the previews based on this information, useful for distinguishing the URLs, for instance.</p>
<p>We can now also define the target branch from the <code>ref</code> parameter, making it easier for testing and previewing newer features before they&#39;re live, such as custom markdown syntax, new components, and so on.</p>
<p>And this is just a <em>fraction of the power</em> of workflows! I have a fork of a custom action called <a class="anchor" href="https://github.com/softwoolco/godot-export" target="_blank">godot-export</a> written in TypeScript that I use to build and generate the artifacts for my Steam games for Windows, MacOS and Linux. The fork was created initially just so I could add specific steam DLL/SO files for the Steam integration. Nowadays, I believe this could be achieved with the original action as well, but again, this shows how easily you can extend behaviors by yourself. It&#39;s so convenient to write custom workflows since they support Node.js, Python, Go, <a class="anchor" href="https://github.com/features/actions#:~:text=Any%20language,in%20your%20language%20of%20choice." target="_blank">and more</a>...</p>
<p>If we wanted to go further with this, we could for instance add a step with the <a class="anchor" href="https://github.com/marketplace/actions/setup-steamcmd" target="_blank">setup-steamcmd</a> action, and use their CLI to send the artifacts directly to Steam. How cool is that?</p>
<p>As with anything else, there are concerns to be taken into account, specially regarding security<sup><a id="footnote-ref-1" href="#footnote-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup> and <a class="anchor" href="https://docs.github.com/pt/billing/managing-billing-for-your-products/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes" target="_blank">pricing</a> — think an automation to run hour long tasks at your company multiple times, they won&#39;t be happy at the end of the month.</p>
<p>Of course, if you&#39;re already familiar with CI/CD, any of this shouldn&#39;t be news. But based on my personal experience, many people disregard the importance of these tools and just take it for granted, maybe because there&#39;s already a well-defined DevOps team and making releases always seemed smooth for you and since it just works, why even open the <code>workflows</code> folder to see what&#39;s inside?
At times some people just remember there&#39;s something under the hood when a workflow starts failing, maybe due some expired or revoked token (been there after a colleague left the company and we used one token created from their account). Having to fix, extend or create new workflows generally ends up being that postponed task that no one wants to tackle, but I ask you, why? I recommend diving on it when the opportunity come, it might be eye opening and you start seeing new places that could benefit having that, maybe your projects would be easier to maintain with some automated validations or binaries distribution. It&#39;s surely a great skill for your toolbelt.</p>

    <h2 id=what-else-can-you-do-with-them->
      <a name="what-else-can-you-do-with-them-" class="anchor-heading" href="#what-else-can-you-do-with-them-">
        What else can you do with them...
      </a>
    </h2><p>Recently, I started contributing a bit more to the local GDG group from where I live and, during the website overhaul (last update was 5 years ago!), so I added a <a class="anchor" href="https://github.com/gdgjf/gdgjf.github.io/blob/d138067a2efb5553981f68db0db6cb5e3bc9d9ba/.github/workflows/deploy.yml" target="_blank">workflow file</a> to simply build the Next.js project and deploy it through GitHub pages after every push.
Nothing fancy — but does everything we need!</p>
<p>A Little Game Called Mario, an <em>&quot;open-source, collectively developed hell project&quot;</em><sup><a id="footnote-ref-2" href="#footnote-2" data-footnote-ref aria-describedby="footnote-label">2</a></sup> has a <a class="anchor" href="https://github.com/a-little-org-called-mario/a-little-game-called-mario/blob/main/.github/workflows" target="_blank">whole suite</a> of workflows for:</p>
<ul>
<li>Validating the game dialogs JSON file</li>
<li>Validating and reporting warnings for collisions masks and layers</li>
<li>Building the game on each PR to validate nothing is broken</li>
<li>Deploying the previously built artifacts to a Netlify preview link(!!)</li>
<li>Producing the game credits based on contributors(!!!)</li>
<li>And of course, building and publishing the actual game build</li>
</ul>
<p>Isleward, an open-source moddable roguelike MMO<sup><a id="footnote-ref-3" href="#footnote-3" data-footnote-ref aria-describedby="footnote-label">3</a></sup>, has in their <a class="anchor" href="https://gitlab.com/Isleward/isleward/-/blob/master/.gitlab-ci.yml" target="_blank">.gitlab.yml</a> uses it for running <code>npm audit</code>, linting both client and server packages and even building docker images for the game.</p>
<p>Bevy, an open source <em>refreshingly simple data-driven game engine built in Rust</em><sup><a id="footnote-ref-4" href="#footnote-4" data-footnote-ref aria-describedby="footnote-label">4</a></sup> goes further and use actions to <a class="anchor" href="https://github.com/bevyengine/bevy/blob/main/.github/workflows/send-screenshots-to-pixeleagle.yml" target="_blank">check for visual regressions</a>! That might not seem so cool for web folks that have done the very same for web pages, but come on, we&#39;re talking about a game engine, much cooler.</p>
<p><img src="/blog-post-images/screenshot-Bloom.png" class="post-image" alt="Example Bloom screenshot that went through Bevy&#39;s visual regression test" title="Example Bloom screenshot that went through Bevy&#39;s visual regression test"></img>
<sub>Example Bloom screenshot that went through Bevy&#39;s visual regression test</sub>
<br /><br /></p>
<p>Leaning to game development examples is a good way to &quot;extrapolate&quot; some ideas of what can be done thinking outside of the box, since usually there&#39;s more freedom than in a company environment and interesting ideas emerge from people working on creative projects.</p>
<hr>
<p>Thanks to <a class="anchor" href="https://github.com/manokara" target="_blank">manokara</a> for helping review this post and for mentioning the Bevy example!</p>
<section class="footnotes" data-footnotes>
<h2 id="footnote-label" class="sr-only">Footnotes</h2>
<ol>
<li id="footnote-1">
<p><a class="anchor" href="https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions" target="_blank">Security hardening for GitHub Actions</a> <a href="#footnote-ref-1" data-footnote-backref aria-label="Back to reference 1">↩</a></p>
</li>
<li id="footnote-2">
<p><a class="anchor" href="https://iznaut.com/littlemario" target="_blank">iznaut.com/littlemario</a> <a href="#footnote-ref-2" data-footnote-backref aria-label="Back to reference 2">↩</a></p>
</li>
<li id="footnote-3">
<p><a class="anchor" href="https://play.isleward.com/" target="_blank">Isleward</a> <a href="#footnote-ref-3" data-footnote-backref aria-label="Back to reference 3">↩</a></p>
</li>
<li id="footnote-4">
<p><a class="anchor" href="https://bevyengine.org/" target="_blank">Bevy</a> <a href="#footnote-ref-4" data-footnote-backref aria-label="Back to reference 4">↩</a></p>
</li>
</ol>
</section>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[August 2024]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/august-2024</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/august-2024</guid>
        <pubDate>Sun, 01 Sep 2024 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[
    <h2 id=life-and-death->
      <a name="life-and-death-" class="anchor-heading" href="#life-and-death-">
        Life (and death)
      </a>
    </h2><p>I&#39;ve already seen a couple of things about August being a sad month and things like that, and this one I guess I could relate.</p>
<p>On the first weeks I was informed that one person I met at Gamescom Latam passed away and this made me so sad. Can&#39;t explain much why, considering I&#39;ve seen people die really close to me while in hospitals and while admitted on the ICU.
He was there as a volunteer on Godot&#39;s Engine booth and had recently released his first commercial game on Steam. Other than these two facts (being an independent game developer and using Godot), we had little interaction and nothing specially in common.</p>
<p>But that really messed with my head. As I&#39;ve said before <a class="anchor" href="/blog/uncertainty" >I never actually thought of how would it be like to live adult life</a>, so I guess I never really had the fear of losing people next to me, since it was obvious that I was going to pass earlier than everyone else.</p>
<p>Now I&#39;m closer to thirties than twenties and this is fading away, I&#39;m starting to think about things that were never a worry and I never expected to be so afraid of. Maybe this was just one thing on the pile that made me think a bit more about it... This is so weird, and I am really afraid. Being the one who &quot;stays here&quot; seems much worse to me.</p>

    <h1 id=social-media>
      <a name="social-media" class="anchor-heading" href="#social-media">
        Social media
      </a>
    </h1><p>It just started a few days ago but well, Twitter is blocked here in Brazil and I am happy to not caring much about it. As I posted <a class="anchor" href="/blog/july-2024" >last month</a>, I was already struggling a bit with being almost glued to it. So it feels like I was preparing for it.</p>
<p>What I am not happy about with is that there&#39;s still that feeling that * you have to * build a presence on places A and B (I personally was satisfied already with Mastodon) and of course most of the crowd would choose one of the other shiny options.</p>
<p>It feels a bit like if the cycle continues even people use multiple explanations to assure that now is different and that in new shiny place A you have [<em>tons of features</em>] that make it decentralized and more friendly which to me seems just like... <a class="anchor" href="https://www.fediverse.to" target="_blank">Fediverse</a>?</p>
<p>I&#39;ll try my best to in other platforms ensure that I&#39;ll use it only as a place to get seem and discover gamedev people for instance.</p>

    <h1 id=gamedev>
      <a name="gamedev" class="anchor-heading" href="#gamedev">
        Gamedev
      </a>
    </h1><p>I didn&#39;t have the time I wanted to thinker with Luxe, but I was able to do that with Defold! And it was pretty fun. I did a small project for GMTK 2024 that I didn&#39;t finished and want to eventually release it and open source it. It is meant to be a game for my little brother.</p>
<iframe src="https://mastodon.gamedev.place/@cuca/113000607783356969/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="400" allowfullscreen="allowfullscreen"></iframe><script src="https://mastodon.gamedev.place/embed.js" async="async"></script>

<p>Also been learning more and struggling a bit with pathfinding, A*, steering behaviors and related techniques. Ugh, graphs!</p>
<iframe src="https://mastodon.gamedev.place/@cuca/113058194748475330/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="400" allowfullscreen="allowfullscreen"></iframe><script src="https://mastodon.gamedev.place/embed.js" async="async"></script>

<p>Other than that, I&#39;ve been wanting to start a separate blog for going a bit deeper on game design, probably in Portuguese instead since I think it would be much more beneficial for people even if it doesn&#39;t reach as much as it would in english.</p>
<p>It would be a great usage for mydomain.com that I get some months ago. And this dot dev maybe become something more work-related? I don&#39;t know. I am so bad at organizing stuff.</p>
<p>But I&#39;ve been still struggling with meltdowns and don&#39;t want to commit to anything I can&#39;t right now. Let&#39;s see.</p>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[July 2024]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/july-2024</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/july-2024</guid>
        <pubDate>Mon, 05 Aug 2024 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p>I decided to take some time to think and reflect about the last month a bit, since I&#39;ve been wanting to write more and I never find anything interesting enough to be throw in public.
Some quick highlights from the top of my head: work, gamescom latam, devopsdays, gamedev, social media usage and walking.</p>
<p>Work is fine, nothing that I&#39;d like to specifically say, and this isn&#39;t a complaint, I&#39;m happy everything is good!</p>

    <h2 id=gamescom-latam>
      <a name="gamescom-latam" class="anchor-heading" href="#gamescom-latam">
        Gamescom Latam
      </a>
    </h2><p>This year we had the first Gamescom Latam (previously BIG Festival - Best Independent Games [previously BIG Festival - Brazilian Indie Games Festival ])
I can&#39;t say much about the previous ones before the &quot;rebrand&quot;/merge with gamescom, I&#39;ve heard a lot of things for many years about BIG but I was never there before. But I <em>really</em> enjoyed Gamescom.
On BIG 2023 my game was chosen and I could have been there exposing to others, but I wasn&#39;t able to and had to pass.</p>
<p>Now that I went as general public, I&#39;m a bit glad I did passed the opportunity before. It&#39;s really cool to see developers showcasing their work, passionately justifying some bug before it even happen while you play and anxiously seeing whether you&#39;ll be able to pass a puzzle, but I can&#39;t even imagine how tiring it should be to stay for hours on a stand showcasing your demo the whole day for multiple people, at each day getting your dark circles darker and hopefully being seen by a publisher and getting a good deal.</p>
<p>These kind of events are really a nice way to showcase your work to different people, from other developers and most importantly, gamers who might like it, wishlist and buy later. I can&#39;t tell how much the award thing is useful or not and how much it helps smaller developers, but anyhow it might be really cool to be participating.</p>
<p>I got a passport ticket, so I had access to all days. I&#39;m not much of a &quot;people person&quot; and the first day there (after press) was the best since I was able to get in earlier and there weren&#39;t many people yet besides developers setting up their stands. I was more interested in knowing local games that I never heard off and was definitely surprised with that. Sometimes I think I forget the fact that Brazil is a continental country and the Twitter bubble isn&#39;t the real world. In fact, the coolest projects I discovered there I never saw on Twitter before.
Not only that as I was also able to meet in person people I knew only from internet before. That was really amazing. Lots of fun out of the expo itself as well, such as the Godot Meeting and <em>Gamescom Latão</em>.</p>

    <h2 id=devopsdays>
      <a name="devopsdays" class="anchor-heading" href="#devopsdays">
        DevOpsDays
      </a>
    </h2><p>I gave a talk at a local DevOpsDays some days after the gamescom, it was surprisingly well received. I spoke about <em>the joy of learning</em>, disguised as &quot;how to become a DevSecOps&quot; and telling some stories of my childhood when I started tinkering with Ragnarok Online servers, setting things up and doing the &quot;infrastructure&quot; for it. The DevSecOps on my presentation meant basically PHP, <del>AVG</del> basic mitigations and rsync/FTP. And for some reason my weird presentation worked well. I really wanted it was recorded, though.</p>

    <h2 id=gamedev>
      <a name="gamedev" class="anchor-heading" href="#gamedev">
        Gamedev
      </a>
    </h2><p>My game [Siege &#39;n Sow] is having an identity crisis, since it wasn&#39;t getting where it wanted. Because of that, I went a lot of steps back to prototype and iterate some of the core of what the game should be before moving on. The project isn&#39;t abandoned, nor canceled. Check out the Discord Server for my games if you want to see what happens next.</p>
<p>While in this hiatus rethinking what I want for my &quot;main&quot; project, my game <a class="anchor" href="https://store.steampowered.com/app/2210670/Torecower/" target="_blank">Torecower</a> got a 40% off on Steam (the highest it has ever been) during the Tower Defense Festival and it really gave a bump on the sales. Not enough to pay the bills, but at least my internet. It also got me motivated to do some improvements on top of some reported bugs I had regarding the weekly leaderboard. If you have a Windows, Linux (including steam deck) or MacOS machine, I&#39;d definitely recommend checking out the game :)</p>

    <h2 id=social-media-usage>
      <a name="social-media-usage" class="anchor-heading" href="#social-media-usage">
        Social media usage
      </a>
    </h2><p>One might say I&#39;m pretty intense with things, maybe some of that is due the fact I&#39;ve been in front of computers since the age of 8. But I was getting into a state that reading some stupid Tweets was able to get me into a lot of anger and completely ruining my weeks due some arguments I had (even if they only happened on my head).</p>
<p>So since July 11th I officially stepped away from twitter &mdash; nothing too destructive as deactivating my account, since I still will use it to post about my games. And it was really life changing to me. I&#39;ve been exercising more, spending more time with my partner, doing things more slowly and cautiously and enjoying more the things I want to do.
I have the habit of quick switching between bad habits, so the first thing I&#39;d do after leaving twitter would be spending more time on Discord, for instance. But this time I&#39;ve been putting more effort into opening my RSS feed (if I&#39;m going to keep on screens) and reading something interesting rather than alt tabbing between Discord and my current task and being inattentive for both things I&#39;m trying to do.</p>

    <h2 id=walking>
      <a name="walking" class="anchor-heading" href="#walking">
        Walking
      </a>
    </h2><p>As a consequence of the previous topic, I&#39;ve been also starting walking more, which might seem futile for most people, but at times I wouldn&#39;t leave my home for months if possible for anything, so it&#39;s a huge thing for me. Well, I hope with this bigger focus and capacity of being more productive I can bring more attention to the project I want to release.</p>

    <h2 id=gamedev-2->
      <a name="gamedev-2-" class="anchor-heading" href="#gamedev-2-">
        Gamedev 2 👀
      </a>
    </h2><p>As of now, first week of august, I&#39;m now a member of <a class="anchor" href="https://luxeengine.com/" target="_blank">Luxe</a> engine closed beta and I&#39;m so eager to tinker with it, so I might be a little sidetracked with the other things, but hopefully not so much! Since it&#39;s an earlier version I really hope to be able to contribute with something and since it&#39;s a project I <em>really</em> believe in and have been eager to interact with, it might get a bit of priority for me as well.</p>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[What happened to Softwool?]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/what-happened-to-softwool</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/what-happened-to-softwool</guid>
        <pubDate>Sat, 13 Jul 2024 00:00:00 GMT</pubDate>
        <lastBuildDate>Sat, 13 Jul 2024 00:00:00 GMT</lastBuildDate>
        <content:encoded><![CDATA[<p>If you already know what is Softwool, you may want to skip to <a class="anchor" href="#softwool" >Softwool</a>.</p>

    <h2 id=history>
      <a name="history" class="anchor-heading" href="#history">
        History
      </a>
    </h2><p>In 2022, during the pandemic, me and three friends discussed about making an indie game development collective, something inspired by <a class="anchor" href="https://sokpop.co" target="_blank">sokpop</a>
Given life circunstancies, three of us (me included) ended up unable to put the time and effort to make an initial batch of games to release.</p>
<p>The name Softwool come up between me and <a class="anchor" href="https://x.com/gabvinis" target="_blank">Gabriel</a> while discussing the idea, at some point we were at SoftMary which was a pun with Software and &quot;Maria Mole&quot; (literal translation, also known as limp Mary) which is a popular dessert here, it looks like a marshmallow. We wanted something easy to search and recognize.</p>
<p><img src="https://github.com/user-attachments/assets/fc069a47-e16d-4a4f-a538-2849fd987745" class="post-image" alt="Image of some &quot;maria mole&quot; on a plate" title="Image of some &quot;maria mole&quot; on a plate"></img></p>
<center><sub>Image of some "maria mole" on a plate</sub></center>


<p>When Cauê finished an initial version of <a class="anchor" href="https://store.steampowered.com/app/1956400/PISTOLA/" target="_blank">PISTOLA</a>, we discussed about pivoting things so instead I&#39;d use some money I&#39;ve saved from my job to pay him for this work on the game, in exchange we&#39;d share the revenue of the game between him and &quot;Softwool&quot; (our name as a collective), since the goal at first was just to &quot;invest&quot; on the collective as a project.</p>
<p>And although it was enough to afford Cauê&#39;s time while he worked on spare time, me and the others couldn&#39;t keep up with the initial plan to make three individual games each of us. Since everyone need to pay bills, we split from <a class="anchor" href="https://x.com/Murilo3031" target="_blank">ThornDuck</a> and <a class="anchor" href="https://x.com/gabvinis" target="_blank">Gabriel</a></p>

    <h2 id=softwool>
      <a name="softwool" class="anchor-heading" href="#softwool">
        Softwool
      </a>
    </h2><p>PISTOLA was pretty much done when we decided to pivot from collective to this &quot;studio&quot; model and I had basically no involvement in the game besides minor hot-fixes. Cauê was already coming up with the concept of what became <a class="anchor" href="https://store.steampowered.com/app/2210670/Torecower/" target="_blank">Torecower</a> and in this game we started doing things in a more organized way.</p>
<p>After an initial version I did a lot of play-test of it and we iterated the initial game in order to improve playtime and address initial player feedback. In the meantime, we also got the help from <a class="anchor" href="https://x.com/cuelhoga" target="_blank">Haydorf</a>, which is both my cousin and best friend. He worked full-time as an accountant and was willing to help in his spare time with both his expertise and some project management/game design touches.</p>
<p><img src="https://github.com/user-attachments/assets/fa2a630c-de91-4715-87a9-2e4d30246d0c" class="post-image" alt="Torecower&#39;s skill-tree overhauled design made by Haydorf. It&#39;s still how the in-game one is structured" title="Torecower&#39;s skill-tree overhauled design made by Haydorf. It&#39;s still how the in-game one is structured"></img></p>
<center><sub>Torecower's skill-tree overhauled design made by Haydorf. It's still how the in-game one is structured.</sub></center>

<p>I wasn&#39;t being humble. Haydorf completely re-designed the skill tree, which was then implemented in the game by Cauê in <a class="anchor" href="https://store.steampowered.com/news/app/2210670/view/3637256961026773845" target="_blank">Torecower&#39;s v1.3.0</a>
It not only improved the whole game progression as increased the mean playtime in 50%</p>
<p>Note that up to this point Haydorf wasn&#39;t paid. Just willing to help because he believed in Softwool.</p>
<p><img src="https://github.com/user-attachments/assets/878ea360-2b6e-47a4-9028-427af07b4547" class="post-image" alt="Softwool&#39;s logo" title="Softwool&#39;s logo"></img></p>
<center><sub>Softwool's logo.</sub></center>

<p>After Torecower was considerably improved and more &quot;feature complete&quot; to be considered an actual game, I was already messing with a prototype which got a lot of positive feedback and a few ideas to improve.</p>
<p>You see, it was a game about strategic combat using movement cards in one dimension. A common feedback was about adding vertical movement, which ended up being the main reason of me getting overwhelmed and also the downfall of Softwool.</p>
<p><img src="https://github.com/user-attachments/assets/95b1f531-e622-44a7-810c-4f0a0bcc43cb" class="post-image" alt="In-game screenshot of &quot;proto-card&quot; a prototype I made in around 5 days during the end of 2022" title="In-game screenshot of &quot;proto-card&quot; a prototype I made in around 5 days during the end of 2022"></img></p>
<center><sub>In-game screenshot of "proto-card" a prototype I made in around 5 days during the end of 2022.</sub></center>


    <h3 id=project-skyp>
      <a name="project-skyp" class="anchor-heading" href="#project-skyp">
        Project SKYP
      </a>
    </h3><p>Project SKYP, the codename for Skyward Pilgrimage, the new version of <code>proto-card</code> started wrong for a single reason: it&#39;s existence meant the main concept of it &emdash; which was the one dimension strategy &emdash; being thrown away, turning it essentially into a basic board turn based strategy game.</p>
<p>Don&#39;t get me wrong, I really like strategy games in general, there&#39;s a reason I always add strategy elements on my projects where I can, but back then I already knew that this wasn&#39;t the kind of game I had in mind. And compromising this vision ended compromising my interest in the project as well, even if I didn&#39;t assume that at first.</p>
<p>With the help of Haydorf and Cauê, we started looking for an artist for this project, so we started making a brief, got lots of resumes of amazing people and even comissioned individuals mockups for the game before taking a decision. While on twitter I ended up noticing someone on my notifications interacting with the posts and there it was <a class="anchor" href="https://x.com/Tulipa_Dev" target="_blank">Tulipa</a>, not only an amazing artist but in fact they had contacted us via e-mail (we ended up discovering that the e-mail wasn&#39;t sent, but it existed hahahah), since I never received the e-mail, it was just a coincidence (or maybe their intentional interactions with my personal and Softwool&#39;s twitter)</p>
<p><img src="https://github.com/user-attachments/assets/e02fd805-bb96-4b6c-9bdb-182c69fd42cb" class="post-image" alt="Concept art made by Tulipa for Skyward Pilgrimage, meant to be used on a game announcement teaser." title="Concept art made by Tulipa for Skyward Pilgrimage, meant to be used on a game announcement teaser."></img></p>
<center><sub>Concept art made by Tulipa for Skyward Pilgrimage, meant to be used on a game announcement teaser.</sub></center>

<p>Tulipa is very committed and a great artist. It was unfortunate for them that soon after they came aboard I started getting overwhelmed. I wasn&#39;t feeling good on my full-time job, it was hard to &quot;manage&quot; and deliver things, I wanted to keep it casual and at the same time professional and deliver things fast, which also got worsened by my frustrations being thrown at Cauê with both my fear of failure + concern about people opinion on us.</p>
<p>It felt exponentially bad to even think about the projects. And we did pretty cool stuff, such as a working prototype, some art and even an announcement teaser that we submitted to Wholesome Games (we weren&#39;t selected)</p>

    <h2 id=the-meltdown>
      <a name="the-meltdown" class="anchor-heading" href="#the-meltdown">
        The meltdown
      </a>
    </h2><p>At that time, I was still being tested, but I ended up later discovering that I&#39;m not only <del>on the spectrum</del>, but I am twice exceptional person. I also discovered that I was melting down, and although I never had the experience of a burnout, with what I know about myself nowadays I discovered that I had a few other meltdowns during my life. I simply couldn&#39;t handle it. I didn&#39;t wanted to be &quot;responsible&quot; for people.</p>
<p>I&#39;m not a manager. Having a team is great, but I&#39;m a creator, not an entrepreneur.</p>
<p>Long story short, I wrote a huge ass letter telling about my decision to &quot;end&quot; Softwool, got all the savings I had for the next ~10 months of Softwool development and split between them. I was so afraid of having a conflict that I didn&#39;t take any of this (other than the revenue the games kept making later)</p>
<p>Some months later I&#39;d also discover that I wasn&#39;t &quot;just&quot; having a meltdown but also had a 3rd degree AV block that made me need a pacemaker implant surgery.</p>

    <h2 id=what-then->
      <a name="what-then-" class="anchor-heading" href="#what-then-">
        What then?
      </a>
    </h2><p>Well, I kept working on the games, doing mostly maintenance patches and working on <a class="anchor" href="https://store.steampowered.com/app/2773700/Siege_n_Sow/" target="_blank">Siege n Sow</a>, &quot;my own creation&quot;.</p>
<p>I still love making games but I want to keep it as something that I like, as I always loved. And at least I had the experience, I guess? If you&#39;re paying attention you may have noticed that up to know, Softwool never really died, and it won&#39;t. It&#39;ll just... change?</p>
<p>I&#39;ve already made a <a class="anchor" href="https://discord.com/invite/CbXrxCmUv3" target="_blank">new Discord Server</a>, both to keep history of what was there, but I don&#39;t want to &quot;hold&quot; the name of something that was always a collective effort/idea to become &quot;Cuca&#39;s studio&quot; or something like that.</p>
<p>There are specific things, specially the Twitter and Steam accounts that aren&#39;t worth to create a new one, since I was always the one managing these, but the rest of community and the name itself is going away. It&#39;s not as if I was ashamed or something like that, it&#39;s just that doesn&#39;t seem right sticking to it being completely changed from what it was meant to be. Or I just hate myself so much that I keep coming back to the worst part of building something (naming it)?</p>
<p><img src="https://github.com/user-attachments/assets/07186a22-3a87-463f-8a40-23903e1e5d5f" class="post-image" alt="Screenshot of current versions of Siege &#39;n Sow, my RTS game." title="Screenshot of current versions of Siege &#39;n Sow, my RTS game."></img></p>
<center><sub>Screenshot of current versions of Siege 'n Sow, my RTS game.</sub></center>

<p>After the initial excitement phase of Siege &#39;n Sow I noticed that I was moving a bit away from my objective, which is to make a game that I&#39;d enjoy playing and started looking to finish something.</p>
<p>I&#39;m aware that I am able to finish stuff and one of the reasons I have a full-time job outside of the games industry is to keep doing things the way I enjoy without depending of the revenue of my games. So the game may take longer, but it&#39;ll be better. At least for me.</p>
<p>Good for me seems good enough.</p>

    <h2 id=team>
      <a name="team" class="anchor-heading" href="#team">
        Team
      </a>
    </h2><p>Well, it wouldn&#39;t make sense to say all that without giving kudos to the people who made this possible and were directly involved. So I really want to shout out to:</p>
<ul>
<li><a class="anchor" href="https://x.com/gabvinis" target="_blank">Gabriel</a>: now working in the beautiful <a class="anchor" href="https://store.steampowered.com/app/2257830/Moth_Kubit/" target="_blank">Moth Kubit</a>, we setup the first accounts together, came up with the name, the first visual identity. And even after Softwool, played some RPG sessions together;</li>
<li><a class="anchor" href="https://x.com/Murilo3031" target="_blank">ThornDuck</a>: made a lot of cool prototypes, and is working on a full fledged version of one of his games, The Warrior</li>
<li><a class="anchor" href="https://store.steampowered.com/app/2464880/Terracards/" target="_blank">Cauê</a>: I would never be able to say a game I actually worked on was on Steam if it wasn&#39;t by you. I&#39;m so happy for the success <a class="anchor" href="https://store.steampowered.com/app/2464880/Terracards/" target="_blank">Terracards</a> is. I know I&#39;m pretty annoying with you, but I have an affection and feel as if you were my younger brother.</li>
<li><a class="anchor" href="https://x.com/cuelhoga" target="_blank">Haydorf</a>: you&#39;ve been one of my best friends forever. You heard me whining before everyone else when anything felt wrong and I really expect to work with you in the future, you have a really nice touch for being a producer/game designer.</li>
<li><a class="anchor" href="https://x.com/Tulipa_Dev" target="_blank">Tulipa</a>: thanks for taking your bright to the team! I&#39;m so glad to have worked and to got to know a bit more of you and the love you put in every pixel you make.</li>
</ul>
<p>I am glad we made this story together. I don&#39;t think any of us will stop making games anytime soon. Thanks for everything.</p>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[Uncertainty]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/uncertainty</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/uncertainty</guid>
        <pubDate>Thu, 16 May 2024 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p>&nbsp;&nbsp;&nbsp;&nbsp;I was born with two myocardial diseases that, although <a class="anchor" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8125617/" target="_blank">rare to coexist</a>, are not impossible: Hypertrophic cardiomyopathy (<a class="anchor" href="https://en.wikipedia.org/wiki/Hypertrophic_cardiomyopathy" target="_blank">HCM</a>) and Restrictive cardiomyopathy (<a class="anchor" href="https://en.wikipedia.org/wiki/Restrictive_cardiomyopathy" target="_blank">RCM</a>).</p>
<p>The bad news is that HCM has a mortality rate of about ~1.0 per year<sup><a id="footnote-ref-1" href="#footnote-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup>, and to add insult to injury, I was one of the few at risk of sudden death.</p>
<p>We discovered this during a routine medical appointment when my parents added me to a new health insurance at the age of five. To make it worse:</p>
<blockquote class="quote"><p>Unfortunately, compared to other pediatric cardiomyopathies, RCM is less amenable to medical or surgical treatment with higher mortality rates: 63% within 3 years of diagnosis and 75% within 6 years of diagnosis
<sup><a id="footnote-ref-2" href="#footnote-2" data-footnote-ref aria-describedby="footnote-label">2</a></sup></p>
</blockquote><p>So yeah, although nowadays we know much more about both diseases, at the time (~2003/2004) since they are congenital diseases and we had little knowledge about it and doctors basically said that I wasn&#39;t going to reach six years to my parents.</p>
<p>And my parents did a lot for me, they tried a lot of renowned clinics and doctors, and one even had the following dialogue with my mom:</p>
<blockquote class="quote"><p>D: Do you have any other children?</p>
<p>M: Yes, a newborn girl, why?</p>
<p>D: Well, you could get closer to her, enjoy time and dedicate yourself more to her [...]</p>
</blockquote><p>It&#39;s not as absurd as when my mother tells this story, but basically, the doctor told her — without me in the room, since I was desperate and didn&#39;t want to hear that I&#39;d probably have to take some blood tests, as always — that there was nothing to do regarding me and she would suffer less by accepting that I was going to die.</p>
<p>It&#39;s weird to put this out, since she just told me this much later. On that day, I just remembered that she was furious and told we weren&#39;t coming back there, which relieved me (no needles in my skin!)</p>
<p>Well, we didn&#39;t know back then, but the prognosis isn&#39;t <em>this</em> bad, since I was only going to start having some symptoms of the diseases two years later, at seven (~2005/2006).</p>
<p>At the same time, the hospital where I ended up having the reference treatment from my state was just starting to do pediatric heart transplantation, which was most likely what I eventually would need, but things weren&#39;t going well due to their inexperience. I was then redirected us to INCOR, the Latin America reference when talking about heart institutions (still is!).</p>
<p>Note that, after the unexpected recommendations to just give up in paid clinics and doctors, all the treatment I got was free, due to SUS<sup><a id="footnote-ref-3" href="#footnote-3" data-footnote-ref aria-describedby="footnote-label">3</a></sup> (Brazil&#39;s publicly funded health care system). Since I was from Rio de Janeiro and INCOR is based in São Paulo, we couldn&#39;t afford the recurrence from appointments and exams completely, but thanks to <em>Tratamento Fora do Domicílio</em><sup><a id="footnote-ref-4" href="#footnote-4" data-footnote-ref aria-describedby="footnote-label">4</a></sup> (TFD, stands for &quot;Treatment Outside Home&quot;), they reimbursed our (patient + one companion, my mother) daily expenses for food and transportation.</p>
<p>I won&#39;t go into much detail regarding the bureaucracy, but it requires a lot of authorizations and accountability — one can&#39;t just spend R$ 100,00 on Big Macs and ask for a government refund.</p>
<p>Biopsies, catheterizations, ECG, imaging tests... you name it. I had access to it, and if you&#39;re reading this now, it&#39;s thanks to that. I know it has flaws, but for each person who has a bad story to tell about the public health systems, I know hundreds of people, by name, who are still here or were for longer than they could be thanks to it.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;I never stopped going to school in the meantime, and since any physical activity left me blue and breathless, my family got me a laptop, and this computer became my best friend.</p>
<p>I was chronically online before this term was coined. I learned English by myself, played many hours of Ragnarok Online, started making games with Flash, RPG Maker, participated in Forums.</p>
<p>I once went by KamauX, Lucky, Flocky, xX Lucas Xx, DFox, Yoroy. I had a bunch of names over these years because every now and then some would look dull, and I wanted a cooler one. Unfortunately, being gifted didn&#39;t make me smart enough to save more of my online presence before 2011, so most of it is just pieces of memories in my head.</p>
<p>Heck! Ten years ago — before a transphobe writer ruined it for me — I had a <a class="anchor" href="https://www.youtube.com/watch?v=zv_C8eYU6-8" target="_blank">RPG Maker XP MMORPG about Wizards and Magic schools</a>! This is so cool to think about in retrospect.</p>
<p>Today, as you might have figured out up to this point, I work as a Software Engineer. What a cool name. I <em>actually</em> always loved programming, and this made it hard for me to switch my mind to see it as a career as well. I didn&#39;t know we could have great salaries until I did.</p>
<p>This made me undervalued and overworked for some time, since I had a lot of baggage but little experience, and it was enough to put me in the beginner box. Not that I&#39;m totally against it; actually, this helped me gain more maturity and understand that I knew nothing — still don&#39;t —, in fact, I&#39;m what people call today a &quot;lifelong learner.&quot;</p>
<p>You might be wondering what this small timeline has to do with my health. And to be honest, I&#39;m a bit confused as well; I got carried away and liked it.</p>
<p>I was thinking earlier (as I always do; anyone who knows me personally has already listened to this take), how weird it is to live with an <em>expiration date</em>. I never imagined myself getting to 15, 18, getting laid, then it came the 20s... now I&#39;m closer to my early 30s than my 20s.</p>
<p>And still, I can&#39;t imagine how my life will be at, let&#39;s say, 35. Because I don&#39;t even believe I&#39;ll be here.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;I know, dear reader, you (or I) can just get hit by a bus and die while being perfectly healthy. I assure you it&#39;s not the same thing. I don&#39;t spend my whole day thinking I&#39;m going to die. The fact is that <em><strong>I don&#39;t</strong> have an expiration date anymore</em>.</p>
<p>Back in 2011, I got a heart transplantation after just two and a half months on the queue, at age around mid-12. It was easier at the time since I was tall enough to get an adult heart (something that&#39;s not really usual, it seems).</p>
<p>In fact, I was the 100th pediatric hearth transplant of INCOR, I was on some journals and even on TV<sup><a id="footnote-ref-5" href="#footnote-5" data-footnote-ref aria-describedby="footnote-label">5</a></sup></p>
<p>So, I don&#39;t see my life as either a half-full or half-empty glass of water. A lot of things went right, a lot of things went wrong. The &quot;post-transplantation&quot; isn&#39;t the easiest thing in the world; I keep having to go several times a year for a bunch of exams. At the end of last year, I even got a pacemaker implant, so... This journey isn&#39;t done after the surgery.</p>
<p>Don&#39;t get me wrong, a lot of things I experienced won&#39;t be experienced by some people, and some I won&#39;t ever myself, even by choice! So it&#39;s not just complaints for the sake of complaints.</p>
<p>I guess, in the end, it&#39;s just weird. Some people think it&#39;s immediacy, but for instance... This year I went out of South America for the first time. It was simply amazing ✨</p>
<p>Now, while previously I had no &quot;goal&quot; in my life, I have the goal of going to live in Europe. Maybe it won&#39;t work out, maybe after a year or two, I&#39;ll want to return.</p>
<p>Maybe don&#39;t. Maybe I don&#39;t even get to move, just because I changed my mind. ¯\_(ツ)_/¯</p>
<p>Oh, and just in case you&#39;re reading this, mom: Mario Bros<sup><a id="footnote-ref-6" href="#footnote-6" data-footnote-ref aria-describedby="footnote-label">6</a></sup></p>
<section class="footnotes" data-footnotes>
<h2 id="footnote-label" class="sr-only">Footnotes</h2>
<ol>
<li id="footnote-1">
<p><a class="anchor" href="https://pubmed.ncbi.nlm.nih.gov/24630786/" target="_blank">Source</a> <a href="#footnote-ref-1" data-footnote-backref aria-label="Back to reference 1">↩</a></p>
</li>
<li id="footnote-2">
<p><a class="anchor" href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8822222/#B2" target="_blank">Source</a> <a href="#footnote-ref-2" data-footnote-backref aria-label="Back to reference 2">↩</a></p>
</li>
<li id="footnote-3">
<p>Wikipedia: <a class="anchor" href="https://en.wikipedia.org/wiki/Sistema_%C3%9Anico_de_Sa%C3%BAde" target="_blank">SUS</a> <a href="#footnote-ref-3" data-footnote-backref aria-label="Back to reference 3">↩</a></p>
</li>
<li id="footnote-4">
<p><a class="anchor" href="https://wiki.saude.gov.br/regulacao/index.php/Tratamento_Fora_do_Domic%C3%ADlio_(TFD)" target="_blank">TFD</a> <a href="#footnote-ref-4" data-footnote-backref aria-label="Back to reference 4">↩</a></p>
</li>
<li id="footnote-5">
<p><a class="anchor" href="https://youtu.be/QozyNzYJWr0?t=95" target="_blank">Youtube Video</a> <a href="#footnote-ref-5" data-footnote-backref aria-label="Back to reference 5">↩</a></p>
</li>
<li id="footnote-6">
<p>Before going into surgery, we agreed that once I woke up from the transplant, this was the safety word to tell her that I&#39;m ok. My transplant was on May 7th, 2011, Mother&#39;s Day&#39;s eve. <a href="#footnote-ref-6" data-footnote-backref aria-label="Back to reference 6">↩</a></p>
</li>
</ol>
</section>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[I'm making a commercial game!]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/making-a-commercial-game</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/making-a-commercial-game</guid>
        <pubDate>Wed, 21 Feb 2024 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p>Happy 2024!
I&#39;ve been making games since I was a child. For some time, being succesful looked like having a game on Desura, then being like the people from <a class="anchor" href="https://store.steampowered.com/app/207080/Indie_Game_The_Movie/" target="_blank">Indie Game: The Movie</a>, or at least having a game released on Steam, voted by people on <a class="anchor" href="https://steamcommunity.com/greenlight/" target="_blank">Greenlight</a>.</p>
<p>The end of 2022 marks the point where I started taking it much more seriously, with the release of <a class="anchor" href="https://store.steampowered.com/app/2210670/Torecower/" target="_blank">Torecower</a>, made by Cauê with me on Softwool and huge design touches by me, as the creation of the leaderboard, skill-tree redesign (thanks for the help, Gabriel &lt;3), maintaning the game and updating it still.</p>
<p>I started a lots of projects that &quot;this time is for real&quot;, but for the first time I now have a new work of my own with a steam page, and it is <a class="anchor" href="https://store.steampowered.com/app/2773700/Siege_n_Sow/" target="_blank">Siege &#39;n Sow</a></p>
<p><img src="https://github.com/coelhucas/coelhucas.github.io/assets/28108272/a870f761-edff-4ab8-9165-4077d5f721ee" class="post-image" alt="Me on a devlog thumbnail" title="Me on a devlog thumbnail"></img></p>
<p>Siege &#39;n Sow is a minimalist real-time strategy game with survival mechanics. So far the game only has an endless mode where enemies attack you after each day plus a first boss. You have to gather resources, expand your territory and create units in order to defend yourself from these attacks. The progression so far looks good, despite the boss being quite easy while I thought it would be challenging.</p>
<p>I want to post a bit more here and I thought that no other subject could be more interesting than sharing my &quot;&quot;first&quot;&quot; commercial game entirely designed by me. So far it has 426 wishlists: more than I expected, less than I wanted. Since I thought the first month would bring me 100 and we have this result in less than a month, I won&#39;t complain much. If you haven&#39;t already, please definitely add the game to your wishlist!</p>
<p>Without surprising anyone, I&#39;m making this game with Godot 4. The game arts are being made by my friend Hitsuji, capsule art by Nidhogg &amp; a new logo is on the making while I write this. So I&#39;m definitely not a &quot;solo-dev&quot; here.</p>
<p><img src="https://github.com/coelhucas/coelhucas.github.io/assets/28108272/42920e76-0299-4da2-a07e-8ec70b99dc00" class="post-image" alt="Screenshot of the first tests of the first boss" title="Screenshot of the first tests of the first boss"></img></p>
<p>Strategy games in general are my favorite since an early age when I went to LAN houses here in Brazil to play Warcraft 3, get to know Dota and played at home some games such as <a class="anchor" href="https://www.wesnoth.org/" target="_blank">The Battle for Wesnoth</a>. As well as some games that may not been designed to be strategic, like <a class="anchor" href="https://www.buildandshoot.com/" target="_blank">Ace of Spades (open source version known as Build &amp; Shoot</a>. This culminates in multiple prototypes I made for strategy games, mostly turn-based tactics or RTS. Since I enjoyed so much playing some of Sokpop ones I decided to give a try on something with a smaller scope, designed to be a &quot;micro&quot; RTS. In fact, you only control a single unit at a time.</p>
<p><img src="https://github.com/coelhucas/coelhucas.github.io/assets/28108272/efc864e1-9df6-4a1b-8567-caa85bebbe26" class="post-image" alt="Current planning on Trello" title="Current planning on Trello"></img></p>
<p>I&#39;m pretty happy with what I got so far. Right now the game was sent for some playtesters to record a gameplay so I can elaborate more some of the next steps based on the results of it. I&#39;m going to participate on a pretty eccentric MMO game jam this weekend so I&#39;ll have something else to think about as well. Hopefully I&#39;ll come back with some results to share.</p>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[I STILL want shorter games, with worse graphics made by people who are paid more to work less]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/shorter-games-with-worse-graphics</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/shorter-games-with-worse-graphics</guid>
        <pubDate>Thu, 03 Nov 2022 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p>The original tweet became sort of a trend some time ago, resulting even in a <a class="anchor" href="https://itch.io/b/737/the-shorter-games-with-worse-graphics-bundle" target="_blank">itch.io bundle</a> with tons of games<sup><a id="footnote-ref-1" href="#footnote-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup>, but at least for me, it seems that people aren&#39;t still taking about this.
I&#39;m not a person of dozens of hours gameplay time games and not also a game designer for those (although all my finished games are jam scoped ones, so I think I couldn&#39;t know if it was the case).</p>
<p>But as someone completely passionated about game development and indie games in general, it&#39;s a pitty to see a lot of talented people not getting enough credit for their work doing inovative and interesting stuff for being smaller.</p>
<p>Yeah, I know there are a lot of niches, but folks such as <a class="anchor" href="https://sokpop.itch.io/" target="_blank">Sokpop</a> and even smaller developers are doing great job on this, and even with some of their games getting a bit more reach (such as Simmiland, Soko Loco and Stacklands), there are much more left unseen.
Have you ever played King Pins, Guardener or Luckitown? They&#39;re lot of fun!</p>
<p>And if we go a bit deeper, Sokpop is already pretty popular and &quot;big&quot;, since they can work full-time on their games. We can search a bit more and find some stuff such as <a class="anchor" href="https://edgarmendoza.itch.io/help-no-brake" target="_blank"><strong>HELP! NO BRAKE</strong></a> and <a class="anchor" href="https://mmatt-ugh.itch.io/pup" target="_blank">PUP</a>, which brought me a nice enjoyment for around 30 and 10 minutes respectivelly and were really fun to play.</p>
<p><img src="https://user-images.githubusercontent.com/28108272/199767860-dedb4a3d-20f2-4baf-92b3-70c421bd7910.png" class="post-image" alt="HELP! NO BRAKE&#39;s ending room" title="HELP! NO BRAKE&#39;s ending room"></img></p>
<p>It would really nice to make a real profit and living from these, since most of these creative people have also other projects (for instance, from HELP! NO brake&#39;s creator I discovered also <em>hyper jump</em> and <em>golfito</em>, which were also fun — as someone who <strong>do</strong> enjoy these arcade-y games — to play).</p>
<p>You may think something such as &quot;yeah, but arcade isn&#39;t my thing&quot;, and well, nobody said the games should be &quot;simpler&quot;, <a class="anchor" href="https://thiago-avidos.itch.io/" target="_blank">Thiago Avidos</a>, for instance, makes games from Shmups to entire RPGs, such as <a class="anchor" href="https://thiago-avidos.itch.io/emo-quest-xd" target="_blank">Emo Quest XD</a> (which I couldn&#39;t play because I don&#39;t use Windows).
I&#39;m not going to say we should be selling all jam scoped games for $10 or something like that, but I really would want some way of sponsoring these developers and making their work profitable.</p>
<p><img src="https://img.itch.zone/aW1hZ2UvOTkxOTI0LzcyOTIzMTcucG5n/original/XOqvVO.png" class="post-image" alt="Thiago Avido&#39;s Emo Quest XD" title="Thiago Avido&#39;s Emo Quest XD"></img></p>
<p>Mentioining again Sokpop, they were the main reason behind the creation of <a class="anchor" href="https://softwool.co" target="_blank">Softwool</a>. Although I don&#39;t have something such as a &quot;dream game&quot;, <em>my dream is to make games</em>, so while I can&#39;t keep it up due to my full-time job, <a class="anchor" href="https://twitter.com/caueferrareto" target="_blank">Cauê</a>, a friend of mine, is working on his games while I help with the minimal need financially so we can move with this idea. Our goal, as Sokpop, is to create a base of followers focused on a plataform like Patreon.</p>
<p>It has been an interesting journey so far and we&#39;re closing to release our second game, <a class="anchor" href="https://softwool.itch.io/torecower" target="_blank">Torecower</a>.
Well, these were just some thoughts thrown here that I wanted to share, but I don&#39;t know. If you can, help sharing the small indie games you like, give some money directly to the creator if you can. And if you&#39;re an indie developer as well, maybe you can get your games together and make a bundle, or do it with other developers from the same niche you have, in order to make a profit on it and hopefully we can&#39;t stop depending on Steam for this. Who knows?</p>
<p><img src="https://user-images.githubusercontent.com/28108272/199770653-b6793739-12b8-4b50-81fe-2f9d70994a0c.png" class="post-image" alt="PUP&#39;s ending screen" title="PUP&#39;s ending screen"></img></p>
<section class="footnotes" data-footnotes>
<h2 id="footnote-label" class="sr-only">Footnotes</h2>
<ol>
<li id="footnote-1">
<p>Wanted to give a shout out specifically to Silent Bill. I LOVED the game, it&#39;s so funny and intriguing while it turns duck doodles into something scary on this point &#39;n click horror game
<a class="anchor" href="https://eatkin.itch.io/silent-bill-jam-version" target="_blank">https://eatkin.itch.io/silent-bill-jam-version</a> <a href="#footnote-ref-1" data-footnote-backref aria-label="Back to reference 1">↩</a></p>
</li>
</ol>
</section>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[Por que copiar código nas suas primeiras tarefas vai te sabotar?]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/copiar-codigo</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/copiar-codigo</guid>
        <pubDate>Thu, 16 Jun 2022 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p>Quando chegamos em um trabalho novo, normalmente temos um cuidado especial com nossas primeiras entregas e uma das práticas comuns é de se basear em código já existente, copiando ele como base.</p>
<p>Afinal, quem quer chegar fazendo tudo completamente diferente dos padrões que já estavam lá, né?
Pode parecer contra intuitivo dizer que isso é algo ruim na hora de se familiarizar com uma base de código, mas vamos destrinchar um pouco os porquês, usando como exemplo o lar das maiores aberrações do front-end... Testes unitários!</p>
<p>Esse é um lugar comum de se ver essa prática, já que uma minoria das pessoas que programam tem experiência relevante prévia com testes.<sup><a id="footnote-ref-1" href="#footnote-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup></p>
<div>
    <link rel="preload" fetchPriority="high" as="image" href="https://www.designer-daily.com/wp-content/uploads/2017/10/SZPjHwz.jpg" type="image/webp"></link>
    <img src="https://www.designer-daily.com/wp-content/uploads/2017/10/SZPjHwz.jpg" fetchPriority="high" loading="eager" class="post-image" type="image/webp" ></img>
  </div><center>

<p><sub><a class="anchor" href="https://www.designer-daily.com/a-collection-of-fake-programming-covers-61303" target="_blank">Fonte</a></sub></p>
</center>

<br />


    <h2 id=voc-n-o-sabe-os-porqu-s>
      <a name="voc-n-o-sabe-os-porqu-s" class="anchor-heading" href="#voc-n-o-sabe-os-porqu-s">
        Você não sabe os porquês
      </a>
    </h2><p>Quando você copia uma spec, por exemplo, substitui o componente renderizado pelo seu e faz algumas pequenas mudanças para que o teste passe, você não tem contexto nenhum do que tá acontecendo ali.</p>
<p>Um exemplo: certa vez eu fiz a adição da regra <a class="anchor" href="https://eslint.org/docs/rules/no-unused-expressions" target="_blank"><code>no-unused-expressions</code></a> em nosso projeto. Dentre vários códigos já existentes onde foi necessário corrigir o novo erro do lint, encontrei o seguinte trecho:</p>
<pre><code class="language-js">beforeEach(() =&gt; {
  jest.clearAllMocks;
});
</code></pre>
<p>Você consegue perceber o que tem de errado aí? Bom, se você não tem essa validação automática em seu projeto, é muito provável que você acabe deixando esse trecho passar no meio de outras 200 linhas de teste dentro de um diff.</p>
<p>O erro aí é simples: a linha <code>jest.clearAllMocks;</code> não faz nada, é apenas uma expressão solta por si só. Para ela fazer algo, teríamos que invocar o método <a class="anchor" href="https://jestjs.io/docs/jest-object#jestclearallmocks" target="_blank"><code>clearAllMocks</code></a> do jest:</p>
<pre><code class="language-diff">-- jest.clearAllMocks;
++ jest.clearAllMocks();
</code></pre>
<p>Isso já entrega outra questão: se os testes passavam sem a correção, nós nem precisamos do <code>clearAllMocks</code> nesse arquivo! Ele é redundante.</p>
<p>Esse trecho era replicado em diversos arquivos de testes diferentes de contexto relacionado, o que é um indício bem forte de que tenham sido resultados de uma primeira implementação do tipo seguida de diversas cópias.</p>
<blockquote class="quote"><p>Ok, mas isso daí é facilmente resolvido com uma configuração decente de linter, dava pra prevenir isso desde antes.</p>
</blockquote><p>Vamos então para outro exemplo: escrevendo um teste, fui olhar como o mock para uma biblioteca estava sendo feito e, notei que na linha onde é feito a chamada ao <code>requireActual</code>, havia um <code>@ts-ignore</code>, que ignora um erro do TSC na linha seguinte.</p>
<p>Achei estranho, porque na minha implementação havia o mesmo mock e eu não recebi nenhum erro do TSC. Decidi então tirar o comentário e, pra minha surpresa, não tinha erro nenhum ali a ser ignorado. Mais uma vez, dezenas de arquivos tinham o mesmo mock copiado e colado, todos com a mesma linha que não deveria nem existir. Esse tipo de coisa não é pego através de uma regra no linter. A menos que a gente bloqueie completamente o uso de <code>@ts-ignore</code>!</p>

    <h3 id=falta-de-senso-cr-tico>
      <a name="falta-de-senso-cr-tico" class="anchor-heading" href="#falta-de-senso-cr-tico">
        Falta de senso crítico
      </a>
    </h3><p>No momento que você começa a escrever um código e vai buscar referências, você está muito mais passível de notar discrepâncias de implementações que talvez não façam sentido.</p>
<p>Já quando a sua preocupação é &quot;copiar, colar e adaptar pra rodar&quot;, o seu foco é ver testes passando, provavelmente ignorando completamente detalhes da implementação.</p>
<p>Esse problema costuma mostrar sinais durante os code reviews, quando alguém questiona uma implementação estranha e a sua resposta for algo como:</p>
<blockquote class="quote"><p>Me baseei no código que já existia, que estava assim.</p>
</blockquote><blockquote class="quote"><p>ou</p>
</blockquote><blockquote class="quote"><p>{{ Pessoa }} que fez, só usei de referência.</p>
</blockquote><p>Isso é um argumento totalmente válido, principalmente se você está num momento mais de início de carreira, mas pode ser extremamente frustrante vindo de uma pessoa mais sênior, principalmente quando há dedos sendo apontados<sup><a id="footnote-ref-2" href="#footnote-2" data-footnote-ref aria-describedby="footnote-label">2</a></sup> sobre a pessoa &quot;responsável&quot; pelo código.</p>
<p>E o maior problema é que quanto mais fazemos esse tipo de coisa, mais acabamos nos inclinando pro lado de ter menos senso crítico e apenas aceitar as coisas como estão, o que é ruim para sua evolução técnica.</p>

    <h3 id=pr-ticas-descontinuadas-fora-do-padr-o>
      <a name="pr-ticas-descontinuadas-fora-do-padr-o" class="anchor-heading" href="#pr-ticas-descontinuadas-fora-do-padr-o">
        Práticas descontinuadas/fora do padrão
      </a>
    </h3><p>Talvez esse seja um dos mais frustrantes, já que você pode passar muito tempo trabalhando nas suas primeiras tarefas sem ajuda, pra receber uma enxurrada de comentários sobre práticas adotadas ou descontinuadas que &quot;ninguém te contou&quot;.</p>
<p>Elas podem até ter sido documentadas, ou acordadas pelo time em um canal obscuro no slack, mas talvez uma mensagem ou pair a mais pudesse ter te tirado dessa enrascada de &quot;assumir que está certo porque está assim em outro arquivo&quot; e só copiar como as implementações já são feitas.</p>

    <h3 id=conclus-o>
      <a name="conclus-o" class="anchor-heading" href="#conclus-o">
        Conclusão
      </a>
    </h3><p>No fim, copiar e colar pode acabar gerando um mau costume e, toda vez que você se deparar com algo que não entende, vai acabar copiando um trecho que faça funcionar, invés de entender o problema raiz ou como otimizar uma solução já existente.</p>
<p>E, apesar do título, a cópia sem muita atenção é um problema independentemente de ser sua primeira semana ou estar há anos em uma empresa.
Isso vai atrapalhar tanto você, quanto seus colegas que poderiam aprender também com questionamentos recebidos.</p>

    <h3 id=refer-ncias>
      <a name="refer-ncias" class="anchor-heading" href="#refer-ncias">
        Referências
      </a>
    </h3><ul>
<li><a class="anchor" href="https://en.wikipedia.org/wiki/Copy-and-paste_programming" target="_blank">Copy-and-paste programming</a></li>
<li><a class="anchor" href="https://world.hey.com/dhh/programmers-should-stop-celebrating-incompetence-de1a4725" target="_blank">Programmers should stop celebrating incompetence</a></li>
</ul>
<section class="footnotes" data-footnotes>
<h2 id="footnote-label" class="sr-only">Footnotes</h2>
<ol>
<li id="footnote-1">
<p>Carece de fontes. Dito a partir de experiências pessoais apenas. <a href="#footnote-ref-1" data-footnote-backref aria-label="Back to reference 1">↩</a></p>
</li>
<li id="footnote-2">
<p>Talk about the code, Not the Coder <a class="anchor" href="https://phauer.com/2018/code-review-guidelines/#talk-about-the-code-not-the-coder" target="_blank">https://phauer.com/2018/code-review-guidelines/#talk-about-the-code-not-the-coder</a> <a href="#footnote-ref-2" data-footnote-backref aria-label="Back to reference 2">↩</a></p>
</li>
</ol>
</section>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[twenty three]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/23</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/23</guid>
        <pubDate>Mon, 13 Dec 2021 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p>Exactly one week ago was my birthday. One day later I resigned from my job. Also, this month my partner started her first job as an UI/UX Designer. Lots of exciting stuff!</p>
<p>Today is my first day returning to therapy, after ignoring for years the psychologist&#39;s recommendation to see a psychiatrist, I&#39;ve been on desvenlafaxine for a little more than a month and I feel like if I already was another person. Today I also started reading <em>How to win friends and influence people.</em>, which was suggested by my former manager.</p>
<p>As Charley Bradley sang, <a class="anchor" href="https://open.spotify.com/track/1fOc4Kf82a6J1C9gS5sE0d?si=35900ea08b444b2f" target="_blank">I&#39;m going through changes</a>.</p>
<p>I decided to get this end of year to focus on my mind and do whatever I want (inside my home, since pandemic) and give more attention to my <strong>five</strong> cats. I already know my next steps and where I&#39;ll be working on, but I like being able to not having to worry about next steps or doing interviews for other companies.</p>
<p>I&#39;m so happy to see how much my partner grew and achieved her objective, I am also happy from the lots of things that I learned and how much I improved both in hard and soft-skills while in Gympass. Working on Yoga, which is an open-source design system was also one of the best work experiences I had on a project. But I&#39;m excited to what is coming know. I already have some plans for my  &quot;vacations&quot; (until Jan. 3rd)</p>
<ul>
<li>Finish at least two of the three new books I got</li>
<li>Focus on therapy and understanding more and more my head</li>
<li>Study some interesting computer stuff regardless of being related to my daily job</li>
<li>Maybe even make some smol toy-project using some different tech</li>
</ul>
<p>What I&#39;ve most been struggling of so far is when it comes to dealing with people daily and not feeling comfortable being who I am in front of others/my appearence, I hope a year from now those aren&#39;t problems to me.</p>
<p>And what I&#39;ve been most proud of is how I advanced regarding talking to other people. Even it is far from what I want to achieve, I feel I am much better with this. I am not a people person and I doubt this will ever change, but this doesn&#39;t means I have to be a mean person.</p>
<p>I came back with my writing habit, I&#39;ve migrated my old (digital) notes to obsidian.md and have been using it the last few months and have no regrets so far, I love this concept of a &quot;second brain&quot;. In fact, this is being write inside Obsidian and I&#39;m liking the experience.</p>
<p>Writing this also made me realize that I need to make this a proper blog ASAP. Maybe a good way to experiment <a class="anchor" href="https://remix.run/" target="_blank">Remix</a> a bit?</p>
<p>I separated some photos that I sorted from oldest -&gt; newest:</p>
<p><img src="https://user-images.githubusercontent.com/28108272/145899013-70e2933c-8cf1-4e10-aab8-1e35258c9333.png" class="post-image" alt="" title=""></img> <img src="https://user-images.githubusercontent.com/28108272/145899081-2578ceef-cc7c-41dc-97bf-b41c4654661d.png" class="post-image" alt="" title=""></img> <img src="https://user-images.githubusercontent.com/28108272/145899106-caca3d91-af20-4c42-be55-35e99e7f3d21.png" class="post-image" alt="" title=""></img>
<img src="https://user-images.githubusercontent.com/28108272/145899119-7acb71a1-288e-45c6-9a1d-956afb76b248.png" class="post-image" alt="" title=""></img></p>
<p><img src="https://user-images.githubusercontent.com/28108272/145899145-c351e3ce-f2f3-4ece-9076-77d13bb5376e.png" class="post-image" alt="" title=""></img></p>
<p><img src="https://user-images.githubusercontent.com/28108272/145899171-2b6d2d59-2ca7-432e-8a29-02338b0b7bce.png" class="post-image" alt="" title=""></img></p>
<p><img src="https://user-images.githubusercontent.com/28108272/145899182-42d9dd6b-a367-474b-aef9-bb7f4c04aa2b.png" class="post-image" alt="" title=""></img></p>
<p>My 23 birthday</p>
<p><img src="https://user-images.githubusercontent.com/28108272/145899197-cd04c047-1402-4643-81e5-d31212228c75.png" class="post-image" alt="" title=""></img></p>
<p>Next gig&#39;s party where I felt comfortable to use some clothes I had for the first time</p>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[Reduce — JavaScript]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/reduce-javascript</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/reduce-javascript</guid>
        <pubDate>Sat, 16 Oct 2021 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p>Eu demorei bastante a entender como o reduce funciona, mais do que eu “me orgulho”. Mas tá tudo bem. Não é algo que você necessariamente precisa usar todos os dias. Embora algo aqui e acolá poderia ser simplificado com um uso do reduce, nos momentos em que nós não sabíamos disso provavelmente nos viramos de outra forma.</p>
<div>
    <link rel="preload" fetchPriority="high" as="image" href="https://miro.medium.com/max/1400/1*x_MQsBFxPHbWF0nE5xNr1A.jpeg" type="image/webp"></link>
    <img src="https://miro.medium.com/max/1400/1*x_MQsBFxPHbWF0nE5xNr1A.jpeg" fetchPriority="high" loading="eager" class="post-image" type="image/webp" ></img>
  </div><center>

<p><sub>Foto por <a class="anchor" href="https://unsplash.com/@cravethebenefits" target="_blank">Brenda Godinez</a> no <a class="anchor" href="https://unsplash.com/s/photos/fruit-salad" target="_blank">Unsplash</a></sub></p>
</center>
<br/>

<p>Dependendo da sua bolha e redes sociais, provavelmente você já viu aquele clássico exemplo mostrando diversos emojis de fruta em um array e como o reduce de fato “reduz” o array a uma salada de frutas. É um exemplo bonitinho de ser ilustrado, mas não dá nenhuma ajuda real.</p>
<p>De forma curta, isso é uma implementação do reduce:</p>
<pre><code class="language-js">const arr = [1, 2, 3, 4, 5, 6];
const sum = arr.reduce((acc, current) =&gt; acc + current);
</code></pre>
<p>exemplo simples de reducer que soma os valores de um array</p>
<p>E pode ser outro exemplo dos que encontramos facilmente em todo lugar. De todo modo, vamos incrementando aos poucos!</p>
<p>O reduce, tal qual <a class="anchor" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" target="_blank">.map()</a>, <a class="anchor" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter" target="_blank">.filter()</a>, <a class="anchor" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach" target="_blank">.forEach()</a> e outros, realizam uma iteração em um Array, com a diferença de que o reduce espera que a partir do seu array você gere um único valor.</p>
<p>No trecho de código acima, o que chamamos de <em>acc</em> ou accumulator (acumulador) é o valor anterior da iteração, que vai começar como o valor inicial do seu array<sup><a id="footnote-ref-1" href="#footnote-1" data-footnote-ref aria-describedby="footnote-label">1</a></sup> (nesse exemplo, o 1). Enquanto isso, <em>current</em> é o valor atual da iteração, que nesse início vai ser o segundo elemento (o 2)<sup><a id="footnote-ref-2" href="#footnote-2" data-footnote-ref aria-describedby="footnote-label">2</a></sup>.</p>
<p>Podemos pensar então na execução desses passos da seguinte forma:</p>
<pre><code class="language-js">// 1 (valor inicial), 2 (valor atual) -&gt; 1 + 2
// 3 (valor anterior), 3 (valor atual) -&gt; 3 + 3
// 6 (valor anterior), 4 (valor atual) -&gt; 6 + 4
// 10 (valor anterior), 5 (valor atual) -&gt; 10 + 5
// 15 (valor anterior), 6 (valor atual) -&gt; 15 + 6

console.log(sum); // 21
</code></pre>
<p><sub>exemplo do que está acontecendo no código</sub></p>
<pre><code class="language-js">const arr = [1];
cont result = arr.reduce((acc, current) =&gt; 2 * (acc + current));
</code></pre>
<p><sub>exemplo simples de reducer que irá retornar o único valor do array</sub></p>
<p>Mesmo que o retorno seja duas vezes a soma do acumulador e o valor atual, o retorno será 1. Isso porque ele nem estará sendo performado.</p>
<p>O <a class="anchor" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce" target="_blank">.reduce()</a> também aceita como segundo parâmetro um valor inicial. Nesse caso, invés do primeiro elemento ele irá começar desse seu valor inicial:</p>
<pre><code class="language-js">const arr = [1, 2, 3, 4, 5, 6];
const sum = arr.reduce((acc, current) =&gt; acc + current, 10);

console.log(sum); // 31
</code></pre>
<p>Caso você quisesse obter o mesmo resultado acima sem usar um reduce por exemplo, você teria algo assim:</p>
<pre><code class="language-js">const arr = [1, 2, 3, 4, 5, 6];

let sum = 10;
arr.forEach((value) =&gt; {
  sum += value;
});

console.log(sum); // -&gt; 31
</code></pre>
<p><sub>exemplo paralelo, usando forEach</sub></p>

    <h2 id=reducer-callback>
      <a name="reducer-callback" class="anchor-heading" href="#reducer-callback">
        Reducer callback
      </a>
    </h2><p>Eu mencionei um pouco acima sobre a função ‘reducer’, que é a que você passa ao chamar <a class="anchor" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce" target="_blank">.reduce()</a>, mas ela vai além dos exemplos usados. Essa callback pode receber 4 parâmetros:</p>
<ul>
<li>(1) Valor anterior, (2) valor atual, (3) índice atual e (4) array.</li>
</ul>
<p>Os dois primeiros já foram explicados. Os dois últimos são ainda mais simples: o <em>índice atual</em> se refere (claro) ao índice do <em>valor atual,</em> isso significa que ele irá sempre começar em 1, que é o <em>segundo elemento</em><sup><a id="footnote-ref-3" href="#footnote-3" data-footnote-ref aria-describedby="footnote-label">3</a></sup> do seu array. Já o array, é simplesmente o array que “está sendo reduzido”. No exemplo inicial: [1, 2, 3, 4, 5, 6].</p>

    <h2 id=mas-qual-a-relev-ncia-desses-outros-par-metros->
      <a name="mas-qual-a-relev-ncia-desses-outros-par-metros-" class="anchor-heading" href="#mas-qual-a-relev-ncia-desses-outros-par-metros-">
        Mas qual a relevância desses outros parâmetros?
      </a>
    </h2><p>Vamos supôr que você tenha um reducer complexo. Por organização, é bom mantê-lo separado para facilitar a manutenção. Neste caso, você precisa de uma forma de acessar o array recebido:</p>
<pre><code class="language-js">const reducer = (accumulator, current, currentIndex, array) =&gt; {
  const prefix = currentIndex === array.length - 1 ? &#39;e &#39; : &#39;, &#39;;
  return `${accumulator}${prefix}${current}`;
}

function getJoinedNames(names) {
  return names.reduce(reducer);
}

console.log(getJoinedNames([&#39;zezinho&#39;, &#39;luizinho&#39;, &#39;iguinho&#39;)]); // &#39;zezinho, luizinho e iguinho&#39;
</code></pre>
<p><sub>exemplo simples de reducer que une um array de strings</sub></p>
<p>Este exemplo é puramente didático, não deve ser tratado como a melhor forma de resolver esse tipo de problema.</p>
<p>Mas antes: o que esse trecho nos resolve?</p>
<ul>
<li>Preciso que dado um input como [‘nome1’, ‘nome2’, ‘nome3’], eu consiga uma string como “nome 1, nome2 e nome3”.</li>
</ul>
<p>Durante a iteração, foram usados os parâmetros currentIndex e array para descobrir se o elemento atual é o último, para assim definir se o prefixo será uma separação por vírgula ou por ‘e ‘. É importante que nós tenhamos acesso a essas informações mesmo em exemplos como esse, onde o reducer está fora do escopo da função e não sabe o que é o array original. É claro que nesse caso seria mais simples só manter o reducer no escopo da função, mas como mencionei, esse exemplo foi feito para fins didáticos.</p>

    <h2 id=caso-de-uso-real>
      <a name="caso-de-uso-real" class="anchor-heading" href="#caso-de-uso-real">
        Caso de uso real
      </a>
    </h2><p>Recentemente, fiz a adição de uma funcionalidade que permite a criação de temas customizados para o nosso Design System no Gympass, o <a class="anchor" href="https://github.com/gympass/yoga" target="_blank">Yoga</a>. Dentre as adições, houveram mudanças em código existente e <a class="anchor" href="https://github.com/Gympass/yoga/pull/344#discussion_r715692311" target="_blank">uma das sugestões no review do meu pull request</a> era a reescrita de um forEach para usar um reducer. Se você quiser ver o código, é só vir aqui: <a class="anchor" href="https://github.com/Gympass/yoga/pull/344/files#diff-d3a48eaff212c882790981d6bd71346ba9117a400a89f4ed625c4c4fad2a59e4R7-R22" target="_blank">diff</a>.</p>
<p>Pra evitar trazer toda a complexidade e contexto envolvidos, vou fazer um exemplo diferente aqui:</p>
<pre><code class="language-js">const components = [
  {
    name: &quot;Button&quot;,
    styles: {
      color: &quot;white&quot;,
      backgroundColor: &quot;black&quot;,
      borderRadius: &quot;20px&quot;,
    },
  },
  {
    name: &quot;TextInput&quot;,
    styles: {
      color: &quot;black&quot;,
      border: &quot;2px solid&quot;,
    },
  },
  {
    name: &quot;Checkbox&quot;,
    styles: {
      color: &quot;deeppink&quot;,
    },
  },
];

const getComponentsMetadata = () =&gt;
  components.reduce(
    (acc, current) =&gt; ({
      ...acc,
      [current.name]: {
        ...current.styles,
      },
    }),
    {},
  );
</code></pre>
<p><sub>exemplo mínimo de como usamos o reduce em um projeto real</sub></p>
<p><strong>Resumindo:</strong> dado o array que temos no código, o retorno vai ser um objeto nesse formato:</p>
<pre><code class="language-js">{
  Button: {
    color: &quot;white&quot;,
    borderRadius: &quot;20px&quot;,
    backgroundColor: &quot;black&quot;
  },
  TextInput: { … },
  CheckBox: { … }
}
</code></pre>
<p><sub>(resumido com { … }, a ideia é a mesma)</sub></p>
<p>Antes isso era feito com um forEach, que tal como o reduce itera um array, mas não é feito para manipulações exatamente. O código original, que criava um objeto vazio que sofria mutações durante a iteração como:</p>
<p><code>components[field] = { ...components[index].styles }</code></p>
<p>Já com o reduce, temos apenas um novo objeto criado a partir de um array que não realizou mutações a nenhuma variável.</p>
<p>Há “controvérsias” e nem todo mundo acha que usar o reduce é um ganho. Mas ao menos, agora você tem essa ferramenta no seu canivete suíco.</p>
<section class="footnotes" data-footnotes>
<h2 id="footnote-label" class="sr-only">Footnotes</h2>
<ol>
<li id="footnote-1">
<p>Caso você passe um valor inicial no seu reducer, esse comportamento é diferente, isso será mostrado mais abaixo. <a href="#footnote-ref-1" data-footnote-backref aria-label="Back to reference 1">↩</a></p>
</li>
<li id="footnote-2">
<p>O seu array pode ter apenas um elemento, mas nesse caso, indiferentemente do retorno do seu reducer (a função que passamos dentro do reduce), o valor vai ser o único contido dentro do array original. Dado o seguinte trecho de código: <a href="#footnote-ref-2" data-footnote-backref aria-label="Back to reference 2">↩</a></p>
</li>
<li id="footnote-3">
<p>Caso você não tenha passado um segundo parâmetro definindo o valor inicial. <a href="#footnote-ref-3" data-footnote-backref aria-label="Back to reference 3">↩</a></p>
</li>
</ol>
</section>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[Resolving Godot mouse position inside stretched viewport + custom camera]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/resolve-godot-mpos-viewport-camera</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/resolve-godot-mpos-viewport-camera</guid>
        <pubDate>Wed, 02 Jun 2021 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[
    <h2 id=problem-with-scaled-viewport>
      <a name="problem-with-scaled-viewport" class="anchor-heading" href="#problem-with-scaled-viewport">
        Problem with scaled Viewport
      </a>
    </h2><p>Long time no see.
I was fooling around with Godot, using a Viewport to contain a game in smaller resolution (480x270), while my interface could have better resolution, until I noticed that using this structure (a <code>ViewportContainer</code> stretching a <code>Viewport</code>), my <code>look_at(get_global_mouse_position())</code> lost accurate.</p>
<p><img src="https://user-images.githubusercontent.com/28108272/120564020-591b8b00-c3e0-11eb-9c2d-23719d6f7c94.gif" class="post-image" alt="Jun-02-2021 20-22-54" title="Jun-02-2021 20-22-54"></img></p>
<p>The first solution was to calculate my scale factor (how many X my viewport is scaled). I got this by doing:</p>
<pre><code class="language-gdscript">var _scale_factor := OS.window_size / get_viewport().size
</code></pre>
<p>Considering that I had a viewport of (480, 270) and my default resolution (as also size of its <code>ViewportContainer</code>) was twice this value (960, 540), the scale factor is 2 for both x and y.</p>
<p>It&#39;s still unclear to me the exact reason of this. Considering that the global mouse position is the same regardless of calling it from inside the Viewport or not, since the original Viewport had half its size, it seems that needed to take it in account as a way of converting these coordinates to its values scaling the same as the resolution.</p>
<p><strong>P.S.:</strong> You have to &#39;recalculate&#39; this factor every time the window size is changed to guarantee it&#39;s right.</p>

    <h2 id=using-a-camera>
      <a name="using-a-camera" class="anchor-heading" href="#using-a-camera">
        Using a Camera
      </a>
    </h2><p>This pretty much solves the problem, if you assure that this <code>get_viewport()</code> is always your &#39;custom&#39; Viewport, not the default one Godot makes as every game root.</p>
<p>The problem then starts after I added a Camera to my player. As you can see, as far as I move further from the scene starting point, things start getting odd again.</p>
<p><img src="https://user-images.githubusercontent.com/28108272/120564802-1490ef00-c3e2-11eb-8065-c37c2f837a31.gif" class="post-image" alt="Jun-02-2021 20-35-22" title="Jun-02-2021 20-35-22"></img></p>
<p>The change was still simple. This time, when operating <code>get_global_mouse_position</code>, I had to also remove the origin of Viewport&#39;s <code>canvas_transform</code>. The final snippet looks something like that:</p>
<pre><code class="language-gdscript"># Scale factor is still calculated as above
# [...]

var _resolved_mpos := (get_global_mouse_position() - get_viewport().canvas_transform.origin) / _scale_factor
my_node.look_at(_resolved_mpos)
</code></pre>
<p><img src="https://user-images.githubusercontent.com/28108272/120565409-5cfcdc80-c3e3-11eb-9305-855d241e3298.gif" class="post-image" alt="Jun-02-2021 20-40-56" title="Jun-02-2021 20-40-56"></img></p>
<p>At the end, I won&#39;t even use this &quot;gun&quot; in the project. At least I know how to solve this kind of problem just in case. Also, feel free to comment on a deeper explanation behind all that. Although I got it solved pretty intuitively for me, the issue isn&#39;t entirely clear.</p>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[Por que você não deveria apresentar seu conhecimento de tecnologias com números e porcentagens]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/conhecimento-tech-numeros-porcentagens</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/conhecimento-tech-numeros-porcentagens</guid>
        <pubDate>Mon, 11 Jan 2021 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[<p>Você com certeza já deve ter se deparado com um currículo (ou talvez seja o seu próprio) onde nos conhecimentos técnicos a pessoa listou algo como:</p>
<ul>
<li><strong>Javascript</strong>: 2/5</li>
<li><strong>React</strong>: 4/5</li>
<li><strong>Node</strong>: 5/5</li>
</ul>
<p>Além de não dizer nada para quem está avaliando, muitas vezes são contraditórios os exemplos acima e os números atribuídos à cada.</p>
<p><img src="https://miro.medium.com/max/1400/0*3XrM2yqii3CbMGRl" class="post-image" alt="" title=""></img></p>
<p><sub>Foto por <a class="anchor" href="https://unsplash.com/@glencarrie" target="_blank">Glen Carrie</a> no <a class="anchor" href="https://unsplash.com" target="_blank">Unsplash</a></sub></p>

    <h2 id=o-que-saber-5-5-sobre-uma-tecnologia->
      <a name="o-que-saber-5-5-sobre-uma-tecnologia-" class="anchor-heading" href="#o-que-saber-5-5-sobre-uma-tecnologia-">
        O que é saber 5/5 sobre uma tecnologia?
      </a>
    </h2><p>É ter toda a API decorada? Entender todo o código fonte? Conseguir desenvolver qualquer coisa usando a ferramenta sem dificuldades?</p>
<p>Podemos pegar qualquer tecnologia de código aberto como exemplo. Elas podem possuir de dezenas à milhares de pessoas contribuindo.</p>
<p>Claramente, os responsáveis pela concepção de seja lá qual linguagem, framework ou ferramenta, já não tem o entendimento pleno de toda a criação há muito tempo. <a class="anchor" href="https://github.com/gaearon" target="_blank">Dan Abramov</a> certamente não diria que sabe &quot;5/5&quot; ou &quot;100%&quot; de Redux, visto que momento em que escrevo isso, o repositório conta com mais de <a class="anchor" href="https://github.com/reduxjs/redux/graphs/contributors" target="_blank">800</a> contribuidores, diversas adições e modificações.</p>
<p><em>Os números ou porcentagens que você atribui ao seu conhecimento, não são valores tangíveis, pois não há uma escala que define o que é barrinha cheia ou vazia.</em></p>

    <h2 id=como-eu-apresento-meus-conhecimentos-ent-o->
      <a name="como-eu-apresento-meus-conhecimentos-ent-o-" class="anchor-heading" href="#como-eu-apresento-meus-conhecimentos-ent-o-">
        Como eu apresento meus conhecimentos, então?
      </a>
    </h2><p>Você entender pouco ou muito de algo, é o de menos em um PDF ou pedaço de papel. Durante uma entrevista técnica, você não vai ter como &quot;enganar&quot; ninguém.</p>
<p>Além disso, um funcionário Pleno da empresa X pode ser considerado Sênior na Y, ou Júnior na Z. São contextos diferentes e é bem difícil o entendimento sobre básico/avançado ser igual em todos os lugares.</p>
<p>Então, em vez de colocar algo que não te define realmente de forma técnica, por que não exemplificar o que já fez com cada tecnologia de forma breve? Você não precisa ter um emprego prévio para poder experimentar tecnologias. Por isso é importante a criação de projetos pessoais. Com eles você pode deixar claro como e o que usou durante a criação.</p>

    <h2 id=exemplo>
      <a name="exemplo" class="anchor-heading" href="#exemplo">
        Exemplo
      </a>
    </h2><p><em>React:</em> Conceitos de criação de projeto em React sem nenhuma toolchain pronta. Entendimento sobre o que são e como usar um compilador (Babel) e um bundler (Webpack). Conhecimentos como <a class="anchor" href="https://en.wikipedia.org/wiki/Tree_shaking" target="_blank">tree shaking</a> e <a class="anchor" href="https://developer.mozilla.org/en-US/docs/Glossary/Code_splitting" target="_blank">code splitting</a>. <strong><em>&lt;Link para o repositório do projeto&gt;</em></strong></p>
<p>Eu fiz questão de destacar o link para o repositório. O Github é nosso maior portfólio, independente de discussões ou polêmicas acerca disso, nós seremos julgados por essa capa. Então deixe seus projetos à mostra, um LEIAME claro sobre a proposta do projeto, como rodá-lo localmente e sempre que possível uma versão usável dele. Faz sentido ter imagens sobre o resultado final ou uma descrição breve sobre a API e como usá-la? Não deixe de fora.</p>
<p>No Github também é possível fixar os repositórios que considerar mais relevantes no seu perfil. Eu recomendo, caso você tenha, focar nessa área aqueles que fez por querer, por gostar, para algum uso pessoal ou que tem mais orgulho. Estes são os que se destacam daqueles projetos genéricos de um bootcamp que todo mundo tem igual.</p>
<p>Se você olhar o meu <a class="anchor" href="https://github.com/coelhucas" target="_blank">Github</a>, por exemplo, mesmo que eu atue como front-end, nenhum dos projetos fixados tem relação com a área, mas com outras coisas que gosto mais de fazer no tempo livre. E normalmente esses são meus projetos mais comentados e discutidos em processos seletivos.</p>
<p>Por que moldar nossa apresentação para fora do que realmente gostamos?</p>

    <h2 id=observa-es>
      <a name="observa-es" class="anchor-heading" href="#observa-es">
        Observações
      </a>
    </h2><ul>
<li>Não existe uma fórmula mágica, tudo aqui é como eu enxergo, sugestões baseadas no que tento fazer e vejo funcionar normalmente.</li>
<li>Complementando à observação acima, acho bom deixar claro que sou apenas mais um programador, no fim das contas. Tenho muito a aprender e evoluir, que é o que tento fazer sempre. Você não deve entender nada do que lê como verdade absoluta, independente do quão incrível seja a sigla ou nome do cargo da pessoa. Amanhã, tudo que conhecemos como boas práticas pode ser o jeito errado de se fazer as coisas. E é assim que evoluímos.</li>
<li>Eu poderia provavelmente crescer exponencialmente este texto escrevendo sobre a parte do Github, como se vender e se apresentar através dele. Mas muita gente já fez isso e é algo relativamente pessoal, que acabaria tirando o foco da mensagem a ser passada.</li>
</ul>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[Integrating Godot WebSocketClient with your Custom Server]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/integrating-godot-websocket-client</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/integrating-godot-websocket-client</guid>
        <pubDate>Thu, 05 Nov 2020 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[
    <h2 id=intro>
      <a name="intro" class="anchor-heading" href="#intro">
        Intro
      </a>
    </h2><p>Every now and then, when I share some proof of concept or demo of a multiplayer project, someone asks me something about how do I integrate Godot with my own server. I&#39;ve been using WebSockets. I&#39;ll explain here how can you achieve the same, using Node as an example.</p>
<p>This works with:</p>
<table>
<thead>
<tr>
<th>Tool</th>
<th align="center">Version</th>
</tr>
</thead>
<tbody><tr>
<td>Godot</td>
<td align="center">&gt;= 3.x</td>
</tr>
<tr>
<td>Node</td>
<td align="center">&gt;= v12.x</td>
</tr>
</tbody></table>
<p>Basic WebSockets comunication between Godot and Node.</p>

    <h2 id=setup>
      <a name="setup" class="anchor-heading" href="#setup">
        Setup
      </a>
    </h2><ul>
<li>In server side, I&#39;ll be using <a class="anchor" href="https://github.com/websockets/ws" target="_blank">ws</a>. I&#39;m considering that you&#39;re already familiar with node and knows how to use a <a class="anchor" href="https://en.wikipedia.org/wiki/Package_manager#:~:text=A%20package%20manager%20or%20package,system%20in%20a%20consistent%20manner." target="_blank">package manager</a> and <a class="anchor" href="https://classic.yarnpkg.com/en/docs/cli/add/" target="_blank">add dependencies</a> into a node project.</li>
<li>Godot has the WebSocket API since 3.X, so any version should work until we have big changes --- 4.0, I&#39;m looking at you.</li>
</ul>

    <h2 id=hands-on>
      <a name="hands-on" class="anchor-heading" href="#hands-on">
        Hands on
      </a>
    </h2><p>Using <code>ws</code> you can setup a simple server  just by doing</p>
<pre><code class="language-js">// your_file.js
const WebSocket = require(&#39;ws&#39;);
const PORT = 1234;
const wss = new WebSocket.Server({ port: PORT });
</code></pre>
<p>Just to make sure that everything is working fine, add already some basic WebSocket server callbacks to test everything later.</p>
<pre><code class="language-js">// your_file.js
// [...]
wss.on(&#39;connection&#39;, (ws) =&gt; {
    console.log(&#39;Client connected&#39;);

    ws.on(&#39;message&#39;, (msg) =&gt; {
        // I&#39;ll be sending messages as JSON strings later, that&#39;s why I&#39;ll call this way.
        console.log(JSON.parse(msg));
    });
});
</code></pre>
<p>Jumping to the client side, in Godot, I&#39;ll create a script called <code>Network.gd</code>and add as an <code>AutoLoad</code>. And there I&#39;ll add the following:</p>
<pre><code class="language-swift">// Network.gd
# // [...]

const PORT: int = 1234
const URL: String = &quot;ws://localhost:%s&quot; % PORT

var client: WebSocketClient

func _ready() -&gt; void:
    client = WebSocketClient.new()
    client.connect_to_url(URL)
    var err := client.connect(&quot;data_received&quot;, self, &quot;_on_received_data&quot;)
    pass

func _process(_delta: float) -&gt; void:
    client.poll()

func _on_received_data() -&gt; void:
    # // Well catch our server messages here.
    pass
</code></pre>
<p>Polling is one of the most important parts. If you don&#39;t keep the client polling you won&#39;t get any packet data from server.</p>
<p>At the moment, if you run your Godot project just like this, with your node server running, you&#39;ll get the log (in node) as expected.</p>
<pre><code>Client connected
</code></pre>
<p>To establish basic comunication, one can update the Network.gd to send a message to the server after a successful connection.</p>
<pre><code class="language-swift"># // Network.gd
# // [...]

func _ready() -&gt; void:
    # // [...] what you already have
    err = client.connect(&quot;connection_established&quot;, self, &quot;_on_connected&quot;)

# // [...]]

func _on_connected(_protocol: String) -&gt; void:
    var message: Dictionary = {
        type = 0,
        text = &quot;hello, server!&quot;
    }
    # // Here we&#39;ll convert the message object to a PoolByteArray, by generating
        # // a string from the object and then using the String method &#39;to_utf8()&#39;
    var packet: PoolByteArray = JSON.print(message).to_utf8()
    # // .get_peer(1) is called to get the connected server peer.
    client.get_peer(1).put_packet(packet)
</code></pre>
<p>Running again, you should see the data appear server-side.
The dictionary I wrote to send this packet was random. <code>type</code> field just simulates some kind of packet  type handling where in real life you&#39;ll probably use some enum or other data structure to store the information.</p>
<p>Expecting a response from our server, lets prepare the client function to handle incoming data. We&#39;ll handle this in the <code>_on_received_data function</code>.</p>
<pre><code class="language-swift"># // Network.gd
# // [...]

func _on_received_data() -&gt; void:
    var packet: PoolByteArray = client.get_peer(1).get_packet()
    var parsed_data: Dictionary = JSON.parse(packet.get_string_as_utf8()).result
    print(parsed_data)

# // [...]
</code></pre>
<p>As expected, we read the data in the format it was sent. We get our <code>utf8</code> string, and then parse this string into JSON. If the message sent from server isn&#39;t valid JSON, it&#39;ll break during runtime. You can add error handling here for faulty data.
Also, I&#39;m not going to do nothing with this data, after you parse it you are able to handle the way you want to.</p>
<p>To make server really send something now, we can use the <code>connection</code> callback.</p>
<pre><code class="language-js">// your_file.js
// [...]

ws.on(&#39;connection&#39;, (ws) =&gt; {
    const packet = JSON.stringify({
        type: 1,
        message: {
            text: &#39;hello, client!&#39;
        }
    })
    ws.send(packet);
    // [...]
}
</code></pre>
<p>Finally, this will give you the following output:</p>
<pre><code class="language-json">// node:
{ &quot;type&quot;: 0, &quot;text&quot;: &quot;hello, server!&quot; }

// godot console:
{&quot;message&quot;:{&quot;text&quot;:&quot;hello, client!&quot;}, &quot;type&quot;:1}
</code></pre>
<p>With that, you have basic comunication between Godot and your Node server. You can also use this as a reference to implementing a server in any other language, considering the syntax and workflow changes, of course.</p>

    <h2 id=further-reading-material>
      <a name="further-reading-material" class="anchor-heading" href="#further-reading-material">
        Further reading material
      </a>
    </h2><ul>
<li><a class="anchor" href="https://en.wikipedia.org/wiki/WebSocket" target="_blank">WebSocket</a> - just in case you don&#39;t understand this protocol yet.</li>
<li><a class="anchor" href="https://gafferongames.com/" target="_blank">Gaffer On Games</a> - literally every post here;</li>
<li><a class="anchor" href="https://developer.valvesoftware.com/wiki/Latency_Compensating_Methods_in_Client/Server_In-game_Protocol_Design_and_Optimization" target="_blank">Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization</a> - you&#39;ll have to mess with this sometime.</li>
</ul>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[Implementing a finite state machine in Godot Engine (v3.X)]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/implementing-fsm-godot</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/implementing-fsm-godot</guid>
        <pubDate>Sat, 26 May 2018 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[
    <h2 id=introduction>
      <a name="introduction" class="anchor-heading" href="#introduction">
        Introduction
      </a>
    </h2><p>  I want to talk about how can you implement a FSM (finite state machine) in Godot Engine. This implementation is based in my own experienced at the time I started learning Game Maker, which was when I used it for the first time.
  If you don&#39;t know what is a FSM in general, I suggest you to <a class="anchor" href="https://en.wikipedia.org/wiki/Finite-state_machine" target="_blank">read this</a>, because the focus of this article is just to show how can you implement that.</p>

    <h2 id=some-use-cases>
      <a name="some-use-cases" class="anchor-heading" href="#some-use-cases">
        Some use cases
      </a>
    </h2><p>  In games, there&#39;s several uses of state machines. Here&#39;s some examples:</p>
<ul>
<li><p>To define how an entity will act based in its states, which are changed accordingly to some conditions: An enemy, by default, does a patrol movement. If the player enters its fov, the state becomes engage, for when the enemy gets closer, its state will change to attack, where the enemy behaviour are completely different.</p>
</li>
<li><p>Game State: in your game state you save every relevant data, as the player position, their items in inventory, in which map they are, what areas they already unlocked. It&#39;s what your emulator saves and loads in the game state section, in fact. This is a common way to make a save/load system.</p>
</li>
</ul>

    <h2 id=implementation>
      <a name="implementation" class="anchor-heading" href="#implementation">
        Implementation
      </a>
    </h2><p>  You can implement this the way you want, even a simple string to define your state.</p>
<pre><code class="language-gdscript">func _physics_process(delta):
    match state:
        &quot;moving&quot;:
            _handle_platformer_movement()
        &quot;climbing&quot;:
            _handle_climbing_movement()
</code></pre>
<p>*If you doesn&#39;t understand what is the <code>match</code> statement, <a class="anchor" href="https://docs.godotengine.org/en/3.1/getting_started/scripting/gdscript/gdscript_basics.html#match" target="_blank">read this</a>.</p>
<p>It&#39;s a functional implementation, but not the nicest one.
We can replace this with an enumerator, which is faster to compare and type safe, which is easier to maintain.</p>
<pre><code class="language-gdscript"># You can just setup an enum
enum {
    IDLE,
    MOVING,
    CLIMBING
}
var state: int = IDLE

# Or name it
enum states = { IDLE, MOVING, CLIMBING }
var other_state: int = states.IDLE
</code></pre>
<p>Both will work. I&#39;ll keep the first one.
The type of <code>state</code> and <code>other_state</code>, I defined as <code>int</code>. If you doesn&#39;t understand how an enum works, I suggest you <a class="anchor" href="https://www.thoughtco.com/what-is-an-enum-958326" target="_blank">reading this</a>.
In resume, they&#39;ll be treated as integers starting from zero. You can change it&#39;s order and it&#39;ll not affect your code, since the value will change but what you&#39;re using are the named constants.</p>
<p>Then the result would be:</p>
<pre><code class="language-gdscript">extends Node

enum {
    IDLE,
    MOVING,
    CLIMBING
}

# [...] variables and _ready()

func _physics_process(delta):
    match state:
        IDLE:
            # call the idle state handler function
        MOVING:
            # call the moving state handler function
        CLIMBING:
           # call the climbing state handler function

# [...] do the same for all the states you have

# [...] handler functions
</code></pre>
<p>In this example, all I&#39;m doing is changing the state of my player between IDLE, MOVING and CLIMBING.</p>
<p>To change how it behaves and handle inputs: When I&#39;m on idle state, I can jump, move and then the state will change to moving, but if I overlap a ladder and press up or down, I want to be able to change the behaviour.</p>
<p>After the player is positioned to the same <code>x</code> of the ladder&#39;s center, it needs to change its state to climbing, where I just lets the player move vertically, change its state only if I jump of the ladder, hold down while already on ground or hold up and leave the ladder area.</p>
<p>It&#39;ll result in something like this:</p>
<p><img src="https://forum.unity.com/attachments/laddergif2-gif.161236/" class="post-image" alt="gif showing the player changing between states" title="gif showing the player changing between states"></img>
*It&#39;s not my gif, I got it from <a class="anchor" href="https://forum.unity.com/threads/released-smart-2d-colliders-including-smart-platform-controller.361231/" target="_blank">this</a> post to use as an example, since I lost my original gif.</p>
]]></content:encoded>
      </item>
      <item>
        <title><![CDATA[Thinking about pong AI]]></title>
        <link>https://cucadev.ggdaltoso.dev/blog/thinking-about-pong-ai</link>
        <guid isPermaLink="true">https://cucadev.ggdaltoso.dev/blog/thinking-about-pong-ai</guid>
        <pubDate>Mon, 26 Mar 2018 00:00:00 GMT</pubDate>
        
        <content:encoded><![CDATA[
    <h2 id=introduction>
      <a name="introduction" class="anchor-heading" href="#introduction">
        Introduction
      </a>
    </h2><p>  I&#39;m going to introduce this blog talking about part of the creation process of a simple pong game using the <em>Godot Engine</em> for my public talk to introduce about game programming in my faculty, where I showed basic usage and tried to break through about a simple AI system, when I also was able to display some of nodes and how they work in Godot and also some peculiarities in GDScript syntax.</p>
<p>  Although this kind of game is already known and simple for any beginner, a deeper discussion about the functionalities can give you some insights about stuff that you wouldn&#39;t care usually and in the future could be a problem. So, I think it&#39;s a good thing being able to remake old games mechanics from scratch as a way of study.</p>
<p>You can access the repository <a class="anchor" href="https://github.com/lcrabbit/FAETERJ-Simple-Pong-Project" target="_blank">clicking here</a></p>
<p><img src="https://user-images.githubusercontent.com/28108272/72347166-45219d00-36b6-11ea-8cad-69af608a4a06.png" class="post-image" alt="project title screen" title="project title screen"></img>
This is what the title screen looks like.</p>

    <h2 id=what-was-the-problem->
      <a name="what-was-the-problem-" class="anchor-heading" href="#what-was-the-problem-">
        What was the problem?
      </a>
    </h2><p>  I&#39;ve noticed that the common mistake when trying to do a simple pong AI was that people was always making a totally dumb that just hit the ball somethings purely by chance, or they just set the AI axis equals to the ball axis, making the AI invincible.
  Of course, we&#39;re talking about just creating a pong-like game, we doesn&#39;t want to use a machine learning or some far-fetched thing to it. We just need to create a imperfect paddle, and it&#39;ll already be more closer to humans.</p>

    <h3 id=the-thin-line-of-gimmicks>
      <a name="the-thin-line-of-gimmicks" class="anchor-heading" href="#the-thin-line-of-gimmicks">
        The thin line of gimmicks
      </a>
    </h3><p>  A common way to avoid this, that I noticed after some research, is setting the paddle Y to some random value between more or less the current ball&#39;s Y, this is good, but I don&#39;t liked it in practice. Sometimes you have a paddle that is predicting the ball&#39;s final position, which is fine, but then you have a ball going down and your paddle is moving up, which isn&#39;t something that people usually do. Pong becomes harder because every time the ball gets faster and faster until you can&#39;t keep up well your ball position prediction, and then we lose. We want to simulate this habit.</p>

    <h2 id=so-which-path-we-choose->
      <a name="so-which-path-we-choose-" class="anchor-heading" href="#so-which-path-we-choose-">
        So, which path we choose?
      </a>
    </h2><p>  After searching more, I found <a class="anchor" href="https://gamedev.stackexchange.com/a/57397" target="_blank">this stackexchange answer</a> about exactly this. It was literally what we thought. Because it&#39;ll result in some more &quot;human&quot; mistakes.</p>

    <h3 id=how-it-39-s-made->
      <a name="how-it-39-s-made-" class="anchor-heading" href="#how-it-39-s-made-">
        How it&#39;s made?
      </a>
    </h3><p>  If you doesn&#39;t want to open the link above (which is already a simple and short one), I&#39;ll resume:
You basically add a fake invisible ball with a different (greater or smaller) speed than the real one, and the paddle will follow this fake one instead.</p>

    <h3 id=why-it-works->
      <a name="why-it-works-" class="anchor-heading" href="#why-it-works-">
        Why it works?
      </a>
    </h3><p>  Let&#39;s suppose you use a smaller speed, as I did. While time is passing, both the real and the fake balls get faster, but the fake is always slower. It makes the prediction fine at first, considering that you used a smaller difference (In my case, <code>speed - 2</code> did a good job) between the speeds, so eventually, the difference between balls in the vertical Axis will be misaligned enough to make the enemy paddle predict wrong, as a person could do, without being stupid and just go the opposite way.</p>
<p>  I must say, tho, that the example in the answer is better (he used a higher speed on the fake one), because as the fake one will be ahead, it&#39;ll looks more like a wrong prediction and make your enemy look smarter. I used a smaller value just as a tweak to have more stuff to say in my talk.</p>
<p><img src="https://user-images.githubusercontent.com/28108272/72348811-fbd34c80-36b9-11ea-9200-844447d85ed5.png" class="post-image" alt="how it&#39;ll looks like if the fake ball was visible" title="how it&#39;ll looks like if the fake ball was visible"></img>
Here you can clearly see what&#39;s happening. The red square is the fake one, which the &quot;AI&quot; follows.</p>

    <h3 id=what-you-must-observe->
      <a name="what-you-must-observe-" class="anchor-heading" href="#what-you-must-observe-">
        What you must observe?
      </a>
    </h3><p>  If you don&#39;t have the screen edges as collisions to make the ball be reflected, your fake ball will eventually be &quot;ignored&quot; by the player, as they can&#39;t see it, and go off the screen making your AI enemy going to the direction of the fake one which will be completely different than the reflected one.</p>
<p>  There&#39;s no magic values. You need to tweak it as it suits better your case. It depends on resolution, and that&#39;s why in my case a value of <code>speed - 2</code> was fine. You must test and see how far can your enemy go to be it&#39;s looks nice. I think it&#39;s a good beginner reflection to start thinking about AI decisions.</p>

    <h2 id=the-end>
      <a name="the-end" class="anchor-heading" href="#the-end">
        The end
      </a>
    </h2><p>  Reading this now, almost two years later, make this look stupid. I made some changes and fixes in my explanation which was annoyingly big and losing the focus. I&#39;m not going to delete this post because its a reflection for me about my past, and for the same reason I&#39;ll keep this public.</p>
]]></content:encoded>
      </item>
  </channel>
</rss>