<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bálint Biró on Medium]]></title>
        <description><![CDATA[Stories by Bálint Biró on Medium]]></description>
        <link>https://medium.com/@rockbag?source=rss-9a7445a2db5a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Sh-nv4oeeCXVkHNt9pfDzA.jpeg</url>
            <title>Stories by Bálint Biró on Medium</title>
            <link>https://medium.com/@rockbag?source=rss-9a7445a2db5a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 10:46:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rockbag/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Inconsistent Consistency]]></title>
            <link>https://rockbag.medium.com/inconsistent-consistency-d52cbc62a877?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d52cbc62a877</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Thu, 11 Aug 2022 13:04:04 GMT</pubDate>
            <atom:updated>2022-08-20T12:40:32.972Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to excel as a Software Engineer</h4><p>Unlike the title suggests, inconsistent consistency is not a technical term defining some odd behaviour in a system. I’m not even sure if it’s an actual term. I just happen to use it when I try to describe to someone how I manage my time and energy levels.</p><p>If you have ever had a chat with a successful person, you may have heard them talk about one key principle that underpinned their achievements — “consistency is key”. It all seems to come down to this notion that turning up consistently and putting in the work regardless of how exhausted you are <em>is the key to</em> <em>making it</em>. While there’s certainly some truth to this, I think it’s easy misinterpret this idea.</p><p>When I first heard this advice, I took it as “the only way to <em>succeed</em> is to put in the work <em>every single day</em>”. The problem with this, however, is that our arbitrary structure of time does not reflect the temporal truth of different people. While there is definite usefulness to rely on time units — such as days, weeks, months, etc. — to organise our lives around, it’s not a one size fits all solution. It rarely is in life.</p><p><em>It took me a long while to realise the toxic effects of this mantra.</em></p><p>I kept blaming myself if I chose to wind down after a long and stressful day instead of focusing on building my other projects. Or when I was too exhausted to deliver with 100% efficiency at my job every single day. I kept comparing myself to the standards of others and it lead me down a path of unconscious self-sabotage.</p><p>It wasn’t until I finally accepted I’d never fit into this frame that I started to grow as a person. I needed to learn how <em>I</em> function. What makes <em>me</em> tick. Instead of fighting my own nature, I learned to embrace it. I stopped treating consistency based on time and began measuring it through my <strong>energy level</strong>.</p><p><strong>Manage your energy, not your time.</strong></p><p>While time management is a useful tool if your job requires a rigid schedule, it’s rarely the case for creative work. Startups especially have started to embrace a more flexible working environment where employees have autonomy over how they spend their time. This is leading to the rise of a more <strong>result-oriented</strong> way of working. In such a setup, teams agree on deliverables for the foreseeable future and do their best to achieve them. Sometimes it means working 10 hours a day while at other times it means only working 6. It’s all about finding the right balance through refining the agreement each week. This might sound familiar to you if you have ever worked in an agile framework like <em>Scrum</em> or <em>Kanban</em> and while I generally dislike mindlessly following said practices, I’d consider this particular segment of it to be actually useful and important.</p><p><strong>Team synergy</strong> becomes a crucial pillar to successfully implementing this approach. Everyone on the team needs to be able to openly communicate how they work best and the team has to compromise on a cadence that works for everyone. Some people prefer working in the mornings, while others do their best in the evenings. The team’s manager has to understand these preferences and influence the delivery roadmap based on them. It’s also important to understand that you won’t be able to optimise this for every single scenario. There are always ups and downs, but the most important factor is for everyone to be on the same page and adapt to the situation as best as they can.</p><p>This is an ever-changing and complex problem, but one that ultimately rewards its participants. People change, requirements evolve and team compositions shift over time. Open and honest communication is at the forefront of navigating this messy inconsistency. Accepting the fact that some days you just can’t perform as well, recognising when you can and being able to adjust your deliverable commitments through this process is fundamental to reducing stress and becoming more successful in your day to day life.</p><p><em>This piece was ported over from my newsletter over at </em><a href="https://newsletter.nextlevel.engineer/"><em>Next Level Engineer</em></a><em>. If you are interested in similar stories, please consider </em><a href="https://newsletter.nextlevel.engineer/subscribe"><em>subscribing</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d52cbc62a877" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Expectations, roles and responsibilities in a decentralized network for video games]]></title>
            <link>https://rockbag.medium.com/expectations-roles-and-responsibilities-in-a-decentralized-network-for-video-games-7d0c7322c116?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d0c7322c116</guid>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Sun, 13 Feb 2022 08:54:05 GMT</pubDate>
            <atom:updated>2022-02-13T08:54:05.269Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dpIJKgTd7e8G-4xnsTtdug.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@sunburned_surveyor?utm_source=Hashnode&amp;utm_medium=referral">Scott Blake</a> on <a href="https://unsplash.com/?utm_source=Hashnode&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A decentralized network — <em>in my opinion</em> — is much like a well-functioning community. It’s governed and ran by its participants. There are fundamental rules that no single actor can ignore or avoid. Everyone involved in this community has an innate responsibility to keep its overall outlook healthy and positive. In exchange it provides an ecosystem that rewards all of its actors throughout its lifecycle.</p><p>The notion of a decentralized network is nothing new. It’s been a noble idea since the dawn of the internet, but only recently, in the last one or two decades or so, has it gained a newfound traction through the invention of blockchain technologies.</p><h3>Blockchains &amp; Games</h3><p>One of the newest trends in game development has become the so-called <em>Play to Earn (P2E)</em> scheme. Basically video game studios are building products that supposedly <em>run on the blockchain</em>. The premise of such games is that if you <em>invest </em>time into playing, you should be able to reap the rewards and make money off of them. Alongside this, you will usually hear about <em>true ownership,</em> which means if you buy an item, it will live on the blockchain and you can do whatever you want with it; keep it, sell it or bring it to another game — it really is up to you. <em>Even if the game shuts down for some reason, you get to keep your items.</em></p><p>While I appreciate the fundamental concepts behind this, I can’t help but question its validity and practicality given the currently available blockchains one can develop on. Here’s why -</p><ul><li>If we look at the existing big players, such as <a href="https://bitcoinwhitepaper.co/">Bitcoin</a>, <a href="https://ethereum.org/en/whitepaper/">Ethereum</a>, <a href="https://iohk.io/en/research/library/">Cardano</a> or even <a href="https://solana.com/solana-whitepaper.pdf">Solana</a>, they all require you to purchase their coins in order to participate in the network. This coin is directly tied to functionalities on the network; i.e. you must spend some of this token to use the network. However, due to the space being so new and well-marketed with promises on <em>defeating the rich and giving power to the poor</em>, it promotes a speculative environment. This drives the price up, which makes it harder for actual developers to participate in the network and build utility on top of it as they get priced out by investors and day traders.</li><li>Cryptos are touted as <em>deflationary assets</em> — though in reality, most <em>tokenomics </em>are now designed to include artificial inflation — we still hear this narrative about how crypto price is only going to go up and how good it is for us. Deflation, however, is not a good marker for an economy; it punishes purchases, as most items one can buy lose value over time. Why would someone spend a deflationary asset on something that loses value instead of just holding onto the asset in the first place?</li><li>Volatility makes it super risky to develop on this digital economy. Without having a massive reserve of fiat lying around, it’s impossible to give a consistent salary to your employees. Who would want to have only 50% of their spending power from one month to another? Unless cryptocurrencies become universally accepted as means of payment, I don’t think a lot of companies will be fully able to buy into building on this tech.</li><li><em>Shared economies, Bring Your Own Items, Item Cross-Overs</em>, or whatever you want to call them is fake news. Unless the game is built on a Layer 2 solution like <a href="https://enjin.io/">Enjin</a>, the concept of truly owning an item on the blockchain becomes irrelevant. For one, unless there’s direct cooperation between two developer teams, there’s 0 chance you’ll be able to use one item in another studio’s game. The developers have to make explicit efforts for this to become possible and they aren’t incentivized to do so; they don’t get any monetary benefit if a user brings their items over from another game. Plus, if they decide to shut down their servers, your items value will quickly drop to 0; who would want to buy an item they can never use again? Current blockchains don’t natively adhere to such an ecosystem. And why would they? They weren’t specifically built for digital economies in video games. They were built as a decentralized financial system to replace banks and other entities.</li><li>Lastly, if a player wishes to participate in a P2E game, they’ll generally have to “buy in” by purchasing a token that was minted on the blockchain. Unfortunately, for reasons mentioned above, we usually end up seeing the price of such tokens skyrocket, increasing the barrier of entry to hundreds of dollars in some cases. This creates this wall, where the less fortunate simply cannot get into the game. In fact, <a href="https://axieinfinity.com/"><em>Axie Infinity</em></a>, one of the most well-known P2E games created the concept of a <em>scholarship</em>, where someone else can <em>front you an account</em> in exchange for a hefty split in the profits you make along the way. Naturally, this created a digital mob that preys on the poor and exploits them to the fullest extent by handing out these scholarships and then threatening to revoke access from players who don’t work their asses off. <em>How fun</em>.</li></ul><p>And if that wasn’t enough, “dApps” or “decentralized apps”, — in other words, things that supposedly run on the blockchain — are in fact, mostly not decentralized and they don’t actually run <em>on the blockchain</em>. Most dApps are very much centralized with only a portion of their code actually getting executed on the blockchain. They are hosted on-prem or in the cloud and follow very typical system architectures. The only differences is that parts of the domain logic is implemented in smart contracts; and these are the bits that are served by the chain. There are multiple reasons for this:</p><ul><li>Any write operation on the chain costs actual money</li><li>To run something fully on chain, its code should be open-source; since anyone can join the network and grab hold of its contents, having a private codebase doesn’t come with a benefit. This, of course, can be disadvantageous in a highly competitive market.</li><li>The network simply cannot handle all the transactions and assets included in the app, so the devs need another way to surface certain actions and files.</li></ul><p>As you can see, in my opinion, there are quite a few issues surrounding blockchain game development. So what can we do better? In all honesty, I don’t yet know. Hence why I decided to start building a network myself and see first-hand the forks in the road that lead to different answers. I have some ideas in my head, but I don’t yet know if all of them can be reached on walkable paths.</p><h3>The Ecosystem</h3><p>The way I see it, building utility on a financial system has very limited use-cases. Yet, we see different blockchains being developed based on the same old paradigm with perhaps a few changes and caveats along the way. At the moment I don’t believe such systems should represent the cornerstones of Web3. To draw a parallel, the way I think about it, building on top of any existing chain whose foundation starts with Tokenomics is much like building on top of a banking API on steroids; sure it’s a great place to start if your goal is to move money around, but does that really serve a generic purpose? My hunch is that over the coming years we will be seeing more and more specific purpose decentralized networks popping up, providing tools and incentives for developers to build on them. Then, much like a centralized app would use something like Stripe as its payment backend, these networks could use one of the existing blockchains as payment provider.</p><p>My rudimentary vision, specifically one for a decentralized network that specializes in video games, is a multi-role space, where each participant has a key function in the well-being of the ecosystem. Naturally, one can assume multiple roles at the same time.</p><ul><li>Developers build games that run on the network. Their goal is to provide entertainment and make money.</li><li>Server hosts provide compute power for developers. They run game servers and backend services in a virtualized environment. I’m thinking unikernels, but I still need to explore this further. Server hosts have the option of excluding or including game servers they want to host.</li><li>Data providers offer up storage in exchange for rewards on the network. These providers store the game server builds and offer them up for <em>Server hosts</em> through a P2P file transfer (bittorrent) mechanism.</li><li>Validators read and write to the underlying global database — perhaps a blockchain. This database keeps track of the fundamental state of the network, including user accounts, credits, etc.</li><li>Merchants (perhaps not the best name) provide stalls where people can put up auctions to trade <em>certain items</em>. They have the option to exclude/include items from specific <em>Developers</em>.</li><li>Etc <em>— I’m sure this list will change as I work through the project.</em></li></ul><h3>A shared economy</h3><p>There is a native virtual currency called Terinium that is detached from network fees. E.g. transactions on the chain won’t cost Terinium. Instead, there’s a credit system in place that protects the network from abuse. More on this later. Ideally the value of Terinium is pegged to a decentralized stablecoin — best candidate for this at the time of writing is <a href="https://www.terra.money/">UST</a>.</p><p>Developers must purchase some amount of Terinium to be able to participate in the shared econ. They can forge Terinium into items — e.g. skins for F2P games or stronger items for P2W games. Any transaction that happens with the forged item is going to net some profits to the developer. Let’s see a few examples:</p><ol><li>Bob has an <em>Armor of Goo</em> in the game <em>Gooland</em> and he wants to trade it for Alice’s <em>Helmet of Gloop</em> in the same game. Both Alice and Bob would have to spend some Terinium as tax that would go directly to the developer and the merchant. This is the best case scenario for the devs, because they make money off of each trade. Tradeoff is that it costs Terinium for the players.</li><li>If the developers opted into this feature, Bob might decide to melt his item into Terinium instead. In this case, Bob receives a portion of the Terinium it cost the developers to forge the item and the rest of the Terinium goes back to the developers. In this scenario Bob made some Terinium and the developers likely lost some Terinium. The trade off here is that by providing this option to their players, developers have a greater chance of acquiring users at the cost of some Terinium. Assumption here is that players are more likely to play a game that rewards them.</li><li>The third — and I think least likely — scenario is when two developers form a cooperation and allow inter-game trading for their players. So the devs of <em>Gooland</em> here partnered with the developers of <em>The Secrets of Ire</em>. Bob is a player of <em>Gooland</em> and Alice is a player of <em>The Secrets of Ire</em>. Both of them own an item that the other wants, so they decide to trade. The workings of this is going to be similar to that of scenario #1, except in this case the tax profit is divided up between the two developers. There’s no change in how item melting works, however. So even if Bob now has an item from The Secrets of Ire, the developers of this game are going to get their Terinium back.</li></ol><p>A system like this creates incentives for developers to opt into a shared economy, might that be by making actual profit or by acquiring new users.</p><h3>Isolated economies</h3><p>Developers who don’t want to participate in the shared economy can create their own virtual economies much like they would in a traditional development process. They lose out on some of the features, but they still get to run their game servers in a “serverless” manner by sharing it with the network — that is if a game server host chooses to host it for them.</p><h3>Transitioning from centralized to decentralized</h3><p>Evidently at the start of the project everything is going to be centralized; I’m the only person working on this platform and until there’s enough participation, there is no getting around making executive decisions. Once we hit a threshold where the community is comfortable with basing decisions on a consensus, we can switch over to a fully decentralized system.</p><h3>Joining the network</h3><p>I believe in full transparency — hence this blog series as well — and while I disagree with big corporations owning user data, full privacy has its drawbacks as well. We already see how anonymous teams can easily get away with scams in the crypto space. This is why I believe that joining the network — especially for developers — should be decided through a consensus. To get credits — which are required for participating in the network — one has to submit their game (idea) to a catalog that’s a native feature of this platform. The idea then has to be accepted by a majority of eligible participants. Voting eligibility is something that’s going to be based on one’s role; e.g. developers will be eligible to vote, players who have been part of the network for X amount of time will be eligible to vote, etc. The exact rules are still something I’m working through and I will elaborate on them once I have more of the platform flashed out.</p><h3>Up next</h3><p>In the next part of this series we’re going to explore the rewards system for more in-depth examples on how one can make money by joining the network. We will also talk more about detaching the value of the native token from directly impacting the usability of the network and the implications of this choice.</p><p><em>There’s a good chance that some or much of my thinking is going to change as I dive deeper into building this network. If you want to be a part of this adventure, feel free to follow and share your thoughts on the matter. I’m always open for a discussion — just keep it civil, please!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d0c7322c116" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Consensus-Based Cheat Detection for Multiplayer Games]]></title>
            <link>https://rockbag.medium.com/consensus-based-cheat-detection-for-multiplayer-games-fc8abfde8f39?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc8abfde8f39</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[multiplayer]]></category>
            <category><![CDATA[cheating]]></category>
            <category><![CDATA[client-side]]></category>
            <category><![CDATA[multiplayer-game]]></category>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Sun, 11 Jul 2021 20:49:23 GMT</pubDate>
            <atom:updated>2021-07-11T20:49:23.912Z</atom:updated>
            <content:encoded><![CDATA[<p>Because making multiplayer games is hard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EYH52eXcAk3NHTVkqU0VwQ.jpeg" /><figcaption><em>Photo by </em><a href="https://unsplash.com/@element5digital?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText"><em>Element5 Digital</em></a><em> on </em><a href="https://unsplash.com/s/photos/voting?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText"><em>Unsplash</em></a></figcaption></figure><p>Last time I wrote about running an <a href="https://towardsaws.com/on-demand-game-server-architecture-on-aws-30d971261d22">On-Demand Game Server Architecture on AWS</a> for multiplayer games. Usually you need to roll your own game server if you want to mitigate cheating as much as possible; your game clients would need to act as dumb input machines and your server would evaluate every single movement and catch cheaters as necessary.</p><p>But what if you don’t want to deal with the hassle of setting up your own game servers? It’s quite the endeavor after all, with a bunch of pitfalls, unexpected issues and costs that require a specific expertise to solve.</p><p>When I think about game moderation in real life, generally speaking I think of two distinct ways of doing so:</p><ul><li>There’s a dedicated referee who watches everything (i.e. authoritative game server)</li><li>Players in the game watch out for rule breakers and call them out; then they decide what the outcome should be (i.e. consensus-based cheat detection)</li></ul><p>Both approaches have their pros and cons and while they aim to solve the same problem, they require very different circumstances to work with.</p><p><strong>When does consensus work?</strong></p><p>Some examples of game types where it might be good:</p><ul><li>Cooperative games with at least 4 players</li><li>Free for all games with at least 4 players</li><li>Team games with at least 6 players where player parties can’t exceed 2 players (think League Of Legends Duo Queue)</li></ul><p><strong>When does consensus fail?</strong></p><p>Typically this engine fails if there are enough clients connected to the game who are actually cheaters — usually referred to as 51% attack. It can happen that a game has multiple cheaters running around, rendering the consensus flawed — they might not evaluate consensus or just evaluate moves incorrectly</p><p>If that’s the case, the following scenarios might happen:</p><ul><li>Cheaters don’t get recognized and so they stay in the game</li><li>Cheaters actually boot legit players (though I don’t know why they would do this)</li></ul><p><strong>How does this work?</strong></p><p>I’ve <a href="https://github.com/Rockbag/forseti">built a prototype</a> to demonstrate the usage of a cheat detection system like this. Mind you, this is not production ready code, it’s just a demo.</p><p>The whole thing starts with the <a href="https://github.com/Rockbag/forseti/blob/main/forseti/engine.py">Cheat Detection</a> engine. Every client needs to run this engine to be eligible to play the game. If a client fails to initialize the engine within the configured timeout period, they are automatically considered cheaters. This could happen if someone hacks the client and removes the engine from it. Now, of course, they might still just send the signal to the others saying “hey I’ve registered” without actually initializing the engine, but that’s fine. It’s just the first layer of defense.</p><p>There are many <a href="https://github.com/Rockbag/forseti/blob/main/forseti/engine.py#L19">configuration options</a> for the engine, but probably the most notable one is the <em>rules </em>parameter. This is where we define the rules of the game. We do this by mapping <a href="https://github.com/Rockbag/forseti/blob/main/forseti/move.py">Moves</a> to<a href="https://github.com/Rockbag/forseti/blob/main/forseti/rule.py"> Rules</a>.</p><p>A <em>Move </em>defines an event that is important from the game’s perspective. Technically this could be anything from moving the player character, to attacking, to picking up objects, etc. Any action that’s important for the game should be declared a <em>Move</em>.</p><p>A <em>Rule </em>defines how a certain move should be evaluated. Typically this will resolve to a <em>bool </em>value indicating if the movement was allowed or not.</p><p>Once every client has initialized and is running its own cheat detection engine, the clients need to subscribe to other players’ moves and forward them to the engine. Each client will then start evaluating every other clients’ <em>Moves </em>against the configured <em>Rules</em>. When a client evaluates a <em>Move </em>as invalid, they will cast a vote and let the other clients know.</p><p>If enough (by default more than 50% of the) players deem an action as cheating, all clients will then unsubscribe from any other move from the cheater, essentially shadow banning them from the game. While the player might still be technically connected to the game, everyone is just going to ignore their actions from that point on.</p><p>If the game has a “leader” or “room owner” who has the ability to boot the cheater, this would be the time to do that.</p><p>An example of the engine configuration can be found in this <a href="https://github.com/Rockbag/forseti/blob/main/game/client.py">Virtual Client</a>.</p><p>The following screenshot shows an example where there are 5 players and one of them (Player 5) is a cheater. All the other players recognize that Player 5 attempted to move more than the game allows so they all unsubscribe from further events coming from Player 5.</p><figure><img alt="Consensus in action" src="https://cdn-images-1.medium.com/max/962/1*2uSJ4q7LxjG40wAvEMSjFA.png" /></figure><p><strong>So what’s next?</strong></p><p>I’m toying with the idea of writing a Unity compatible library that can be integrated with Photon cloud. I think that could be cool.</p><p>If you’re interested in collaborating or just want to roll your own solution, feel free to use any of the code provided in the linked example as your starting point. I wouldn’t recommend just copy-pasting it as it was never intended for production use.</p><p><em>If you enjoy reading about content like this, please consider dropping a follow to get notified about future posts.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc8abfde8f39" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[On-demand Game Server Architecture On AWS]]></title>
            <link>https://towardsaws.com/on-demand-game-server-architecture-on-aws-30d971261d22?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/30d971261d22</guid>
            <category><![CDATA[multiplayer]]></category>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[spot-instances]]></category>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Wed, 26 May 2021 17:45:04 GMT</pubDate>
            <atom:updated>2021-07-24T20:43:17.291Z</atom:updated>
            <content:encoded><![CDATA[<h4>A cheaper alternative to running your high-scale multiplayer games</h4><p>Recently I’ve been working on a room-based multiplayer game built for WebGL and I kept bumping into issues with running my server architecture on top of AWS GameLift. I’ve used GameLift before for a different game, but I’ve always found the documentation grueling to sift through and the service just, all in all, lacking; deployments were slow and brittle, Terraform support is not great and for the problems it solves — as in indie — I found it to be a bit too pricy.</p><p>That, plus the fact that the game will be running through a <a href="https://www.lunarleague.io/">https website</a> (not much to see here just yet, it’s just set up as a test page) and that I’m using <a href="https://mirror-networking.com/">Mirror</a> as my networking framework, I needed a bit more control over my TLS certs and domain mapping as well.</p><p>Lastly, as a bonus on top of this, the <a href="https://github.com/aws/aws-sdk-net">AWS .NET SDK</a> is not designed to run on IL2CPP builds — which, believe me, I’ve tried to fix, but I just ended up digging further down the rabbit hole — , meant that I needed to go with an alternative approach and set up an API that would communicate with the rest of the services. My game client would then just make HTTPS calls to this API.</p><h4><strong>About The Game</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ScyNcm0NEZIc4G4XNrWjcA.png" /></figure><p>Lunar League is a fast-paced space-based multiplayer battle game. It combines elements from the well-known <em>battle royale</em> and <em>.io</em> genres. A game room can host up to 8 players. Each players has a base planet and controls a ship. By collecting scraps across the map, players gain levels which enhance both their ships and their bases. They can also find weapons and utilities, which they can equip to further enhance their battling prowess. Players will respawn up until their bases stand. Once the base is destroyed, it’s their last chance to fight.</p><p>The last ship standing wins the game.</p><p>—</p><h4><strong>Game Design and Architecture</strong></h4><p>The way the game is designed dictates what the game server architecture should look like.</p><p>In a typical game server architecture setup, you have a bunch of machines running (sometimes multiple) process(es) that act as the game servers. Between the clients and the game servers there’s usually a middleman, who takes requests from the clients and acts on them, by say, instructing and reserving a game server to launch a new game. This middleman can also be used to poll the status of the game server or even update it if needed. It also acts as a relay between the client and the server, feeding the server instance’s address back to the client once its ready. This would also be the place to introduce matchmaking if you want to have any.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l30uojSqAyvBstECV_8Jsg.jpeg" /></figure><p>Generally, in a case like this, you should understand the seasonality of your game and autoscale the capacity based on that (amongst other things). The downside is that you’ll always have idle instances running, who are just waiting for new game requests, incurring costs. On the upside, serving a new game request is practically instantaneous, as the server process is already running by the time a new game is requested. Deployments can also get slightly tricky, as to safely roll out a new server version, you’d likely have to have two game server pools and slowly switch traffic over from one to the other. I guess you could also do canary deployments, but depending on the number of server processes you’re running, it can get tricky to get it right.</p><p>Depending on your game design, this type of architecture <em>might be necessary</em>. For example, in games like Diablo 3 or Path Of Exile, it would be awkward if you had to wait 30–60 seconds for a rift/map to open up.</p><p>On the other hand, if you look at games like Brawlhalla or Dauntless, even when you request a new game — i.e. start matchmaking in Brawlhalla, or start a hunt in Dauntless — there’s quite a bit of time between you pressing start and the game actually starting. In Brawlhalla, you get into an offline bot game, while in Dauntless you can just walk around town until your game is ready. These kind of setups can benefit heavily from an on-demand game server architecture, where instead of having multiple instances idly running, you launch a new game server instance when the player actually requests it. It can cut hosting costs insanely, but at the cost of the player having to wait 30–60 seconds for their game to start.</p><p><em>Of course there are many techniques in both cases that can highly improve the cons, I’m just stating them here as baselines, because we need to work off of </em><strong><em>something</em></strong><em>.</em></p><p>The beauty of going with an on-demand game server architecture is that you can essentially have your whole game infra be <em>pay-as-you-go</em>. On AWS, you can utilize <strong>API Gateway</strong> + <strong>Lambda </strong>+<strong> DynamoDB + Cognito </strong>for your middleman layer so you only pay for the backend API when players are playing the game, plus you can launch <strong>spot instances</strong> at a fraction of the price of normal <strong>EC2 </strong>instances, on-demand, in less than a minute. Of course, whether you can really use spot instances, depends on your failure tolerance, as these instances can go away with a few minutes notice at any time. In my personal experience of working with spot instances across multiple high-volume backends, I’ve rarely had any issues with them yet. That’s not to say issues can’t happen, so do your own research before committing to using it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hFKkBjiTHDTMfQPiogHRTA.png" /></figure><p><em>Fun fact, in Lunar League, I’m considering adding a feature where if an instance is notified about getting terminated, I’d start shrinking the map sooner (think battle royales) than usual, forcing the game to end before the instance goes away.</em></p><h4><strong>The flow</strong></h4><p>The diagram above should give you a good idea of the overarching system architecture, but it doesn’t really show the exact flow how a user gets from creating a game to joining one.</p><ol><li>Player visits the website (it’s a WebGL game) and launches the game.</li><li>Inside the game client the player signs up/logs in (this can be pulled out if necessary and the session cookie can be injected in — this way you could avoid having to work with forms in your game client).</li><li>The login/signup process is handled through HTTPS calls to the Middleman. For Lunar League the login API is a thin wrapper around AWS Cognito.</li><li>Once logged in, the player creates a new game room. For now, the game has game rooms for rapid testing, later on this might change and move completely to matchmaking. Because I’m using Mirror and its built-in <a href="https://mirror-networking.gitbook.io/docs/examples/room">Room system</a>, creating the room actually means launching the EC2 instance. This means creating the room takes up the majority of the time, which is less than ideal. I have plans on detaching it, though I’m not treating it as high priority right now.</li><li>To launch the room, the game client sends a HTTPS request to the Middleman, which requests a new spot instance. The spot instance is launched with a small user data script through which I pass in the game room id and some other arbitrary info to bootstrap the game server. Middleman saves some metadata about the newly created game room to DynamoDB for state keeping. The game room also comes with a TTL field, which is going to be important for the cleanup process.</li><li>The EC2 instance launches, it uses a custom AMI with some very basic setup. The user data script injected in the previous step runs, it pulls the latest available production build, extracts it and launches it.</li><li>The server process comes online and notifies the Middleman that it’s ready and awaiting connections. It tells the Middleman its IP address and the port of the game server process. Middleman saves this info to DynamoDB.</li><li>In the meantime the game client is polling the Middleman to know when it can initiate the connection. Once it receives a READY status, it takes the IP and port from the response.</li><li>Because I’m running WebGL on a https website, I can only instantiate the WebSocket connection through Secure WebSocket (wss). For this, I have a registered domain with a TLS cert (servers.lunarleague.io) that points to the name servers of <a href="https://sslip.io/">sslip.io</a>. Later I might run my own name server, but for now it’s good enough. This lets me look up arbitrary addresses, such as 172.168.1.59.servers.lunarleague.io which basically returns the IP address 172.168.1.59. This way I don’t need to rely on Route53 to register subdomains/routes for my game servers. Route53 is pricy and slow.</li><li>Connection is established to wss://172.168.1.59.servers.lunarleague.io, player joins the game room.</li><li>Player who created the room launches the game. Players play and finish the game.</li><li>When the game ends naturally, the game server updates Middleman that it’s now finished. Middleman removes the game state from DynamoDb, which triggers a DynamoDb stream event. A lambda function is listening to this event and cleans up the game server. If the game ends without a successful finish (e.g. all the players leave the game instead of finishing it), DynamoDb ends up cleaning up the game state itself once the TTL of the document is hit. This then triggers the same cleanup process.</li></ol><p>That’s it pretty much. The whole lifecycle is self-contained to ensure there are no dangling instances in the pipeline.</p><p>There are still many ways to improve this. For example, I’m certain I can shave off some of the bootstrapping time by optimizing the AMI and the launch script. The lobby will need to be detached from the game server process. I’m exploring using WebSockets through API Gateway for this. I’ll post an update on the progress if I get there.</p><p>The infra that’s not managed by the Middleman is managed through <a href="https://www.terraform.io/">Terraform</a>. This way I have multiple identical environments set up. All of this allows me to test against very real scenarios for practically no cost. Running a game server literally costs a few cents.</p><p>—</p><p>Hope you found some value in this. I’m looking to write more about the different components in-depths, though I’m uncertain if I’ll have the time.</p><p>Do get in touch if you think it would be interesting for you. I’m also curious to hear your thoughts on this matter.</p><h4><strong>Credits</strong></h4><p><em>Thanks to my friend and colleague, </em><a href="https://twitter.com/conzy_m"><em>Conor Maher</em></a><em>, for pointing me in the right direction with </em><a href="https://xip.io/"><em>xip.io</em></a><em>, which lead me to finding </em><a href="https://sslip.io/"><em>sslip.io</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30d971261d22" width="1" height="1" alt=""><hr><p><a href="https://towardsaws.com/on-demand-game-server-architecture-on-aws-30d971261d22">On-demand Game Server Architecture On AWS</a> was originally published in <a href="https://towardsaws.com/">Towards AWS</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Game Off 2020–First week wrap-up]]></title>
            <link>https://rockbag.medium.com/game-off-2020-first-week-wrap-up-a91662875504?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a91662875504</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[moonshots]]></category>
            <category><![CDATA[game-off-2020]]></category>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Tue, 10 Nov 2020 15:55:10 GMT</pubDate>
            <atom:updated>2020-11-10T20:41:35.514Z</atom:updated>
            <content:encoded><![CDATA[<p>Moonshot</p><p>Just a little over a week ago the theme of the <a href="https://itch.io/jam/game-off-2020"><strong>2020 Game Off</strong></a> has been announced; moonshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pyy5JpOKn4cXsstjQK_6Jg.png" /><figcaption>Game Off 2020 cover</figcaption></figure><blockquote><strong><em>moonshot</em></strong><em> — noun</em></blockquote><blockquote><em>an extremely ambitious and innovative project</em></blockquote><blockquote><em>the act of launching a spacecraft to the moon</em></blockquote><blockquote><em>a hit or thrown ball that travels a great distance with a high trajectory</em></blockquote><blockquote><strong><em>moonshot</em></strong><em> </em><strong><em>thinking</em></strong><em> — noun</em></blockquote><blockquote><em>a type of thinking that aims to achieve something that is generally believed to be impossible.</em></blockquote><p>In case you’re unfamiliar with Game Off or game jams in general, they are usually short-running events where you, either individually or in a team, have to design, implement and deliver a (fully) functioning game. It’s a great way to try out new ideas, build small prototypes or even make something that can later on turned into a business.</p><p>My brother and I decided to join last Monday. We wanted to test our limits and see how are skills have progressed over the last few months, so we came up with a multiplayer game idea that takes elements from different .io and battle royale games. Some of the things we would like to achieve:</p><ul><li>Room-based multiplayer up to 8 players per room</li><li>In-game progression through levels, stats, skills and different weapons</li><li>Hosted on a dedicated AWS Gamelift fleet</li><li>Relatively fast game sessions, aiming for 5–15 minutes on average</li><li>Low-poly, handmade assets including models, VFX and shaders</li></ul><p>This in itself is quite ambitious on its own and fits the theme nicely, but to double-down on the moon idea, the game will take place in space where each player controls a ship and owns a moon. Players can navigate the spaceship around the map, collecting scraps to gain experience points. Upon reaching enough experience, the player levels up and is able to choose between different stats to upgrade. On levels 4, 7 and 10 they get to decide between upgrading their weapons or their utilities. On top this, with each player level, the player’s moon also gains stats and different add-ons, like a shield that blocks a certain amount of damage or additional turrets that defend against intruders. Weapons and utilities spawn on the map randomly. Each weapon and utility has a unique functionality. For example, you might pick up a laser that does not have travel time but overheats if not used with care. Or you may find a booster jet that you can strategically use to dash forward a certain distance.</p><p>When a player’s spaceship is exploded, the player respawns at their moon. When their moon is destroyed, however, the player loses the game.</p><p><em>The last player standing wins</em>.</p><h4>So where are we at right now?</h4><p>We’ve spent the last week brainstorming, prototyping and implementing the core functionalities. The core game loop is not quite done yet, but we’re very close. Multiplayer is working fine, although we’re only running it on LAN for now. We have ships, a basic weapon with multiple levels, scraps that can be collected to gain experience points and a moon that doesn’t really do anything just yet. Leveling up and gaining stat/skill points is also in the game, although there’s no way to use them just yet. The backend code is there though, so it’s just a matter of wiring things together once we have the HUD. We also built a procedural map generator that needs some tweaking and changing, but it does the job. The controls are okay, but still need polishing.</p><p>Here’s a short video of the things we have in place.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJMqbK4OYHfs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJMqbK4OYHfs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJMqbK4OYHfs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/41088c36ea2c42b79555b900344e4a0c/href">https://medium.com/media/41088c36ea2c42b79555b900344e4a0c/href</a></iframe><h4>What do we plan for this week?</h4><p>There are a couple of things we want to get done. For now we’re going to focus on implementing the whole core gameplay; as in the players will need to be able to destroy the other players’ moons and win the game.</p><p>We’re also adding a fancy HUD and different indicators for when a projectile hits a target or when the player takes damage.</p><p>Then we’ll move onto sound effects and different weapons. This might already be plenty for the week, but hopefully we can make some progress.</p><p>Our stretch goal is to implement a pre-game lobby where players can configure how they want to set up the game. Hosting is still going to be done locally for now.</p><p>My brother is on this full-time working away on the visual side of things, but I do have a full-time job so my time is fairly limited.</p><p><em>If you’re interested in seeing the progress, drop a follow to be notified of future pieces. I also blog here and there about other game dev stuff and even some devops topics.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a91662875504" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Ethoas — Worldbuilding fundamentals]]></title>
            <link>https://rockbag.medium.com/building-ethoas-worldbuilding-fundamentals-c06e84e04a8b?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c06e84e04a8b</guid>
            <category><![CDATA[video-game-development]]></category>
            <category><![CDATA[worldbuilding]]></category>
            <category><![CDATA[ethoas]]></category>
            <category><![CDATA[fundamentals]]></category>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Tue, 12 May 2020 18:10:29 GMT</pubDate>
            <atom:updated>2020-05-12T18:12:41.905Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Ethoas — Worldbuilding fundamentals</h3><p><em>Every story, no matter how big or small, needs some level of worldbuilding.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zT97jHUtoE-lEbldR3mJOg.jpeg" /></figure><blockquote><strong>Worldbuilding</strong> is the process of constructing an imaginary world, sometimes associated with a whole fictional universe.<br>Wikipedia — <a href="https://en.wikipedia.org/wiki/Worldbuilding">https://en.wikipedia.org/wiki/Worldbuilding</a></blockquote><p>When I think about stories, I see three fundamental concepts; <strong>plot</strong>, <strong>characters</strong> and <strong>context</strong>.</p><p>A good <strong>plot</strong> keeps us <em>engaged</em>.</p><p>We <em>identify with</em> and <em>create emotional bonds with</em> well-written <strong>characters</strong>.</p><p>But the <strong>context</strong>, the little details, the surroundings are what help us believe that the story<em> could actually be true</em>.</p><p>Building a whole new fantasy world is a long process. I’m not joking when I say it can take decades or even a lifetime. Tolkien started working on his world around 1910 and he constantly kept revising and changing it up until his death in the early 70s. I started working on Ethoas over 7 years ago and I’m nowhere near done. I keep going back to things I once thought made sense and completely rewrite them. I evolve the world as I learn more about life itself. It’s an interesting process and I honestly don’t think I’ll be ever done with it.</p><p><em>It’s unlikely, however, that you need a fully flashed out world to tell stories</em>. In fact, writing stories can help further build your world once you have the fundamentals down. But how do you create the fundamentals?</p><h4>My Framework</h4><p>I distilled down my process into three approaches. They tackle different things but are complementary to each other.</p><figure><img alt="Methodologies" src="https://cdn-images-1.medium.com/max/782/1*Q73OTSnsehQqtFJCuuuTNA.png" /></figure><p>On the bottom is the <strong>Universal</strong> scale.</p><p>Here I define everything that is fundamental to the whole universe; think laws of physics, how things came to be, what are the propelling forces and how do they manifest in life.</p><blockquote>For example, Ethoas is a world in my (so far unnamed) fantasy universe where there is a set amount of energy that can only be transferred, but not created or destroyed. At the beginning of time, there were 12 deities who could use and manipulate energy in any way they wanted. One of them, Annu, created the planet Ethoas where my stories take place.</blockquote><p>Of course, that’s just a minor snippet of the whole thing, but you get the idea. Basically these are rules that simply cannot be broken.</p><p>Next up is the <strong>Macro</strong> scale.</p><p>There’s a vast amount of topics that can go into this layer. Everything from cosmology, geology, geography, biology to politics, laws, diplomacy, power dynamics, economics, philosophy, culture, architecture, religion, warfare, etc. It’s a never-ending list of high level concepts that shape the state of life on a specific planet.</p><p>My advice here is try not to tackle all the topics at once but rather as they come up. You can pick one that you like and start building on it. When you bump into the first question of “okay, but how does this relate to X?”, you can do a superficial take on topic X until you find the answer. Many times, it’s not quite so easy, but we do have to start somewhere.</p><p>At the very least you need a good grasp of at least a few groups of inhabitants and their relations towards each other.</p><p>Then there is the <strong>Micro</strong> scale.</p><p>This is probably the closest to us as individuals. Essentially this comes down the community or the individual level. Here we can start thinking about traits, core values, morals, person-to-person interactions, small-scale politics, relationships, etc. These are all things that should help you create more complex characters that don’t feel very binary.</p><p>I find it extremely useful when I’m designing a new character to understand the social dynamics that fundamentally shaped them as they grew up. It helps me answer a lot of “but why?” questions that I otherwise couldn’t.</p><p>This framework works fairly well for me. It helps me introduce new concepts into Ethoas and weed out the ones that I think could be good but ultimately end up falling short. One of the drawbacks, of course, is that the lower the level of the pyramid I want to change, the bigger the ripple effect it causes.</p><p>There’s no strict rule on which level to start on. Ideally you have the fundamental rules before you dive into the macro or micro levels but by no means is it impossible to start on the micro level and work your way back to the universal level.</p><p>It took me a couple of years to conceptualise my own way of working but now I find it invaluable. These are just the very basics though. We’ll dive deeper into specifics in upcoming blog posts.</p><p><em>If you want to get a discussion rolling feel free to leave a message below and I’ll do my best to answer! I’m really interested in hearing what’s worked for you and what hasn’t.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c06e84e04a8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Ethoas]]></title>
            <link>https://rockbag.medium.com/building-ethoas-4702b78ec6cd?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4702b78ec6cd</guid>
            <category><![CDATA[ethoas]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[multiplayer]]></category>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Mon, 04 May 2020 12:43:15 GMT</pubDate>
            <atom:updated>2020-05-04T20:18:23.886Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Ethoas - Multiplayer Software Architecture</h3><h4>Tech — Software Architecture— Overview</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jJ4BrXUzRNWjOGJ2hKC83g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@cedericx?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Cederic X</a> on <a href="https://unsplash.com/s/photos/fantasy?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><blockquote>“DAWN WAS COMING. The Waystone Inn lay in silence, and it was a silence of three parts.”</blockquote><blockquote>Excerpt From: Rothfuss, Patrick. “The Wise Man’s Fear.”</blockquote><p><em>Much like the silence of the Waystone Inn, the architectural backend of Tales of Ethoas — Eternal Struggle consists three major parts</em>.</p><p>Eternal Struggle is a fast-paced, real-time multiplayer action RPG for mobile platforms. I know, I know, that’s quite the mouthful.</p><p>Let’s break it down:</p><ul><li><strong>Fast-paced, real-time</strong>: based on some preliminary user testing of a random group of people (N=20), the average player will issue 8 actions per second. Some will go up to 20–30+ actions per second. All of this is happening in real-time, so there are no turns in the game like there would be in chess, for example.</li><li><strong>Multiplayer</strong>: each game session can host up to 4 players. This means that in a full game room I’m expecting on average 32 actions/second up to 80–120+ actions per second. Players can see and interact with each other in the game in real-time.</li><li><strong>Action RPG (Role Playing Game)</strong>: the typical core game loop in action RPGs is based on the player getting stronger with each game session by killing monsters, gaining items and new skills. Typical examples would be <em>Diablo</em> or <em>Path of Exile</em>. As Eternal Struggle is a mobile-first game, I’m designing each game session to last 10–15 minutes on average.</li><li><strong>Mobile platforms</strong>: fairly self-explanatory, but it just means that the (main) target platforms are iOS and Android.</li></ul><p>It’s important to establish and understand these concepts as they heavily influence the overall system’s design. <em>Every game is different and what exactly your architecture should look like will depend on what your end goal is.</em></p><h3>Three parts</h3><p>While in this post I’m not going to go into details on how each tier works, I’m going to give you an overview of what’s involved in each and how they interact with each other.</p><p>We’ll dive into the specifics in upcoming posts.</p><h4>Client (Frontend)</h4><p>The game client is <em>the thing</em> that runs on the end-users physical device. It contains all the assets for the game but none of the actual game logic. Its role is to display the game in action to the user, send input from the user to the authoritative game server and process its output.</p><p>It is built in <strong>Unity3D</strong> with <strong>C#</strong>.</p><h4>Web (Backend)</h4><p>The web backend where <em>metadata</em> for the game is accessed. Metadata in this context is anything from user data to configuration that the game servers use to calculate how certain actions are executed.</p><p>It hosts both external and internal APIs, both with different authentication methods. Internal APIs are only accessible for trusted sources — e.g. the game server — , while external APIs are only accessible with authenticated user credentials.</p><p>It is written in <strong>Python 3.7</strong> with the <strong>Chalice</strong> serverless framework and runs on <strong>AWS Lambda</strong>.</p><h4>Game Server (Backend)</h4><p>The game server hosts the <em>actual game logic</em> for Eternal Struggle. It takes input from the users, validates and acts on them accordingly. It is the meat and sauce of the game.</p><p>It is built in <strong>Unity3D</strong> as a game server linux build and is hosted on top of <strong>AWS GameLift</strong>.</p><p>Through the GameLift API, players can request new game sessions. If there’s a free game server process in the fleet, it gets notified, loads in a bunch of data from the web backend, generates a game session and notifies GameLift that it’s ready. The game client periodically checks in with the GameLift API and when it sees that the game session is ready, it establishes a direct TCP connection with game server. The player then joins the game and starts playing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/516/1*PXViybojE4NOLEvAok1aZw.gif" /></figure><p>I’m a very visual person, so for me visualizing the architecture through diagrams helps a lot in understanding how certain pieces connect. The following chart is a rough depiction of the whole architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dUzS5iNDzYrzP8NYJDYGbA.png" /></figure><p>This might look intimidating at first but in upcoming posts we’ll dissect the different components and take a deeper look at how they actually work together.</p><p>There’s a lot of thought that needs to go into systems design and it’s even tougher when it comes to stateful services. What tools you choose to run your game will heavily depend on the resources available to you. I’m relatively well-versed in AWS technologies, Unity3D, C# and Python (among other languages and tools), so for me it made sense to build my system around these technologies. As a solo developer I feel I need to utilize my own skill set to the best of my abilities and so this is what I ended up with.</p><p>I find that in the indie game development scene we rarely talk about the complexities of multiplayer games. Perhaps it’s down to the fact that building a multiplayer game is <strong><em>objectively hard </em></strong>and so it’s out of scope for most developers. Perhaps I just haven’t found the right resources yet. In any case, I’m really interested to hear about your solutions, tool choices and struggles along your own journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4702b78ec6cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Ethoas]]></title>
            <link>https://rockbag.medium.com/building-ethoas-f5e46859c664?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5e46859c664</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[ethoas]]></category>
            <category><![CDATA[intro]]></category>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Wed, 29 Apr 2020 21:16:53 GMT</pubDate>
            <atom:updated>2020-04-29T21:16:53.213Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUn4MhvGi8aIaClDv6mPPg.jpeg" /></figure><blockquote>The World Was Once Dark…</blockquote><blockquote>Dark as though a giant’s ink plot had fallen over and spilled onto the map of all there was, drowning the inhabitants in murkiness. Dark as though the sun that burned so hot and so high in the sky was snuffed out like little more than a candle. Dark as though evil seeped from the ground to spread it’s pestilence throughout the world known as Ethoas. — Skyler Hammond</blockquote><p><em>So begins the tale of the Purge a war so treacherous none like it had been seen before, and none like it since.</em></p><p>I first started working on the world of Ethoas over 7 years ago. Back then I only had a notion of where I wanted to get to. It’s been tough, surprising and pleasant. I cycled trough many prototypes rapidly, had the chance to work with wonderful people and learned a lot on my adventure. I still am.</p><p>Though the first game in the series, Tales of Ethoas — Eternal Struggle, is still in preproduction, there’s so much I’ve learned that I wanted to share with people who are just starting out on a similar journey.</p><p>We’ll venture into the depths of technical trenches, sail through the muddy waters of game design and discuss all the heavy thoughts and work that goes into building a high-fantasy world from scratch.</p><p>I can promise you exciting debates, interesting solutions and many, many failures.</p><p>The adventure awaits.</p><p><em>The only question is: </em><strong><em>will you join me?</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5e46859c664" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why you should pin your docker images with SHA instead of tags]]></title>
            <link>https://rockbag.medium.com/why-you-should-pin-your-docker-images-with-sha-instead-of-tags-fd132443b8a6?source=rss-9a7445a2db5a------2</link>
            <guid isPermaLink="false">https://medium.com/p/fd132443b8a6</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[Bálint Biró]]></dc:creator>
            <pubDate>Wed, 29 Apr 2020 14:01:19 GMT</pubDate>
            <atom:updated>2020-04-29T14:01:19.288Z</atom:updated>
            <content:encoded><![CDATA[<p>Docker is an amazing tool. I’ve been utilising it from development all the way through to production and it made my life so much easier. Doesn’t matter how big or small your company is, there’s a good chance you can make use of containers in some shape or form.</p><p>Docker has gained a lot of popularity over the last 6 years. More and more companies are adopting it and are building cool technologies on top of it.</p><figure><img alt="Google Trends search for Docker from 2004-present" src="https://cdn-images-1.medium.com/max/1024/1*7ii5wobZVFxUhq7sYcDAdQ.png" /></figure><p>As with any technology that’s rapidly adopted, there’s going to be a widespread difference in emerging practices amongst different companies. One such practice is versioning.</p><p>Docker offers a built-in versioning technique through tagging. A typical docker image will take on the form of image_name:tag. The default tag is called latest, so for example if you want to grab the latest ubuntu image you can just docker pull ubuntu and docker will infer that you’re looking to pull ubuntu:latest. You can also specify tags if you want to grab a specific release of ubuntu. For example, by issuing docker pull ubuntu:18.04 you’re instructing docker to grab the <em>latest</em> available upstream version of Ubuntu Bionic.</p><p>Each image is also associated with a digest SHA — very much like a git commit. By specifying the SHA instead of the version tag, you can pull a specific version of the image. Something like docker pull ubuntu@sha256:sha_digest_here.</p><p><em>So why is this important?</em></p><p>Let’s take a docker-based CI/CD system for example. Imagine that your build pipeline is using docker containers to build/test/deploy your application. What this means is that your build/test/deploy commands will be running inside a docker container. Ideally you’re using very similar docker containers for building and running your application. For the sake of simplicity, let’s consider you’re always pulling the ubuntu:18.04 image to launch your build container off of. Something like</p><pre>build:<br>  image: ubuntu:18.04<br>  commands:<br>    - ./build_my_wonderful_app.sh</pre><p>—</p><p>It’s your regular Monday morning and you have a couple of changes that you’d want to push through. You create your PR and wait for the build to get green… but it doesn’t. You see some weird error that you’ve never seen before but you go through the usual hoops to troubleshoot.</p><p><em>Is it an actual code issue? Is it a flaky test? Is it a poorly-written dependency that does not pin transitive dependency versions correctly? Is it a bit flip caused by a cosmic ray?</em></p><p>Several hours down the drain you’re pulling your hair out and start contemplating your life choices. Then it hits you — it must be your build container. Sure enough, you go to the official image’s github page (hoping it exists) only to see there was a new commit merged back into ubuntu:18.04.</p><p>You go back to your old build logs and compare the container’s SHA to the SHA in your new build and sigh in a disdainful relief; that’s it.</p><p>So what do you do? Well, you either update your build process to work with the new version or you can pin your build image using the container SHA and create a ticket to solve this <em>correctly later</em>. After all, the change might be a legit cause for concern — such as a critical CVE or bugfix — but I’ll leave that decision up to you.</p><p>—</p><p>I think as developers we are used to seeing versions as “that’s the exact thing I need, so I’m safe to use that”, however this way of looking at docker tags is not quite correct. Long time support for certain base images is expected and so changes will be introduced over time.</p><p>All in all, if you want to save yourself a headache, just pin your image to a SHA version like so:</p><pre>build:<br>  image: ubuntu@sha256:3235326357dfb65f1781dbc4df3b834546d8bf914e82cce58e6e6b676e23ce8f<br>  commands:<br>    - build_my_wonderful_app.sh</pre><p>You can find the SHA by either pulling the image (it shows the digest once the image is pulled) or by inspecting the image.</p><p>—</p><p><em>As with everything on the internet, take this article with a grain of salt. By pinning the container version to a specific SHA you’re trading off “avoiding potential build failures” for “getting potential security patches for free”. I personally prefer controlling these upgrades myself, but it’s completely valid if you don’t.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fd132443b8a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>