<?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 Silvio Carrera on Medium]]></title>
        <description><![CDATA[Stories by Silvio Carrera on Medium]]></description>
        <link>https://medium.com/@silviocarrera?source=rss-bcaf3b00890------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*pROJjShm-hxxxs8rklkC4A.jpeg</url>
            <title>Stories by Silvio Carrera on Medium</title>
            <link>https://medium.com/@silviocarrera?source=rss-bcaf3b00890------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 19:58:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@silviocarrera/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[Building a C++ Game Framework by Recreating 10 Classic Games]]></title>
            <link>https://silviocarrera.medium.com/building-a-c-game-framework-by-recreating-10-classic-games-da2b1026f3fe?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/da2b1026f3fe</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cplusplus]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Tue, 21 Jul 2026 16:01:02 GMT</pubDate>
            <atom:updated>2026-07-21T16:01:02.032Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*cdwabwdWzuRO-Lg4lmfPQg.gif" /></figure><p>Ten classic games. Ten engineering challenges. One evolving C++ game framework. This article explores the architecture, design decisions, and lessons learned while building BrightLib.</p><p>Over the last few months, I’ve been working on a C++ game framework called BrightLib. Rather than designing it in isolation, I chose to evolve it by building a series of increasingly complex games, adding new features only when the projects demanded them.</p><p>Each project was based on a game from the 1970s, 1980s, or 1990s. I chose ten games, each introducing more gameplay mechanics than the last. As the series progressed, I also aimed for greater fidelity to the originals: the early projects relied on simple geometric graphics and no sound, while the later ones added spritesheets, sound effects, and music.</p><p>I’ve used many libraries, frameworks, and engines to build games over the last 15 years, from XNA to Phaser and from RPG Maker to Unreal. Unity, Flixel, Love2D, and Godot — they all have their pros and cons. Some are made by corporations and intended to be generic, while others are tailored for a particular style of game. Some come with a lot of baggage and convention, while others are built to be ergonomic and easy to use. There is no “best” engine, tool, or framework for making games.</p><p>For BrightLib, I wanted to make game development easy, with a focus on 2D games of any genre. My guiding question was, “How long does it take to get a character moving on screen?” Frameworks such as Flixel, Phaser, and Love2D are the closest to the style I wanted to achieve, while the overall structure also draws inspiration from Unity and Unreal.</p><p>The BrightLib framework is responsible for Input, UI, Collision, and other areas; each is a separate service. The game itself is a series of states that control the game flow. Each state can instantiate entities, and each entity contains components that determine the game’s behavior. The UI is independent of the game and responds to triggered events. There is a global event service, as well as local events that any class can create. Services are intentionally few and persist for the lifetime of the game.</p><p>With that in mind, my core goal with BrightLib was to create a framework that made it easy for developers to structure their games clearly and consistently. I also wanted to avoid overly complicated setups and verbose code for its own sake. So classes and services all have simple names and are straightforward to use.</p><p>The following is a deep dive into each project, why I decided to work on them, and how they helped the framework grow.</p><h3>1. Breakout</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*2VUsDSDMmtDrPykhehtt1w.gif" /></figure><p>Breakout is a classic. It’s a staple for game programmers to replicate it when learning any programming language. There are countless versions, but the core concept remains the same: a paddle, a ball, and a series of blocks.</p><p>The player’s core actions are moving left and right. The ball moves continuously until it bounces off the paddle or block. The blocks sit there and break once hit. The win condition is to clear all the blocks, and you lose if you run out of balls.</p><p>Since this was the first project, much of it was pure SFML. The framework itself did not grow by much here. I focused on initializing the SFML window before creating any game elements. I also added separate steps for the update and draw functions.</p><p>The ball, block, and paddle are distinct classes as expected. They already hint at a GameObject/Entity with components, but since this is the first project, I decided to keep it simple and use regular classes.</p><pre>//simple paddle constructor<br>Paddle::Paddle(float x, float y)<br>{<br> startX = x;<br> startY = y;<br> this-&gt;x = x;<br> this-&gt;y = y;<br> width = 100.0f;<br> height = 20.0f;<br> speed = 400.0f;<br> <br> //with sf::Shape you can easily draw and check for collision<br> shape.setSize({ width, height });<br> shape.setFillColor(sf::Color::White);<br> shape.setPosition(sf::Vector2(x, y));<br>}</pre><p>Each class owned an SFML shape, and with that shape, I would get the bounds for collision detection and the color to draw with. With the game objects drawing and moving correctly, I moved on to collision detection.</p><p>I created a simple function to check collision between a circle and a rectangle. If the ball collides with the paddle, flip the ball’s velocity; if it hits a block, break the block in the process.</p><p>As a first project, I wanted the fidelity to be quite low. The focus was more on getting the core mechanics working so I could get the ball rolling on my 10-project plan.</p><h3>2. Pong</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5c7Q317efATuxs9mjMwYQA.gif" /></figure><p>Although the original Pong was released before Breakout, in my head, it made perfect sense to be my next project. I already had a paddle and a ball; all I needed was another paddle. As an additional challenge, I decided to use an AI paddle instead of two players. Also, it would be the first project to have UI elements.</p><p>I started by copying the previous project and setting up the solution in Visual Studio. This would become a core initial step moving forward: create a project in VS, configure it, and copy the previous project’s code. This allowed me to move extremely fast . The framework always lived alongside the current game project, so its latest version was simply the one in the newest project.</p><p>I created my first UI element and kept it separate from the game. This first View class would eventually become the base class for BrightLib’s UI.</p><p>How it works: the main function knows the game elements, such as the paddles and the ball, and the UI. When the ball exits the screen, it triggers an event whose callback, registered by the main function, updates the score and notifies the UI.</p><pre>//initially, how the main function registered for callback from the ball<br>ball.onExitedLeft.subscribe(handleBallExitedLeft);<br>ball.onExitedRight.subscribe(handleBallExitedRight);</pre><p>For now, the main function is responsible for manually updating the UI here; it is a first step toward separating view/presentation from logic/state. In later projects, the UI would bind itself to events, making the game truly independent of it.</p><p>I kept the AI simple; it follows the ball’s movement with a slight delay. I used separate classes for a PlayerPaddle and an AIPaddle, which allowed me to move faster.</p><p>The collision didn’t change much, and you can start to spot some cracks in the logic when hitting the ball at certain angles. The fidelity is closer to the original, and we have our first UI. Even though most of the game still happens on the main function, we can already spot opportunities for encapsulation and separation of concerns.</p><p>With another project down, I wanted to increase the difficulty by allowing the player to move in 4 directions.</p><h3>3. Snake</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*M1kTx3VhzN5GiBmGkIy6ig.gif" /></figure><p>If you’re over 30, you’re bound to know Nokia’s Snake. I remember spending hours playing it on a Nokia phone’s tiny keypad.</p><p>The gameplay is simple yet surprisingly challenging. It feels like an arcade game. We go from moving in two directions to four directions. The snake is made of smaller pieces that move together, and it grows when it eats fruit. It all adds up to a nice challenge.</p><p>As an additional challenge, I decided to implement a high score that persists between sessions. It’s just a simple text file, but it became the base for the save service that I would use in later projects.</p><p>The BrightLib framework grew as I added a CollisionService class and moved all the collision checks into it. I created a subfolder for the UI, added my View class, and added a ViewService responsible for opening and closing views.</p><p>Another big change was the addition of an FSM to control the game state. Since Pong had already added a separation between the game and the UI via events, the FSM served as the glue. It allowed me to introduce two states with very little effort: a TitleState, which displayed a TitleView and waited for input, and a PlayState, where the game took place.</p><pre>BrightFSM gameFsm;<br>gameFsm.setInitialState&lt;Title_GameState&gt;();<br>gameFsm.addState&lt;Play_GameState&gt;();<br>gameFsm.enterInitialState();</pre><p>When compared to an MVVM or MVC architecture, you can think of each game state as playing a role similar to a controller, which, while it is the glue between presentation and business logic, shouldn’t own any of that logic itself; it should know who owns it.</p><p>That’s why I emphasize that the shared state/data should not live in the Game’s FSM; instead, they should live in their own services. For this project, I added a MatchService that is responsible for keeping track of the current score and highscore at runtime. This allows both the TitleState and PlayState to access that score without either owning it.</p><p>I’m still using unique classes for each game object. Here, the centerpiece is the Snake class. It is responsible for handling input to move the snake and has a grow function. In the PlayState, when a collision check between the snake and the fruit returns true, we grow the snake.</p><p>The PlayState itself has substates, which give me more control over the game. When the player eats a fruit, I switch to a substate and wait a few milliseconds to provide the player with hit-pause feedback. This simple solution would be used again in more complex game scenarios in the next projects.</p><p>The project’s core structure solidifies here. BrightLib offers services (UI, Collision, and so on). The game has an FSM, and each state can have game objects and access services. Each game can and should have its own services to control shared state/data. In simple terms, the architecture becomes layered: the UI depends on the game, and the game depends on services.</p><h3>4. Asteroids</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*MbsXCxsWab0LpBsn-M8clw.gif" /></figure><p>Since I was already moving in four directions, why not allow rotation too? I decided to work on Asteroids to focus on implementing two things: pools and spawners.</p><p>The player can shoot, and asteroids are flying everywhere. I could get by with a static number of asteroids and bullets in a regular array, but the idea is to improve the framework by building a solution that scales for other situations.</p><p>Before working on pooling, I needed to develop another core concept: an entity. In previous projects, I had distinct classes for each element. Although they all already had update and draw methods, they remained distinct classes. The first step here was to make the entity class the base for all other entities and to introduce the concepts of active and inactive.</p><pre>//setting up the asteroid spawner<br>asteroidSpawner.addSpawnPoint({ -5.0f, -5.0f });//topleft<br>asteroidSpawner.addSpawnPoint({ -5.0f, GameConstants::WINDOW_HEIGHT + 5.0f });//botleft<br>asteroidSpawner.addSpawnPoint({ GameConstants::WINDOW_WIDTH + 5.0f, -5.0f });//topright<br>asteroidSpawner.addSpawnPoint({ GameConstants::WINDOW_WIDTH + 5.0f, GameConstants::WINDOW_HEIGHT + 5.0f });//botright</pre><p>With the entity class created, I could start working on a pool class.</p><p>The key benefit of pooling is that all required objects are allocated up front. During gameplay, entities are activated and deactivated as needed, eliminating repeated runtime allocations and deallocations. This provides a predictable way to reuse game objects that constantly spawn and get destroyed during gameplay.</p><p>When the player shoots, I can now get the first available bullet (the inactive one) from the pool and use that. No additional allocations are required.</p><p>The asteroid spawner works similarly. All the spawner does is run a timer; once the timer is up, it requests an available object from the provided pool and spawns it within the specified range.</p><p>One of the last things I worked on was the thruster effect on the player’s ship. I wanted to add feedback when the player entered input. By drawing a separate shape behind the ship and varying its size over time, I was able to create a convincing thruster effect.</p><p>With entities and pooling in place, subsequent projects could build new features on top of these foundations.</p><h3>5. Space Invaders</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Rh_MeKfBXQChLqzKNtpISA.gif" /></figure><p>Space Invaders is arguably one of the most important games ever made. You can find many famous developers, like Mario’s Shigeru Miyamoto and Dragon Quest’s Yuji Hori, saying that after playing Space Invaders, they saw the potential of video games.</p><p>Besides inspiring an entire generation of developers, it also introduced gameplay that is surprisingly rich from a programming perspective.</p><p>I also wanted the visuals to be much closer to the arcade original, while still limiting myself to basic geometric shapes. Sprites would have to wait a bit longer.</p><p>An important addition was the EntityService.</p><p>Up until this point, each game state was responsible for manually keeping track of every entity and calling their update and draw functions. As the number of entities grew, this quickly became repetitive and difficult to maintain.</p><p>The EntityService took ownership of all entities and centralized their lifetime using std::unique_ptr. It became responsible for creating, initializing, updating, drawing, and destroying entities. It also automatically skipped inactive entities, making it work naturally with the object pools I had introduced in Asteroids.</p><p>With entity management centralized, the game states could focus on gameplay rather than bookkeeping. It also helped me shift focus to the next main feature: components.</p><pre>//creating the player<br>player-&gt;addComponent&lt;PlayerInputComponent&gt;();<br>player-&gt;addComponent&lt;PlayerShipRenderer&gt;();<br>player-&gt;position = { <br>  GameConstants::WINDOW_WIDTH / 2, <br>  GameConstants::WINDOW_HEIGHT - (renderer-&gt;shape.getLocalBounds().size.y * 3) <br> };<br>player-&gt;rotation = sf::degrees(-90.0f);<br><br>//...<br><br>//creating one enemy type<br>entity-&gt;position = position;<br>entity-&gt;score = EnemyShip::ENEMY_A_SCORE;<br><br>auto&amp; renderer = entity-&gt;addComponent&lt;RectangleRenderer&gt;();<br>renderer-&gt;shape.setPointCount(4);<br>renderer-&gt;shape.setPoint(0, { 0.0f, -16.0f });   // top<br>renderer-&gt;shape.setPoint(1, { 10.0f, 0.0f });     // right<br>renderer-&gt;shape.setPoint(2, { 0.0f,</pre><p>The player and enemies needed similar functionality, such as shooting, which made it the perfect opportunity to work on components that isolated that behavior and could be reused by different entities.</p><p>Entities update their attached components, allowing behaviors to be shared. Instead of creating deep inheritance hierarchies, behaviors could now be mixed and matched by attaching components to entities.</p><p>I added an entity factory class that communicates with my EntityService. Rather than constructing entities manually, the factory assembles them by adding the appropriate components. Like entities, components can also be enabled or disabled, making it easy to temporarily turn individual behaviors on or off without removing them.</p><p>In addition to components specific to this game, I also created core rendering components that wrap SFML shapes. This way, I could create an entity and add as many renderers as I needed to draw a complex shape.</p><p>As the project grew, I wanted to ensure the separation between game and framework code was clearer. Generic systems gradually moved into BrightLib, while gameplay logic remained inside the game.</p><p>One interesting part is that the shield is not a single object. It is built from many tiny shield parts, each managed as an individual entity. As bullets collide with them, individual pieces disappear, recreating the destructible shields from the original game with a surprisingly simple implementation.</p><p>A final improvement to BrightLib was the inclusion of an InputService that maps keys to commands. This allowed the game code to check whether the shoot button was pressed instead of a specific keyboard key. This abstraction became essential when I later added 2-player support and UI navigation.</p><p>Space Invaders marked the point where BrightLib stopped feeling like a collection of utilities and started feeling like a real framework. Entities, components, centralized lifetime management, and input mapping became the foundation that every subsequent project would build upon.</p><h3>6. Bomberman</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*nL5NOmUk7TUdoviE-GzDDA.gif" /></figure><p>I’ve always found Bomberman a charming game, probably because I played it at an impressionable age. It also happened to be the perfect project to focus on introducing one major new feature: a tilemap.</p><p>In previous projects, the levels were simple enough that a list of manually placed entities was sufficient. For Bomberman, the levels are naturally represented as grids of square tiles, making it an ideal project for introducing a tilemap.</p><pre>//the first version of the tilemap is simple and straightfoward<br>float tileSize = 32.0f;<br>sf::Vector2f tilemapOffset = sf::Vector2f{ 208.0f, 96.0f };<br>std::vector&lt;std::string&gt; level =<br>{<br>    &quot;#################&quot;,<br>    &quot;#...............#&quot;,<br>    &quot;#.#2#.#2#2#.#2#.#&quot;,<br>    &quot;#.....2...2.....#&quot;,<br>    &quot;#2#.#2#2#2#2#.#2#&quot;,<br>    &quot;#...2.......2...#&quot;, // start row<br>    &quot;#2#.#2#2#2#2#.#2#&quot;,<br>    &quot;#.....2...2.....#&quot;,<br>    &quot;#.#2#.#2#2#.#2#.#&quot;,<br>    &quot;#...............#&quot;,<br>    &quot;#################&quot;<br>};</pre><p>To keep the implementation simple, the first version of the tilemap was built as a collection of entities. Each entity is of a specialized type Tile. Since Bomberman levels are small, this approach provided enough performance while allowing the system to integrate naturally with the existing entity architecture.</p><p>The tilemap class can parse a matrix of strings to create the level and provide collision checks between entities and the tilemap.</p><p>I then moved on to implementing the bomb mechanic. Although the bomb mechanic appears more complex, it is actually very similar to a bullet. I was able to reuse the ShootComponent I made for Space Invaders, and instead of shooting a bullet, I now spawn a bomb. Again, this showed the benefit of pooling and spawners. When the bomb explodes, I check its blast area against breakable walls and deactivate them if they are hit.</p><p>The core gameplay loop was not implemented, as the goal of this project was to focus on the tilemap. With that implemented, I had the foundation needed for future maze-based games. The next project would build on this by introducing another game where navigation through a maze was essential.</p><h3>7. Pac-Man</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*pqkr1VZ-cuoFwNvI31VURg.gif" /></figure><p>On the surface, Pac-Man seems like a simple game. In reality, it’s surprisingly complex. Tight controls, distinct enemy AI, and deceptively simple mechanics make it a much more interesting programming challenge than it first appears.</p><p>My main focus was on the controls and the AI. I started by playing the original game extensively to get a better feel for its controls. It took many iterations to get the controller working just right.</p><p>After the controls felt right, I added the collectible pellets. Their implementation is simple — a collision check that increments the player’s score — but they complete the game’s core loop.</p><p>I then moved on to the AI. I began by researching the original game and understanding how each ghost behaved. Blinky (the red ghost) was first because his behavior is the simplest: he continuously targets Pac-Man’s current position.</p><p>Each time a ghost reaches an intersection, it evaluates the available directions and chooses the one that brings it closest to its current target tile. That target differs for each ghost, which is what gives each one its distinct personality.</p><p>The other ghosts all build on that same core algorithm. Pinky targets a position ahead of the player. Inky (blue ghost) alternates between Blinky’s and Pinky’s behavior. The final one, Clyde (orange ghost), targets Pac-Man’s position when far away, but once he gets close enough, he changes his target to one of the corners of the level.</p><p>The combination of the four ghosts is what really makes the magic happen. It feels like they are working together to flank you, but in reality, they are unaware of each other.</p><p>Pac-Man ended up being one of the projects I’m most proud of. By this point, BrightLib had matured enough that I could spend most of my time refining gameplay instead of building framework features. That shift in focus shows in the final result.</p><h3>8. Frogger</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*mWHdkGPJl_r9j01LmmH1uQ.gif" /></figure><p>Frogger combines many of the features I’d already built — four-directional movement, tilemaps, and enemies moving independently across the screen — while introducing a few interesting new mechanics.</p><p>The main new mechanic was moving platforms. Once the player stands on a log or turtle, their movement is combined with the platform’s, allowing them to be carried across the river. The turtles reuse the same moving-platform logic but periodically dive underwater, temporarily becoming unsafe.</p><p>Frogger became an exercise in composition. Rather than introducing entirely new systems, I focused on combining the existing tilemap, entity, and component systems to implement new gameplay mechanics.</p><p>Most moving hazards — cars, logs, and turtles — share the same movement components, with only small differences in behavior. That reuse was exactly the kind of composition I wanted BrightLib to encourage.</p><p>In terms of graphics, you can already spot that I’ve reached the ceiling in terms of what I can pull off with basic shapes. It really took quite a few iterations to get the frog looking like… something that looks like a frog? I hope? I had to add several shapes and position them in a way that really made me wish I had sprite support.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*rFBRdDYELg9x-u0zBi_JZg.gif" /><figcaption>Evolution of the Frogger Project</figcaption></figure><p>By this point, BrightLib had enough reusable pieces that implementing Frogger became more about combining existing systems than writing entirely new ones. That was exactly the direction I wanted the framework to evolve.</p><p>The controls also feel nice. After spending so much time refining Pac-Man, I wanted to keep that same level of responsiveness here.</p><h3>9. Donkey Kong</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FW-DbM3gm45c%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DW-DbM3gm45c&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FW-DbM3gm45c%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/383b7692b71a7af116f6bc68f31d9f3d/href">https://medium.com/media/383b7692b71a7af116f6bc68f31d9f3d/href</a></iframe><p>Having reached the limit of what I could draw with basic geometry, one of the core features of Donkey Kong I wanted to add was spritesheets and animation.</p><p>By this point, all the visuals you see were drawn using simple SFML shapes — either one shape or a combination of shapes that an entity was responsible for with renderer components.</p><p>For Donkey Kong, I finally added my own SpriteRenderer component that could draw textures instead of simple shapes. To support that, I introduced a TextureService responsible for texture ownership and lifetime.</p><p>The service owns every loaded texture, caches them in a std::unordered_map, and returns references to the cached textures. This centralizes texture management, avoids duplicate texture loads, and allows multiple entities to share the same texture.</p><p>Because services are guaranteed to outlive all entities, SpriteRenderer components can safely hold references to those textures without sharing ownership. This keeps ownership explicit while avoiding the overhead of reference counting.</p><pre>//texture service<br>auto it = m_textures.find(filename);<br>if (it != m_textures.end())<br>{<br>    return *it-&gt;second;<br>}<br><br>auto texture = std::make_unique&lt;sf::Texture&gt;();<br>std::string path = DIRECTORY_PATH + filename;<br>if (!texture-&gt;loadFromFile(path))<br>{<br>    std::cerr &lt;&lt; &quot;[TextureService] Failed to load texture: &quot; &lt;&lt; path &lt;&lt; std::endl;<br>    return m_fallbackTexture;<br>}<br><br>...<br>//usage<br>const sf::Texture&amp; texture = Services::Bright().Textures().get(&quot;player.png&quot;);<br>auto* spriteRenderer = entity-&gt;addComponent&lt;br::SpriteRenderer&gt;(texture, textureWidth, textureHeight);<br>...</pre><p>With textures loading and rendering correctly, it was time to add animation. Similarly, I created an Animator component that requires a SpriteRenderer reference. The core two elements for an animation to play are: the Animator component and the Animation class.</p><p>I deliberately kept the Animator separate from the Animation class. An Animation is simply immutable data describing a sequence of frames and playback settings. In contrast, the Animator owns all runtime state, including the current animation, frame index, timers, and pending transitions.</p><p>The Animator is responsible for advancing the animation over time and updating the SpriteRenderer with the correct frame. It also exposes events, allowing gameplay code to respond to frame changes or animation completion without tight coupling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/118/1*T69gbWAqoTabic_OXILXfg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/93/1*s3TTpVh4qHK1MoOzesGE_g.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*4qeNEyR0v2gcCPE1aT6SlQ.gif" /><figcaption>Animations powered by BrightLib’s new SpriteRenderer and Animator components.</figcaption></figure><p>Another major addition was Audio.</p><p>Like the TextureService, I wanted audio management centralized rather than having entities load and manage audio files themselves. The AudioService is responsible for loading, caching, and playing both music and sound effects.</p><p>Music and sound effects are handled differently. Since only one music track can play at a time, the service owns a single sf::Music instance and swaps the currently playing track when requested. Sound effects, however, are short-lived and can overlap, so I introduced a SoundPool to manage multiple sf::Sound instances.</p><p>The service caches each sf::SoundBuffer, so audio data is loaded from disk only once. When a sound effect is requested, the SoundPool finds an available sf::Sound, attaches the cached buffer to it, and starts playback. If every sound is currently in use, the pool grows by creating one additional sf::Sound. This keeps the expensive audio data shared while reusing playback objects whenever possible.</p><p>Entities and game states never own audio resources. They request that a sound or music track be played, leaving loading, caching, lifetime management, and playback entirely to the AudioService.</p><pre>//...AudioService&#39;s PlaySFX<br><br>//try play from cache <br>auto it = m_sfxsCache.find(sfx);<br>if (it != m_sfxsCache.end())<br>{<br>    sf::Sound&amp; sound = m_soundPool.getAvailable(*it-&gt;second);<br>    sound.play();<br>    return;<br>}<br><br>//load <br>auto buffer = std::make_unique&lt;sf::SoundBuffer&gt;();<br>if (!buffer-&gt;loadFromFile(SFXS_DIRECTORY_PATH + sfx))<br>{<br>    return;<br>}<br><br>//cache and play<br>auto&amp; storedBuffer = *buffer;<br>m_sfxsCache[sfx] = std::move(buffer);<br><br>sf::Sound&amp; sound = m_soundPool.getAvailable(storedBuffer);<br>sound.play();<br><br>//...</pre><p>Donkey Kong was a major leap in every aspect. It was the most mechanically complex game I’d attempted so far, introducing jumping, climbing ladders, and several new interactions, while also bringing animated sprites, music, and sound effects to the framework. The only notable mechanic I left out was the hammer. Other than that, I wanted the visuals and the audio to match as closely as possible.</p><p>I also put a lot of work into visual feedback. Jumping over a barrel displays the score awarded, just like in the original game. I reused the brief hit-pause effect introduced in earlier projects to give those moments a satisfying sense of impact.</p><p>Donkey Kong brought together everything I’d built up to that point. It reused pooling, spawning, collision detection, tilemaps, and the entity/component architecture while introducing the framework’s biggest additions yet: sprite rendering, animation, and audio.</p><h3>9 and 1/2. Super Pong</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQ54nLGW9Tro%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQ54nLGW9Tro&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQ54nLGW9Tro%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/620827c2e00ba087767cc79a382d047a/href">https://medium.com/media/620827c2e00ba087767cc79a382d047a/href</a></iframe><p>I know I said I would only do 10 projects. So what is Pong doing here again? After such a large leap with Donkey Kong, I wanted a smaller project before moving on. Since I didn’t want to stop and lose momentum, I decided to redo a previous project with the latest version of the framework.</p><p>I had a couple of ideas for Pong floating around after I finished it, so I decided to revisit it. The plan was to rebuild Pong using the latest version of BrightLib, this time with better graphics, audio, gameplay, a two-player mode, and multiple AI difficulty levels.</p><p>The first step was recreating my original Pong using the latest version of BrightLib. This time, instead of dedicated Ball and Paddle classes, everything was built using entities and components. Sprites replaced geometric shapes, and audio was added for paddle hits and scoring.</p><p>I added visual feedback when a player scores and created a new renderer that makes it easy to draw lines. The thick center line adds a lot to the game. I also added a new ScaleAnimator component, which applies a quick punch-scale animation whenever the ball hits a paddle. It’s a tiny effect, but it makes each hit feel much more impactful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*dJONw6CaQEYjodwJHD2N1w.gif" /></figure><pre>//as I mentioned it, keep it simple<br>m_menu.setOptions({ &quot;Player vs AI&quot;, &quot;Player vs Player&quot; });<br>m_menu.setPosition(<br>    windowCenter.x - m_menu.getWidth()/2.0f,<br>    (m_menuTitle.getPosition().y + m_menuTitle.getLineSpacing() + 35.0f)<br>);<br>m_menu.setAudio(GameConstants::Audio::SFX_UI_SELECT, GameConstants::Audio::SFX_UI_CONFIRM);</pre><p>To support both two-player and AI modes, I added a generic Menu UI component. It displays selectable options, handles navigation, highlights the current selection, and notifies the game when the player makes a choice.</p><p>With both modes working, I spent a bit of time tinkering with the AI. Since I already had my new menu element in place, adding selectable AI difficulty levels became straightforward.</p><p>The final addition was a generic TrailRenderer component, which I used to create the ball’s motion trail. Like the ScaleAnimator, it wasn’t built specifically for Pong — it became another reusable piece that future games could take advantage of.</p><p>Revisiting Pong validated the direction BrightLib was heading. Rebuilding a game I’d already made took far less effort than the first time, allowing me to spend my time adding polish, gameplay improvements, and reusable features instead of rebuilding infrastructure. That was exactly the outcome I’d hoped for when I started building BrightLib.</p><h3>10. River Raid</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7wTPjELO00Q%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7wTPjELO00Q&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7wTPjELO00Q%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e46bb22f0734c7dbbaf28cc7344e04c/href">https://medium.com/media/8e46bb22f0734c7dbbaf28cc7344e04c/href</a></iframe><p>River Raid is one of the games I had always heard about, but had never played. I got my start with games on the SNES, so River Raid was before my time. That being said, I often remembered fellow devs mentioning it.</p><p>After playing it, I was surprised by how well its mechanics still hold up today. The gameplay still felt great, with tight acceleration when moving left/right and a thruster to control the speed. It still feels remarkably modern.</p><p>My main reason for choosing it was its continuously scrolling world, which made it the perfect project for rethinking BrightLib’s tilemap system.</p><p>My old tilemap system, built around individual entities, had worked well for the previous projects, but River Raid pushed it beyond its limits. The entire level is visible on-screen, and the world scrolls continuously as new terrain is generated. Updating and drawing hundreds of tile entities every frame was no longer a scalable approach.</p><p>I reworked the tilemap into a single object that handles both the map data and its rendering. Instead of storing an entity for every tile, the tilemap owns a lightweight grid of Tile data objects that contain information such as the tile type, collision, and which region of the tileset texture to use. Since BrightLib already provided a TextureService, the tilemap could reference a shared tileset texture rather than loading its own resources.</p><pre>//...rebuildRenderData<br>for (const Tile&amp; tile : m_tiles)<br>{<br>    float x = tile.position.x;<br>    float y = tile.position.y;<br>    float s = m_tileSize;<br><br>    sf::Vertex v0;<br>    sf::Vertex v1;<br>    sf::Vertex v2;<br>    sf::Vertex v3;<br><br>    v0.position = { x, y };<br>    v1.position = { x + s, y };<br>    v2.position = { x + s, y + s };<br>    v3.position = { x, y + s };<br><br>    if (m_renderMode == RenderMode::Color)<br>    {<br>        v0.color = tile.color;<br>        v1.color = tile.color;<br>        v2.color = tile.color;<br>        v3.color = tile.color;<br>    }<br>    else<br>    {<br>        const sf::FloatRect&amp; uv = tile.textureRect;<br><br>        v0.texCoords =<br>        {<br>            uv.position.x,<br>            uv.position.y<br>        };<br>//...</pre><p>To render efficiently, I replaced hundreds of individual draw calls with a single sf::VertexBuffer. Whenever the map changes, the tilemap rebuilds a contiguous array of vertices representing only the visible tiles and uploads it to the GPU. Rendering the entire visible map in a single draw call is considerably more efficient than issuing one draw call per tile.</p><p>With the tilemap rendering solved, I focused on making it scrollable.</p><p>Rather than generating an entire level upfront, the tilemap continuously recycles itself. As time advances, the existing rows are shifted downward, a new row is generated procedurally at the top, and the vertex buffer is rebuilt to reflect the updated terrain.</p><pre>//... tilemap update method<br><br>if (m_scrollEnabled)<br>{<br>    m_scrollOffsetY += m_scrollSpeed * dt * m_shiftTimerDtModifier.current;<br><br>    while (m_scrollOffsetY &gt;= m_tileSize)<br>    {<br>        m_scrollOffsetY -= m_tileSize;<br>        m_distanceTravelled += m_tileSize;<br><br>        shiftRowsDown();<br>        generateTopRow();<br>        rebuildRenderData();<br>    }<br>}<br>//...</pre><p>Procedural generation controls the river’s width and curvature over time while also determining when fuel pickups, enemies, bridges, and other gameplay elements should appear. This approach allows the world to extend indefinitely while keeping memory usage and rendering work roughly constant.</p><p>I was tempted to improve the UI further. I planned to add a thruster gauge that matched the original UI style, but ultimately decided to stick with what I had.</p><p>To support continuous playback of the airplane engine sound, I added an option to play a repeating sound effect. I also made it possible to set the pitch. Just like the original, speeding up or slowing down changes the engine’s pitch, giving a subtle but surprisingly effective sense of speed.</p><p>River Raid fundamentally changed how BrightLib handled tile-based worlds. What started as a renderer for static maps became a system capable of efficiently rendering and updating large scrolling environments, opening the door to much larger games than the framework could previously support</p><h3>Conclusion</h3><p>Working on these games was a rewarding experience. Looking back, it’s satisfying to see how the framework evolved alongside them. Every project exposed a new problem to solve, and each solution became another building block of BrightLib.</p><p>Rather than working on a framework in isolation, I let the games drive the framework’s changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-HPaFsoOfMJexNGctOb_jQ.png" /></figure><p>One of my main goals was to build a performant and ergonomic framework for developing games in a directive style. Throughout the projects, I tried to keep a clear separation between flow control, shared data, presentation, and gameplay. I found that once those responsibilities are well defined, features become easier to implement, extend, and maintain.</p><p>I also wanted to keep the framework simple. Every class was introduced to solve a concrete problem I had encountered, not a hypothetical one. Features like animation, input mapping, and audio should require only a few lines of code to use, while the underlying systems remain reusable across projects.</p><p>Finally, I tried to avoid writing code that already existed elsewhere. Whenever possible, I relied on SFML and the C++ standard library instead of reimplementing functionality unnecessarily. BrightLib exists to help write game code on top of them — not to replace them.</p><p>My favorite project is still Donkey Kong, with Pac-Man as a close second. River Raid also grew on me the more I researched the original game and implemented its mechanics.</p><p>I will continue building games with BrightLib, refining the framework as new challenges arise, and eventually make it publicly available.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da2b1026f3fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Game Behavior with Finite State Machines]]></title>
            <link>https://silviocarrera.medium.com/building-game-behavior-with-finite-state-machines-c5756cddc971?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5756cddc971</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[software-design-patterns]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 17:31:00 GMT</pubDate>
            <atom:updated>2026-03-17T17:31:00.791Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iZFe1plDIb86eB5mEfzZJw.png" /></figure><p>Finite State Machines (FSMs) are one of the most widely used and reliable ways to structure behavior in a game. They can be applied across various scenarios, including player control, AI, UI, and overall game flow. In this article, I go over several FSM designs and when each is best used. I have also added sample code for a more in-depth look — the GitHub link is included at the end.</p><h3>FSM</h3><p>The most basic situation we will look at is designing a player character. Like in many games, our player can either move or remain idle.</p><p>While in the Idle state, we check whether any input has occurred. If so, we transition to the Move state. In the Move state, on every tick, we read input and move the player.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*23Fa6T9sHqvX-K-6tjCDsg.png" /></figure><p>As you can see, this is straightforward. It gives us a clear separation of concerns. It also allows us to separate behavior from state, making it possible to reuse behavior for both player and enemy AI while producing different outcomes.</p><p><strong>Recommended Use:</strong> Simple characters or interactables with few states and clear transitions.</p><h3>Hierarchical FSM(Composite State)</h3><p>A Hierarchical FSM is simply an FSM that allows states to contain other states.</p><p>If we revisit our player and introduce Idle, Walking, Running, and Attack states, and we allow attacking from Idle, Walking, or Running, we now need three separate transitions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PrmJStViFq7y22oUKhzV2Q.png" /></figure><p>By using a composite state, we can nest states under a parent. For example, we create a Locomotion composite state with three child states: Idle, Walking, and Running. We then add a single transition from the Locomotion state to the Attack state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aS-pYZFJ7jDMzNzJIUVm_Q.png" /></figure><p>The transitions between Idle, Walking, and Running remain unchanged. The advantage is that before evaluating their own transitions, the FSM first checks the parent state’s transitions. This reduces duplication.</p><pre>public class HierarchicalFSM : FSM<br>{<br>    private void Start()<br>    {<br>        var attackState = new AttackState(transform);<br><br>        var locomotionState = new LocomotionState();<br>        var idleState = new IdleState();<br>        var walkState = new WalkState(transform);<br>        var runState = new RunState(transform);<br><br>        locomotionState.AddChildAsInitialState(idleState);<br>        locomotionState.AddChild(walkState);<br>        locomotionState.AddChild(runState);<br><br>        AddTransition(attackState, locomotionState, () =&gt; { return TimeElapsedInCurrentState &gt; 1.0f; });<br>        AddTransition(locomotionState, attackState, () =&gt; { return Input.GetKeyDown(KeyCode.Space); });<br>        AddTransition(idleState, walkState, () =&gt; { return Mathf.Abs(Input.GetAxis(&quot;Horizontal&quot;)) &gt; 0.0f; });<br>        AddTransition(walkState, idleState, () =&gt; { return Mathf.Abs(Input.GetAxis(&quot;Horizontal&quot;)) == 0.0f; });<br>        AddTransition(walkState, runState, () =&gt; { return TimeElapsedInCurrentState &gt; 0.5f; });<br>        AddTransition(runState, walkState, () =&gt; { return Mathf.Abs(Input.GetAxis(&quot;Horizontal&quot;)) &lt; 1.0f; });<br><br>        _initialState = idleState;<br>  <br>        ChangeToInitialState();<br><br>        DisplayName = &quot;HierachicalFSM&quot;;<br>        LogTransitions = true;<br>    }<br><br>}</pre><p>Shared parent logic leads to less repetitive code, making the system easier to maintain over time. The trade-off is slightly increased setup complexity and debugging effort.</p><p><strong>Recommended Use:</strong> Moderately complex interactables with shared transition conditions, and characters with grouped behavior states.</p><h3>Pushdown FSM</h3><p>Game flow and UI are strong use cases for FSMs, even in large games. UI states tend to be specific, with clearly defined transitions. You are typically only in one state at a time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCnJMysAjLKKBA4shgyhuA.png" /></figure><p>A common requirement in UI systems is the ability to return to the previous state easily. A Pushdown FSM supports this through stack-based behavior. Instead of only changing states, you can Push or Pop states.</p><pre>public class MenuFSM : PushdownFSM<br>{<br>    private void Awake()<br>    {<br>        var optionsState = new OptionsState();<br><br>        var videoOptionsState = new VideoOptionsState();<br>        var audioOptionsState = new AudioOptionsState();<br>        var controlsOptionsState = new ControlsOptionsState();<br><br>        AddPushTransition(optionsState, videoOptionsState, () =&gt; { return Input.GetKeyDown(KeyCode.Space); });<br>        AddPushTransition(videoOptionsState, controlsOptionsState, () =&gt; { return Input.GetKeyDown(KeyCode.Alpha1); });<br>        AddPushTransition(videoOptionsState, audioOptionsState, () =&gt; { return Input.GetKeyDown(KeyCode.Alpha2); });<br>        <br>        AddPopTransition(videoOptionsState, () =&gt; { return Input.GetKeyDown(KeyCode.Escape); });<br>        AddPopTransition(controlsOptionsState, () =&gt; { return Input.GetKeyDown(KeyCode.Escape); });<br>        AddPopTransition(audioOptionsState, () =&gt; { return Input.GetKeyDown(KeyCode.Escape); });<br><br>        _initialState = optionsState;<br><br>        DisplayName = &quot;MenuFSM&quot;;<br>        LogTransitions = true;<br>    }<br><br>    private void Start()<br>    {<br>        ChangeToInitialState();<br>    }<br><br>}</pre><p>In addition to Enter and Exit, Pushdown FSM states usually implement Suspend and Resume.</p><p>When AudioOptionsState is pushed on top of OptionsState:<br>- OptionsState receives Suspend.<br>- AudioOptionsState receives Enter.</p><p>When AudioOptionsState exits:<br>- OptionsState receives Resume.</p><p>This gives finer control compared to repeatedly triggering Enter and Exit.</p><p><strong>Recommended Use:</strong> UI menus, game flow, popups, overlays, and temporary interruptions.</p><h3>Layered FSM</h3><p>A Layered FSM allows multiple FSMs to run simultaneously within the same context. Each FSM (or layer) is responsible for a specific area.</p><p>For a player character, you might have:<br>- Locomotion FSM<br>- Combat FSM<br>- Status FSM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z62lhiY-iu2UYI05vWN4kw.png" /></figure><p>All run in parallel and are managed by a LayeredFSM (soft threads in this case). Each FSM can define a priority, which determines execution order. FSMs can enable or disable each other through an event manager provided by the LayeredFSM.</p><p>For example, the player can be:</p><p>- Moving (Locomotion FSM → Moving)<br>- Shooting (Combat FSM → Shooting)<br>- Poisoned (Status FSM → Poisoned)</p><p>If we add a Stunned state to the Status FSM, we can disable the Combat FSM entirely while stunned.</p><pre>public class PlayerCombatFSM : ActorFSM<br>{<br>    private void Awake()<br>    {<br>        DisplayName = &quot;PlayerCombatFSM&quot;;<br>    }<br>    private void Start()<br>    {<br>        var readyState = CreateState&lt;ReadyState&gt;();<br>        var shootingState = CreateState&lt;ShootingState&gt;();<br>        var reloadingState = CreateState&lt;ReloadingState&gt;();<br><br>        var moveModule = Actor.FetchModule&lt;MovementModule&gt;();<br>        var inputModule = Actor.FetchModule&lt;CharacterControllerModule&gt;();<br>        var shooterModule = Actor.FetchModule&lt;ShooterModule&gt;();<br><br>        AddTransition(readyState, shootingState, () =&gt; { return inputModule.IsShootButtonPressed; });<br>        AddTransition(shootingState, readyState, () =&gt; { return !inputModule.IsShootButtonPressed; });<br>        AddTransition(shootingState, reloadingState, () =&gt; { return shooterModule.IsOutOfAmmo; });<br>        AddTransition(reloadingState, readyState, () =&gt; { return !shooterModule.IsOutOfAmmo; });<br><br>        SetInitialState(readyState);<br>        ChangeToInitialState();<br>    }<br>}</pre><p>This approach provides high flexibility and separation of concerns.</p><p>If you are using a game engine, you likely already use something similar. Most engines provide an animation state machine separate from gameplay logic. That is effectively two layers: logic and animation. The logic layer typically influences the animation layer.</p><p>A Layered FSM formalizes and extends this idea, allowing multiple specialized logic layers. However, depending on how layers are structured, maintenance and conflict resolution can become complex. It is a powerful tool that should be used intentionally.</p><p><strong>Recommended Use:</strong> Complex characters and systems where multiple independent behaviors must operate simultaneously.</p><h3>Final Thoughts</h3><p>There is no single solution that fits every case. In production, you will often combine these approaches:<br>- Simple interactables often use a basic FSM.<br>- UI systems typically use a Pushdown FSM.<br>- Player characters, NPCs, and enemies may use a Hierarchical FSM or a Layered FSM.</p><p>For a complete look at the FSMs: <a href="https://github.com/carreraSilvio/BrightStateMachine">Github Link</a></p><p>The most important advice is consistency. Avoid mixing patterns without a clear architectural guideline. Unstructured mixing makes systems harder to maintain and evolve.</p><p>FSMs remain one of the most reliable architectural tools in game development. With a clear understanding of these patterns, you can apply the right structure for the right problem.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5756cddc971" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managing Global Systems in Unity Without Spaghetti Code]]></title>
            <link>https://silviocarrera.medium.com/managing-global-systems-in-unity-without-spaghetti-code-fade03303fce?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/fade03303fce</guid>
            <category><![CDATA[unity-game-development]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 17:31:00 GMT</pubDate>
            <atom:updated>2026-03-10T17:31:00.578Z</atom:updated>
            <content:encoded><![CDATA[<p>When structuring global systems in Unity (audio, localization, save, input, etc.), you’ll typically end up choosing between a few common patterns. Each has trade-offs around initialization order, memory control, editor visibility, and verbosity. There isn’t a universally “correct” solution — the right choice depends on project size, team size, and system complexity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DA6JDJm6SBP6uYpWmPlcXg.png" /></figure><h3>Classic Singleton</h3><p>The most common approach is to create a class with a private static field and a public getter that performs lazy instantiation when first accessed.</p><p>This is a reliable and widely understood pattern. However, calling “SystemName.Instance” everywhere can lead to noisy code. More importantly, when multiple singletons depend on each other — as they usually do — lazy instantiation can introduce subtle initialization-order bugs.</p><pre>using UnityEngine;<br><br>public sealed class AudioSystem : MonoBehaviour<br>{<br>    public static AudioSystem Instance<br>    {<br>        get<br>        {<br>            if (_instance == null)<br>            {<br>                _instance = FindFirstObjectByType&lt;AudioSystem&gt;(FindObjectsInactive.Include);<br><br>                if (_instance == null)<br>                {<br>                    GameObject go = new GameObject(&quot;AudioSystem&quot;);<br>                    _instance = go.AddComponent&lt;AudioSystem&gt;();<br>                }<br>            }<br><br>            return _instance;<br>        }<br>    }<br>    private static AudioSystem _instance;<br><br>    private AudioSource _musicSource;<br>    private AudioSource _sfxSource;<br><br><br>    private void Awake()<br>    {<br>        if (_instance != null &amp;&amp; _instance != this)<br>        {<br>            Destroy(gameObject);<br>            return;<br>        }<br><br>        _instance = this;<br>        DontDestroyOnLoad(gameObject);<br><br>        //Initialize Audio Sources<br>        GameObject musicGO = new GameObject(&quot;Music&quot;);<br>        musicGO.transform.SetParent(transform);<br>        _musicSource = musicGO.AddComponent&lt;AudioSource&gt;();<br>        _musicSource.loop = true;<br>        _musicSource.playOnAwake = false;<br><br>        GameObject sfxGO = new GameObject(&quot;SFX&quot;);<br>        sfxGO.transform.SetParent(transform);<br>        _sfxSource = sfxGO.AddComponent&lt;AudioSource&gt;();<br>        _sfxSource.loop = false;<br>        _sfxSource.playOnAwake = false;<br>    }<br><br>    public void PlayMusic(AudioClip audioClip)<br>    {<br>        //on a real scenario it pass an ID and the AudioSystem knows which clip to use<br>        _musicSource.clip = audioClip;<br>        _musicSource.Play();<br>    }<br><br>    public void StopMusic() <br>    {<br>        _musicSource.Stop();<br>    }<br><br>    public void PlaySfx(AudioClip audioClip)<br>    {<br>        _sfxSource.PlayOneShot(audioClip);<br>    }<br>}</pre><p>For small or solo projects, this approach is perfectly valid. Its simplicity is often its biggest advantage.</p><p><strong>Pros</strong><br>- Created on first access (lazy).<br>- Minimal setup.<br>- Easy to implement and understand.<br><strong>Cons</strong><br>- Verbose calls that lead to cluttered code (SingletonName.Instance everywhere).<br>- Less control over initialization timing.<br>- Dependency chains between singletons can cause hard-to-track issues.</p><h3>Registry (Global Manager)</h3><p>This pattern has gone by several names over the years: Global, Registry, etc. Flixel used FlxG as a centralized access point for its global systems.</p><p>The idea is simple: instead of many independent singletons, you create one central Singleton responsible for creating, storing, and destroying all global systems.</p><pre>using UnityEngine;<br><br>public sealed class Registry : MonoBehaviour<br>{<br>    private static Registry _instance;<br>    private bool _initialized;<br>    public static Registry Instance<br>    {<br>        get<br>        {<br>            if (_instance == null)<br>            {<br>                _instance = FindFirstObjectByType&lt;Registry&gt;(FindObjectsInactive.Include);<br><br>                if (_instance == null)<br>                {<br>                    GameObject go = new GameObject(&quot;Registry&quot;);<br>                    _instance = go.AddComponent&lt;Registry&gt;();<br>                }<br>            }<br><br>            return _instance;<br>        }<br>    }<br><br><br>    public static AudioSystem Audio=&gt; _instance._audioSystem;<br>    public static InputSystem Input =&gt; _instance._inputSystem;<br>    public static UISystem UI =&gt; _instance._uiSystem;<br><br>    private AudioSystem _audioSystem;<br>    private InputSystem _inputSystem;<br>    private UISystem _uiSystem;<br><br>    private void Awake()<br>    {<br>        if (_instance != null &amp;&amp; _instance != this)<br>        {<br>            Destroy(gameObject);<br>            return;<br>        }<br><br>        _instance = this;<br>        DontDestroyOnLoad(gameObject);<br><br>        Initialize();<br>    }<br><br>    private void Initialize()<br>    {<br>        if (_initialized)<br>        {<br>            return;<br>        }<br><br>        _audioSystem = new AudioSystem();<br>        _inputSystem = new InputSystem();<br>        _uiSystem = new UISystem();<br><br>        // Explicit init order<br>        _audioSystem.Initialize();<br>        _inputSystem.Initialize();<br>        _uiSystem.Initialize();<br><br>        _initialized = true;<br>    }<br><br>    private void OnDestroy() <br>    {<br>        //Shutdown in reverse order assuming dependencies <br>        _uiSystem?.Shutdown();<br>        _inputSystem?.Shutdown();<br>        _audioSystem?.Shutdown();<br>    }<br><br>}</pre><p>This solves several issues from the Classic approach. You eliminate repeated “System.Instance” calls across your project, and you gain explicit control over initialization order. Dependencies become clearer because everything is created in one place.</p><p>The trade-off is upfront cost and rigidity. You must register and initialize each system explicitly. Lazy instantiation is no longer automatic, and you may initialize systems that are never used for certain scenarios like unit testing.</p><p><strong>Pros</strong><br>- Only one true singleton.<br>- Clear control over initialization order.<br>- Reduced verbosity in system access.<br>- Dependencies become easier to reason about.<br><strong>Cons</strong><br>- All global systems may be initialized even if unused.<br>- Slightly more overhead when adding new systems.<br>- Less flexible than lazy instantiation.</p><h3>MonoBehaviour vs Regular Class</h3><p>If your system inherits from MonoBehaviour, you gain strong editor integration. At runtime, you can inspect values directly in the Inspector, which is extremely useful for debugging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/367/1*deUSHdwn0TzqAcSL1NKFAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*AV05loo-zj1ocCTOv8ooKA.png" /><figcaption>That is just free debugging</figcaption></figure><p>For our AudioSystem example, you can inspect volume levels and the currently playing clips without writing custom debug tools. If you combine the Registry approach with some classic singletons with lazy instantiation, MonoBehaviours also make it visually obvious which systems are active in the scene.</p><p>Regular classes, on the other hand, are lighter and decoupled from the scene lifecycle. They are easier to test and don’t depend on GameObjects.</p><p>MonoBehaviour Advantages<br>- Inspector visibility at runtime.<br>- Easy integration with Unity lifecycle methods.<br>- Scene-level debugging.</p><p>Regular Class Advantages<br>- No scene dependency.<br>- Cleaner architecture separation.<br>- Easier unit testing.</p><h3>Static Class</h3><p>A static class is not technically a Singleton, but it often fills the same role: global access without instantiation.</p><p>This is especially useful for systems that:<br>- Do not require scene presence.<br>- Do not depend on Unity lifecycle events.<br>- Must be accessible in both play mode and edit mode.</p><p>A common example is a Localization System that simply maps keys to strings and does not need to live as a GameObject. Because it’s independent from Unity’s lifecycle, you can load and validate your localization data at editor time.</p><pre>using System.Collections.Generic;<br>using UnityEngine;<br><br>public sealed class LocalizationSystem<br>{<br>    private static Dictionary&lt;string, string&gt; _strings;<br>    private static bool _initialized;<br><br>    public static void Initialize()<br>    {<br>        if (_initialized)<br>        {<br>            return;<br>        }<br><br>        // In a real project, load from JSON / CSV / ScriptableObject<br>        _strings = new Dictionary&lt;string, string&gt;<br>        {<br>            { &quot;menu.play&quot;, &quot;Play&quot; },<br>            { &quot;menu.quit&quot;, &quot;Quit&quot; },<br>            { &quot;game.over&quot;, &quot;Game Over&quot; }<br>        };<br><br>        Validate();<br>        _initialized = true;<br>    }<br><br>    public static string Get(string key)<br>    {<br>        if (!_initialized)<br>        {<br>            Initialize();<br>        }<br><br>        if (_strings.TryGetValue(key, out var value))<br>        {<br>            return value;<br>        }<br><br>        Debug.LogWarning($&quot;Missing localization key: {key}&quot;);<br>        return $&quot;#{key}&quot;;<br>    }<br><br>    private static void Validate()<br>    {<br>        foreach (var pair in _strings)<br>        {<br>            if (string.IsNullOrWhiteSpace(pair.Value))<br>            {<br>                Debug.LogWarning($&quot;Empty localization value for key: {pair.Key}&quot;);<br>            }<br>        }<br>    }<br>}</pre><p>This allows you to run consistency checks (missing keys, duplicate entries, unused strings) and ensure everything is properly initialized before entering Play mode, reducing runtime surprises and catching errors earlier in development.</p><p><strong>Pros</strong><br>- Works in both editor and play mode.<br>- Extremely simple access.<br>- Minimal boilerplate.<br><strong>Cons</strong><br>- Always in memory.<br>- Reinitialized on domain reload.<br>- No Unity lifecycle hooks.<br>- Harder to test or swap implementations.<br>- Encourages hidden global coupling if overused.<br>- You have to build your own debug view since it can’t be a MonoBehaviour.</p><h3>Conclusion</h3><p>Each option at a glance:<br>- <strong>Classic Singleton</strong> → Simplicity and speed of implementation<br>- <strong>Registry</strong> → Explicit control and dependency management.<br>- <strong>MonoBehaviour systems</strong> → Editor visibility gives free runtime debugging.<br>- <strong>Static Classes</strong> → Work in both editor and play mode.</p><p>In small projects, convenience often outweighs architectural purity. In larger projects, explicit initialization and controlled dependencies are necessary.</p><p>The real skill is not choosing one pattern universally — but recognizing which trade-offs are acceptable for the system you’re building.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fade03303fce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unity Assembly Definitions: Faster Iteration and Better Architecture]]></title>
            <link>https://silviocarrera.medium.com/unity-assembly-definitions-faster-iteration-and-better-architecture-4c9474fbdc54?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c9474fbdc54</guid>
            <category><![CDATA[gamedev]]></category>
            <category><![CDATA[gane-development]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Tue, 03 Mar 2026 17:01:04 GMT</pubDate>
            <atom:updated>2026-03-03T17:01:04.413Z</atom:updated>
            <content:encoded><![CDATA[<p>A short and straightforward guide</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*62sUhlD4SHc8Yx269pZCiA.png" /></figure><h3>What are Assembly Definitions?</h3><p>Asmdefs, as I will refer to them, are Unity-specific files that act as the equivalent of C# projects in the .NET ecosystem. Their primary focus is to reduce compilation time during development.</p><h3>How do they work?</h3><p>When a script that is part of an asmdef is modified, Unity recompiles the scripts in that assembly as well as any assemblies that depend on it. This allows you to split your codebase strategically to reduce compilation time and improve iteration speed when returning to the editor after making a change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xlCTKJjMZ1cA8_xYk_PG_w.png" /><figcaption>A far too common sight when returning to Unity</figcaption></figure><h3>Why use them?</h3><p>Beyond faster compilation, an even greater benefit is improved architecture.</p><p>Once a script is part of an asmdef, any other script that needs access to it must reference the entire asmdef. This forces a deliberate decision when creating dependencies between parts of your project.</p><p>Should my UI depend on Audio? <br>Should my Audio depend on Input? <br>Should Input depend on UI?</p><p>You likely already have opinions about these relationships. Using asmdefs formalizes those decisions. Even in solo projects, this helps enforce architectural rules and prevents unintended coupling. In short, it saves you from yourself.</p><h3>When to use them?</h3><p>Use asmdefs across your project in two main scenarios:<br> 1. When building reusable packages.<br> 2. When organizing your current project into logical layers.</p><p>In practice, larger projects rarely consist of just a couple of assemblies. As your game grows, you typically introduce multiple layers (e.g., Core, Gameplay, UI, Infrastructure) and integrate both first-party and third-party packages. Each of these represents a natural assembly boundary. Using asmdefs across these boundaries helps isolate systems, control dependencies between internal layers, and clearly separate external packages from your game code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*dFiuL4C12wL5i-veAzfoSQ.png" /></figure><p>Creating an asmdef is simple. Just left-click in the project view and choose Assembly Definition.</p><h4><strong>Reusables Packages</strong></h4><p>When building packages, a good convention is to name both the asmdef and namespace using {Company}{Feature}.</p><p>For example, if building a generic Localization solution at Nintendo, the package could be named NintendoLocalization.</p><p>Inside that package folder, we will add two more folders. One is called Editor, and the other is called Runtime. In each of them, we will place an asmdef. In this example, the asmdefs would be called NintendoLocalization and NintendoLocalizationEditor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*U7OIdS61Vg_wYovPA6ddGw.png" /></figure><p>It’s important to notice that in the “editor” asmdef under platforms, we should only have editor toggled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*CgZFkB0pjf1gyUnSFCj4HQ.png" /></figure><p>Pay attention to naming the feature. Use broad terms such as <strong>Localization </strong>or <strong>Audio</strong>, not Localize or Localizer. Choose names that represent the domain rather than an implementation detail.</p><h4>Project Layers</h4><p>Use asmdefs across your project in two main scenarios:<br>1. When building reusable packages.<br>2. When organizing your current project into logical layers.</p><p>In practice, larger projects consist of a mix of both scenarios. You will likely have your own packages and you typically introduce multiple layers (e.g., Core, Gameplay, UI, Flow). Using asmdefs helps isolate systems, control dependencies between them, and clearly separate external packages from your game code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*bQCpm2XTrs4z-8gNKBSUbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*wmz4fHA8RYIb8Jl781UHaQ.png" /></figure><p>Below we add a reference from UI to Game. By referencing DolphinGame inside DolphinUI, you explicitly state that UI depends on Game — not the other way around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*DugdGyFORFf4b1vIGoii3Q.png" /><figcaption>The DolphinUI references the DolphinGame and not the other way around</figcaption></figure><p>By not adding a reference from DolphinGame to DolphinUI, you prevent gameplay code from directly interacting with the UI. This enforces separation and keeps dependencies intentional.</p><p>For editor scripts, follow the same pattern as reusable packages: create an Editor folder under each layer with their own asmdef and place editor scripts there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*e6q5xEasHUF2JCr0NUc1Xg.png" /></figure><h4>Bonus</h4><ol><li>If you set the Root Namespace field in an asmdef, every new script created within that assembly automatically includes the correct namespace declaration.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*4B0TKk6dhSn3h4PH9jBE4Q.png" /></figure><p>2. To check which asmdef a script belongs to, simply select the script and inspect it in the Inspector.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*vr4R5FmzZlXmvkE-OE8h0w.png" /></figure><h3><strong>Conclusion</strong></h3><p>Assembly Definitions improve iteration speed by limiting recompilation scope. More importantly, they enforce clear dependency boundaries.</p><p>They help you structure projects more deliberately, keep architecture clean as the codebase grows, and make it easier to extract reusable components at the end of a project.</p><p>Using assembly definitions you can keep your dependencies explicit, making your codebase more modular and easier to maintain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c9474fbdc54" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trapped on the Wii: 10 Games That Deserve a Second Chance]]></title>
            <link>https://silviocarrera.medium.com/trapped-on-the-wii-10-games-that-deserve-a-second-chance-d2cd2f8f738e?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2cd2f8f738e</guid>
            <category><![CDATA[gaming]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 17:01:02 GMT</pubDate>
            <atom:updated>2026-02-24T17:01:02.227Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, Konami finally announced the long-overdue port of <strong>Metal Gear Solid 4: Guns of the Patriots</strong>, a game that had been locked to the PS3 since 2008. That’s nearly two decades of being inaccessible to new audiences.</p><p>The Wii finds itself in a similar situation. While initially seen as a confusing pivot for Nintendo, it went on to become one of the best-selling consoles of all time and hosted a surprising number of gems. Unfortunately, many of those games remain lost on the platform.</p><p>I’ve been lucky enough to experience these titles firsthand, but they deserve a second life. Modern hardware and updated control schemes would allow more players to appreciate what made them special in the first place.</p><h3>1. MadWorld</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F0UBtBr8-jChzp3tRUpGsQ.jpeg" /></figure><p>Released in 2009 by PlatinumGames, <strong>MadWorld</strong> was the studio’s other bold statement alongside Bayonetta. Presented in stark black-and-white visuals with splashes of red blood, it felt like a playable graphic novel inspired by Frank Miller’s <em>Sin City</em>. Its exaggerated violence and over-the-top presentation made it one of the Wii’s most distinctive titles.</p><p>The game made heavy use of motion controls for combat finishers, but none of its mechanics are inherently tied to the Wii. The gestures could easily be mapped to analog sticks or button combinations, similar to how other character action games handle special moves today. There’s nothing preventing a smooth transition to modern controllers.</p><p>MadWorld deserves a port because of its bold art direction and tight action design. It remains one of Platinum’s most unique works, and making it accessible again would strengthen the studio’s already impressive catalog.</p><h3>2. Pandora’s Tower</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cE8n74ibzwXK4RD9olnXkg.jpeg" /></figure><p>Released late in the Wii’s lifecycle, <strong>Pandora’s Tower</strong> is an action RPG where you play as Aeron, tasked with saving his cursed companion Elena. To do so, you must explore towers, defeat monsters, and feed her their flesh to prevent her transformation. You read that right, it’s an odd premise, but one that immediately sets it apart.</p><p>Control-wise, the game functions much like a streamlined Zelda title. Movement, combat, and tool usage translate cleanly to a standard controller. The chain mechanic — central to both combat and puzzle solving — would adapt effortlessly to modern hardware.</p><p>What makes Pandora’s Tower worth revisiting is its tone and emotional tension. The time-sensitive structure and morally uncomfortable mechanics give it a distinct identity. It may not have been a blockbuster, but its daring approach deserves preservation.</p><h3>3. The Last Story</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ztfUXiue59tuOx1emSY7g.jpeg" /></figure><p>Directed by Hironobu Sakaguchi, creator of Final Fantasy and a key contributor to Chrono Trigger, <strong>The Last Story</strong> was developed by Mistwalker as a spiritual answer to traditional JRPGs of the time. It blended real-time combat with tactical elements and focused heavily on character dynamics.</p><p>The game barely relies on motion controls. Its systems are already structured around traditional inputs, making a port straightforward.</p><p>The Last Story isn’t revolutionary in any particular way, but the sum of its parts reflects Sakaguchi’s talent. His ability to elevate simple mechanics through atmosphere and pacing makes this an RPG that deserves to be experienced by a broader audience.</p><h3>4. Sin &amp; Punishment: Star Successor</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BNbRx93nzX1sIfnMkrNQlg.jpeg" /></figure><p><strong>Sin &amp; Punishment: Star Successor</strong> is one of the finest examples of the on-rails shooter genre. At a time when arcade-style shooters were fading from relevance, this sequel delivered relentless pacing with visual flair.</p><p>The Wii version allowed for pointer aiming, but dual-analog controls would replicate the experience seamlessly. Many modern shooters already use similar input schemes, so adapting it would be trivial.</p><p>This is a genre that rarely gets new entries, so porting would reintroduce players to a polished, fast-paced design philosophy that still feels refreshing today.</p><h3>5. Trauma Center / Trauma Team</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HP0PhDG4BenYUaWrk1yBKA.png" /></figure><p>The Trauma Center series, culminating on the Wii with <strong>Trauma Team</strong>, blended medical drama with precision-based gameplay. It was one of the most inventive uses of the Wii’s interface and was quite successful on the DS as well.</p><p>While the series relied on motion controls, those mechanics essentially simulate pointer precision. Mouse controls on PC or gyro/stick combinations on modern consoles would replicate the experience without issues.</p><p>With Atlus now enjoying global success thanks to Persona and Shin Megami Tensei, revisiting Trauma Team would make sense. Few games merge narrative tension and mechanical interaction as elegantly as this series.</p><h3>6. Fire Emblem: Radiant Dawn</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kpklu1pod_NLHGC64LOh6Q.jpeg" /></figure><p>Before Fire Emblem Awakening revived the franchise, the series was close to cancellation. <strong>Fire Emblem: Radiant Dawn</strong> continued the story from Path of Radiance and introduced mechanics that shaped future entries.</p><p>The game uses entirely traditional controls, so porting it would present no challenges. Its strategic systems remain fully compatible with modern hardware and audiences</p><p>Radiant Dawn represents an important transitional chapter in the series’ history. Preserving it would help newer fans understand the evolution of Fire Emblem’s design.</p><h3>7. Red Steel 1 &amp; 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGw6FifzPKzCO8FNKCIUhQ.jpeg" /></figure><p>The <strong>Red Steel</strong> games were early showcases for the Wii’s motion controls. While the first entry struggled with precision, the sequel refined swordplay into something far more satisfying.</p><p>Modern VR technology could elevate these concepts significantly. However, even without VR, refined analog controls could reimagine the combat for current consoles.</p><p>Red Steel 2, in particular, had style and personality. With proper modernization, it could finally reach the potential it originally aimed for.</p><h3>8. Metroid Prime 3: Corruption</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O5LtPhmXp8kzI5zs2Cy6pw.jpeg" /></figure><p>The third entry in the Prime trilogy embraced motion controls for aiming and environmental interaction. Players manipulated switches and mechanisms through physical gestures. Samus was also equipped with a whip that you had to use to remove enemies’ shields.</p><p>Given the success of Metroid Prime Remastered and the upcoming Metroid Prime 4, bringing Corruption forward feels inevitable. Dual-stick aiming and optional gyro would replicate its strengths without losing precision.</p><p>It’s the final chapter of the original Prime arc and deserves accessibility alongside the rest of the trilogy.</p><h3>9. Punch-Out!!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZXx0XGj9TtlXx7tGFf-TVg.jpeg" /></figure><p><strong>Punch-Out!!</strong> on the Wii revitalized the classic boxing formula with expressive animation and tight gameplay. It retained the pattern-recognition structure of its predecessors while adding personality.</p><p>The motion controls were optional; the core gameplay already supports traditional input. A port would require minimal adjustment.</p><p>Its stylized visuals and mechanical clarity still hold up today. It’s a franchise that benefits from visibility and accessibility. It would be an easy one for Nintendo to bring back, given the fact that the Switch also has motion controls.</p><h3>10. Deadly Creatures</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*Qm3blGK-vZRfr73FnebIMg.jpeg" /></figure><p><strong>Deadly Creatures</strong> stands out purely because of its premise: you control a scorpion and a tarantula navigating a hostile desert environment. It is an odd pitch to sell nowadays, and I can only imagine how this game got greenlit back then. But in an age where quirky and experimental games not only have their place but also thrive as a genre, this would fit right in.</p><p>The game uses motion controls for attacks, but these could easily be mapped to modern buttons or sticks. The experience is not fundamentally tied to the Wii hardware.</p><p>It may not have been perfect, but its uniqueness alone justifies preservation. Few games dare to experiment with perspective in this way.</p><h3>Honorable Mentions</h3><ul><li><strong>Dawn of Discovery (Anno)</strong> — With Anno 1800 finding success on consoles, this streamlined entry would serve as a welcoming gateway for newcomers.</li><li><strong>Cursed Mountain</strong> — A Himalayan survival horror with rough edges but a compelling atmosphere.</li><li><strong>Zack &amp; Wiki: Quest for Barbaros’ Treasure</strong> — A clever point-and-click adventure whose mechanics would translate effortlessly to modern platforms.</li><li><strong>Castlevania Judgment</strong> — A flawed fighting game experiment, but visually striking thanks to Takeshi Obata’s (Death Note) art direction.</li><li><strong>Metroid: Other M</strong> — Divisive, but mechanically solid and stylistically distinct.</li></ul><p>The games industry has a tendency for forgetting its past. With so many games being stuck to a particular machine due to business decisions, we as an industry have to do a better job in making sure these titles remain available for future generations. While we celebrate long-running franchises reaching milestone anniversaries, it’s equally important to preserve more obscure entries from their eras.</p><p>These Wii titles deserve more than to remain locked to aging hardware — they deserve to be played.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2cd2f8f738e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Quick Guide to Clearing Your Game Backlog]]></title>
            <link>https://silviocarrera.medium.com/a-quick-guide-to-clearing-your-game-backlog-326a6696324c?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/326a6696324c</guid>
            <category><![CDATA[gaming-culture]]></category>
            <category><![CDATA[gaming]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Tue, 17 Feb 2026 17:01:00 GMT</pubDate>
            <atom:updated>2026-02-17T17:01:00.775Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YUGVFYVBityg6WGyjzC8iA.png" /></figure><p>Master your game backlog! Learn to stop impulse buys, focus on one game at a time, and strategically clear your library. Enjoy gaming again!</p><h3>1. Stop Buying</h3><p>If your backlog keeps growing, it will never end. The first step is to stop buying games — for now. Whatever you’re thinking about purchasing today will almost certainly be cheaper later.</p><p>Don’t buy games just because they’re on sale. Sales happen all year. If you miss one, another will appear within a few months. Impulse purchases are the main reason backlogs spiral.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q1G5OhaQXWhfv1Ka3mV2ZQ.png" /></figure><p>Use <a href="https://psprices.com/">PSPrices</a> to track digital discounts. Check a game’s pricing history and look for patterns — most titles go on sale multiple times per year. When you get a notification, review past discounts and only buy once your backlog is reduced. Take back control.</p><h3>2. Reduce Your Options</h3><p>Decision paralysis is a real thing. If we have too many choices, we keep overthinking what the best decision to take is. This might lead to procrastination, where you postpone making a decision, or it might lead to frustration, where you always feel like you have made a bad decision.</p><p>If you mainly buy digital games, opening up Steam can feel overwhelming. The struggle is also real on the physical side, though usually less so. The solution is simple: only keep the current game installed.</p><p>If you’re midway through multiple games, stick with the one you’ve invested the most time in or the one closest to completion. You’ll be more skilled, more immersed in the narrative, and more likely to finish it.</p><h3>3. One at a Time</h3><p>Build the habit of focusing on one main game at a time. Avoid juggling multiple long, demanding games simultaneously.</p><p>Switching between two large titles — especially story-heavy or mechanically deep ones — splits your focus. When you return, you may forget plot details, controls, or systems. That friction often leads to starting something new, which is how backlogs grow.</p><p>That said, a short “palette cleanser” can work well. A fighting game, racing game, roguelike, or quick multiplayer session can give your brain a reset without pulling you away from your main game. The key is that it stays light and limited — not another 40-hour commitment.</p><p>One main game. Optional short cleanser. No competing long games.</p><h3>4. Decide When You Are Done</h3><p>Growing up, I would always finish every game I started, even if I wasn’t enjoying myself. It was a different time. I had fewer games to choose from, so it was either that or staring at a wall all day.</p><p>If you are playing a game right now and it starts feeling like a chore, then stop playing it. This is very common in open-world games, where we get hooked into a completionist mindset. We start going from question mark to question mark on the map. We become mindless, and the game loses its fun.</p><p>You don’t have to finish every game. You don’t have to 100% it. You don’t need every platinum trophy either. You also don’t have to play a game because you are a fan of a particular series. It’s fine to skip an entry.</p><p>Decide when you are done with a game and move on without guilt.</p><h3>5. Mix It Up</h3><p>Despite what most people think, most games rely on repetition — that’s how mastery works. With games being much longer now, our brains can get saturated. The issue isn’t repetition itself, but repetitive patterns over long stretches.</p><p>Use your backlog strategically. After a long open-world RPG, play a short indie game. After a narrative-heavy title, try something combat-focused. Change genre or structure, but don’t go completely random — aim for controlled novelty. Use <a href="https://howlongtobeat.com/">HowLongToBeat</a> to help you make that decision.</p><h3>6. Plan Ahead</h3><p>Before you’re done with the current game, choose the next one or two you’ll play. As mentioned before, take into account the game’s duration and genre.</p><p>This reduces your backlog from dozens of options to just two. The decision is made before you’re in the “what do I play now?” moment.</p><h3>7. Take Breaks</h3><p>Once all of the above are working, you might get obsessed with going through each entry in your backlog. Which can become a different problem. You will start playing games almost like a job. Like you have to get through them. If those feelings start to surface, then take a break. Maybe skip a few days from playing entirely and go out for a meal.</p><p>I am currently going through Sand Land, which is a decent sized open-world game. I have sinked about 12 hours into it. I tend to do a mix of the main story and some of the side content. I’ll probably end up with something close to 30 hours into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zl0c7AeShILK-X-QhPaMRw.png" /></figure><p>It’s fair to say I’m about halfway through the game. I’ve already decided that after I finish it, I will play Soul Calibur 6. One of the few fighting games I enjoy. Different genre and also quite short since I plan on playing just the single-player content.</p><h3>In Short</h3><ol><li>Stop buying new games until your backlog is under control.</li><li>Pick one main game and uninstall the rest.</li><li>If needed, use a short palette cleanser, but avoid juggling multiple long games.</li><li>Before finishing your current game, choose the next one or two based on genre and length.</li><li>Repeat the process until your backlog is manageable. Then consider buying again.</li></ol><p>Tools:<br>- Use <a href="https://psprices.com/">PSPrices</a> for tracking discounts and avoiding impulse buys.<br>- Use <a href="https://howlongtobeat.com/">HowLongToBeat </a>for estimating playtime and planning variety.</p><p>Your backlog should serve you, not the other way around. Now, get back out there and knock those games out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=326a6696324c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PERSONA 5's Biggest Issue]]></title>
            <link>https://silviocarrera.medium.com/persona-5s-biggest-issue-4ac9218b34f8?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ac9218b34f8</guid>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[persona-5]]></category>
            <category><![CDATA[gameplay]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Sat, 22 Oct 2022 11:05:49 GMT</pubDate>
            <atom:updated>2022-10-22T11:05:49.657Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HUCVUHvIHhiyIfLgEp8AMQ.jpeg" /><figcaption>Art by <a href="https://ginkoseed.tumblr.com/">https://ginkoseed.tumblr.com</a></figcaption></figure><p>Playing Persona 5 was a fantastic experience. In terms of visual style, it has pushed the envelope for games. It deserves all the praise it received. But almost 6 years after its release, I don’t see many complaints.</p><p>Did anyone else feel that the conversations would go around in circles and drag on for too long?</p><p>With that question in mind, I decided to analyze the narrative-to-gameplay ratio in Persona 5 when compared to other JRPGs.</p><h3>Playtime</h3><p>Looking at the last three entries in the series, we can see that there is a significant increase in playtime and narrative.</p><p>Note that when I use the term narrative I’m referring to long dialogs as well as cutscenes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rmcoNX6temYBD7BJtVJQAg.png" /></figure><p>More impressively the ratio between gameplay and narrative has increased dramatically. The amount has doubled with each new entry.</p><p>Almost 50% of the time in Persona 5 is spent on narrative.</p><p>That’s quite a big change from previous games. Of course, games have changed a lot in the last 15 years. So how about other JRPG series?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G3RwcGsu4kIpWQzLdwZalQ.png" /></figure><p>For Dragon Quest, we can see that the average playtime remained somewhat the same. We can see a similar increase in narrative time as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gTW_L1Ei2VNkp2b3GDf9qg.png" /></figure><p>Looking at the playtime to narrative ratio, we already see some differences. For DQ XI and FF7, the ratio sits around 35%. Let&#39;s look at more specifics.</p><h3>The First Hour</h3><p>The first hour of any game is usually the slowest one. The game tends to introduce the story and the basic gameplay before allowing the player to be on his own.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dqkd2vgvHL5_oyy5v9u0Dg.png" /><figcaption>The narrative-to-gameplay ratio in the first hour</figcaption></figure><p>In the first hour of Persona 5, there is a total of 41m26s on narrative. While Dragon Quest XI spends a total of 25m43s, which is 15 minutes less than Persona 5. Same for FF7 Remake where the narrative takes 24m02s.</p><h4><strong>Interruptions</strong></h4><p>I’m considering one interruption when the game takes control away from you. Either a cutscene starts, or a long dialog starts. Persona 5 tends to follow a cutscene with a dialog and vice-versa. DQ and FF7 will either do a cutscene or dialog, but usually will not follow one with the other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xpk1jiyYru-LxsG5lK479A.png" /><figcaption>The duration of the interruptions in the first hour</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cOjdYdgS7raweyJgxxFdYQ.png" /><figcaption>The number of interruptions in the first hour</figcaption></figure><p>We can see that P5 has half the interruptions that FF7 has but each interruption is 4 times longer. So while FF7 interrupts gameplay twice more often, the interruptions are on average one minute long. So not only P5 interrupts you quite a few times, but the interruptions are also longer.</p><h4>Persona Series</h4><p>You could argue that this is how the Persona series has always been. To be fair you would be right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hH_BIhpa0M_nOCHVlIuYvA.png" /><figcaption>The duration of the interruptions in the first hour</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17jT7s8Fczq_99FyNWvy9g.png" /><figcaption>The number of interruptions in the first hour</figcaption></figure><p>It is quite impressive how consistent these three games are in terms of structure. Remember that Persona 3 was released in 2006 and Persona 5 in 2016.</p><p>We can see that Persona 5 has improved over its predecessors. Even though the number of interruptions has grown a bit in the first hour, the total interruption time is 24% shorter than in previous games. Also, the average interruption time has dropped from 9 minutes in Persona 3 to 4 minutes in Persona 5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1aUm_0VOrNquE9KoJWlMcg.png" /><figcaption>The time it takes for the first battle</figcaption></figure><p>When looking at combat, we see a massive improvement. The first battle in P5 happens within the first 3 minutes of the game. While P4 takes 20 minutes and P3 takes a whopping 40 minutes to get there. Looking back further, P2 takes 49 minutes to get to the first battle. We have a steady decrease from P2 onwards, with P1 being an outlier taking 36 minutes.</p><h3>Conclusion</h3><p>Even with a small sample size, we can see that Persona 5 takes control away from the player far too many times and for too long. Looking at the series, we can see that the Persona Team is aware of this. Persona 5 has improved dramatically when compared to previous entries in the series. But when looking at other JRPGs, that also have plenty of interruptions, the Persona series could take some hints from them.</p><p>I’d argue that in the first hours it’s okay to interrupt multiple times. Just keep it short and make sure the player does something interesting in between. As the game progresses, interruptions should be less frequent. Long interruptions should happen on important plot points. Players should have the option for side content with lengthy conversations.</p><p>Persona 5 is a great game. There is no denying it. It will be interesting to see the decisions the Persona Team takes moving forward.</p><p><strong>References</strong></p><ul><li><a href="https://www.youtube.com/watch?v=V1MAZm-IdhI&amp;t=6421s">P3 FES All Cutscenes</a></li><li><a href="https://www.youtube.com/watch?v=67aQaRVT8z0">P4 Golden All Cutscenes</a></li><li><a href="https://www.youtube.com/watch?v=9vgKlh0F_fs">P5 The Movie PT1</a></li><li><a href="https://www.youtube.com/watch?v=f9WOFNRc_kk">P5 The Movie PT2</a></li><li><a href="https://www.youtube.com/watch?v=1KMnSe8mKWA&amp;list=PLwSuoEdHGsjO8TcXXD-ZEUH257iWogxAC">DQ XI All Cutscenes</a></li><li><a href="https://www.youtube.com/watch?v=EsS7XhKrc4Q&amp;t=14142s">FF7 Remake All Cutscenes</a></li><li><a href="https://howlongtobeat.com/game.php?id=8441">How Long To Beat — Persona 3 FES</a></li><li><a href="https://howlongtobeat.com/game.php?id=6974">How Long To Beat — Persona 4 Golden</a></li><li><a href="https://howlongtobeat.com/game.php?id=15221">How Long To Beat — Persona 5</a></li><li><a href="https://www.youtube.com/watch?v=pt8PI-XZCQc&amp;list=PLDjk_rRy6X-i7r-iScRRqbYAwtQBW4d7Z&amp;index=2">Persona 2 Longplay</a></li><li><a href="https://youtu.be/AzUuFsUjaW8">Persona 2 Longplay Ref 2</a></li><li><a href="https://www.youtube.com/watch?v=_f9gxmgfJsA">Persona 1 First Hour</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ac9218b34f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Health Bars in Unity]]></title>
            <link>https://silviocarrera.medium.com/health-bars-in-unity-fdf30e4e2cba?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdf30e4e2cba</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[game-design]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[game-development]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Sun, 06 Dec 2020 19:00:45 GMT</pubDate>
            <atom:updated>2020-12-06T19:00:45.714Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s hard to find a game or even an app that doesn’t make use of bars to display information. In games, they are extremely common to present one of the player’s stats. Health (HP) being the most common one.</p><p>In Unity, there are a bunch of ways of doing a health bar. The easiest one, that’s built-in, is to add a UI Slider, remove the handle and adjust the fill rects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/395/1*8aW89O2gwbmyGvrDdikX2g.gif" /><figcaption>Turning a Unity Slider into a Stat Bar</figcaption></figure><p>Sure, it works. You’ll have to do it every time or you’ll have to create a prefab for it. It will be a hassle between projects. Plus, the slider has a lot of functionality to handle input. A stat bar only displays information.</p><p>We can use the slider as a base, remove what we don’t want, and increment with functionalities that suit our needs.</p><h4><strong>One-click Creation</strong></h4><p>Well, first let’s make it so we can create a new stat bar with a click of a button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/0*IxZvV2JCGjxGLYVI" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*hs_tk4xEZW0YBOu3Lv2sQw.png" /><figcaption>We get a nice and chunky HP Bar.</figcaption></figure><p>No changes are necessary. You get a health bar ready to go.</p><h4>Min Digits</h4><p>In many old JRPGS, you would always see a number of digits no matter the value. This option is also built-in the Stat Bar UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/0*v31HFW70Rvomoiai" /><figcaption>Sweet 90s JRPG feel</figcaption></figure><h4>Color Transition</h4><p>Another cool addition is that you can customize the color based on a given percentage. So when the value drops below 50% or 25% you can change the color to signal that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/0*0VQnU-JRLoLcSfY-" /><figcaption>Time to use those health potions</figcaption></figure><p>On the script side, things are straightforward as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*gjxgh9_4r3wjzCiCzP6UNQ.png" /></figure><p>Here’s the <a href="https://github.com/carreraSilvio/StatBarUI">URL </a>for the repository.</p><p>It will make it easy for you to add as many bars as you want without cluttering your code with third-party scripts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdf30e4e2cba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scriptable Objects in Separate Windows]]></title>
            <link>https://silviocarrera.medium.com/scriptable-objects-in-separate-windows-9da8aa4ab77d?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/9da8aa4ab77d</guid>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[game-development]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Sat, 14 Nov 2020 14:44:53 GMT</pubDate>
            <atom:updated>2020-11-14T14:44:53.529Z</atom:updated>
            <content:encoded><![CDATA[<p>As you have more ScriptableObjects in your project, it gets harder to maintain them. I developed a tool called <a href="https://github.com/carreraSilvio/Scrubber">Scrubber</a>. It allows you to edit your ScriptableObjects in separate windows without modifying your scripts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*mDy5s7RfXwey0R8xqPOrwQ.gif" /></figure><p>The Scrubber iterates through your ScriptableObject fields and displays them in a separate window. Import the scrubber in your project and right-click any ScriptableObject asset you have in your assets folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/549/1*1Z_AKY0FHLljDoTs1-teKA.png" /></figure><p>You’ll see two options: Scrubber Window and Fancy Scrubber Window. The Scrubber window draws your data like the inspector. The fancy option shows each field of your ScriptableObject on a side menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*Oio2StbM9lAbKA15mqiu8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*rdRBIF4Ug3_mdocgij77YQ.png" /><figcaption>Regular and Fancy Scrubber Window</figcaption></figure><p>With the Scrubber in your project, you can open each asset in a separate window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YNtqfB_HtnUrqXfCVv1GAA.png" /></figure><p>If you want even more flexibility, you can add an attribute to your ScriptableObjects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*IxckHumlq6a7de18qOzewQ.png" /><figcaption>The ScrubData Attribute gives you the option to double-click any DataAsset to open it in a separate window</figcaption></figure><p>This will allow you to double-click it to open it in the Scrubber Window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*mDy5s7RfXwey0R8xqPOrwQ.gif" /></figure><p>Try <a href="https://github.com/carreraSilvio/Scrubber">Scrubber</a>. A non-intrusive tool that makes you more productive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9da8aa4ab77d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dragon Quest Battle System - Part IV (Final)]]></title>
            <link>https://silviocarrera.medium.com/dragon-quest-battle-system-part-iv-final-e47459385947?source=rss-bcaf3b00890------2</link>
            <guid isPermaLink="false">https://medium.com/p/e47459385947</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[jrpg]]></category>
            <category><![CDATA[dragon-quest]]></category>
            <dc:creator><![CDATA[Silvio Carrera]]></dc:creator>
            <pubDate>Fri, 04 Sep 2020 17:01:05 GMT</pubDate>
            <atom:updated>2020-09-04T17:01:05.315Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/496/0*dlP5CE-6be1XezAL.png" /></figure><p>This is the final part of the Dragon Quest Battle System tutorial.</p><p>On this entry, we’ll be tackling the spell and item menu. Then, we’ll add the hit and spell effects. Finally, sounds and music will be the icing on the cake.</p><p>If you haven’t checked out the other posts before, please have a look here: <a href="https://medium.com/@silviocarrera/dragon-quest-battle-system-part-i-8aac007936d">Part1 </a>— <a href="https://medium.com/@silviocarrera/dragon-quest-battle-system-part-ii-91c9fe91c05d">Part2 </a>— <a href="https://medium.com/@silviocarrera/dragon-quest-battle-system-part-iii-a8864237dc88">Part3</a></p><h3>Spell Menu</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/0*DjH2ZOwZALpxtHUf.png" /></figure><p>With the command window set-up, I decided I would have the first three spells working: Heal, Hurt, and Sleep.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*CwnsZN-Sbn9DdOjn.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/0*amo4hJzK6FANzdxD.png" /></figure><p>As you can see, it’s pretty much like the CommandAttack. It inherits from it. Since both the spell and attack command deal damage, it made sense to structure it this way. The spell is like a specialized form of attack. One of the differences is that we have to check the user’s MP before trying to execute it. Also, the damage formula is different since it takes into account the resistance to the spell type.</p><p>Now, you might wonder, wait a minute, the heal spell doesn’t deal any damage at all. That’s right, but we can deal negative damage when we want to heal. The process is the same. The main difference from heal to a damaging spell is the spell’s target. In the case of DQI, you’ll heal yourself. This is a neat way to use the same code to do different things. You can also see that it would be easy to target another character.</p><p>Now, another main difference is that the spells are in a sub-menu. The spells itself works like choosing the attack command, but to get there we need to have our sub-menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*HFlLvRKjCuIIBc_e.png" /></figure><p>The CommandMenu is another command that the character can have. In the original DQI when you don’t have a spell and select the sub-menu a message displays. This class holds that message in case we need it, and also aggregates the spells itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*pHXTuNQ21XWe0Hr_.png" /></figure><p>We also need another phase to pick a sub-command. The spell window works like the base command window. It actually uses the same class, but it points to different data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/0*NvciRidgLn_RgO3w.png" /></figure><h3>Sleep Spell</h3><p>The sleep spell needed a bit more code for it to work. First, we need to take into account the status effect. We now have to consider the characters to be able to receive a condition (eg. sleep, dead, silenced).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*TU-yYsrPg5FtqeUy.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/0*LRyux1cnmCqswgAP.png" /></figure><p>The condition class is used by the character class to handle status effects. It allows us to add a status effect to the character and to check the situation of it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ldJKh8GyD_XWgtQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*7F42osmUJjA8SBpf.png" /></figure><p>The status effect handles the effect itself. It will track the number of turns it has passed with the effect and it stores two messages for us. One for when the effect is on another when the character gets rid of it. As you can see I’ve left up a comment there. If we wanted to make a healing item or anything else, it would be pretty direct as well.</p><p>The way it’s set up it’s easy for us to expand it an allow for more than one effect to take place. You can have a buff on while being poisoned and so on. It took a while but I was happy with how everything turned out.</p><h3>Item Menu</h3><p>Once we have the spell sub-command set up, the item one is pretty straightforward. Items work pretty much like a spell in a general sense. They have different parameters in this case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*ioL8mehBeaaxy2vA.png" /></figure><p>As you can see, we’ll pass along what type of usage this particular item has. In DQI you start with a “Torch” item that can only be used when inside dungeons. So in this case we’ll set the UsageType to FieldOnly. When we try it in battle a message will popup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/0*S23TgBdMznFyjbNR.gif" /></figure><h3>Hit and Spell Effects</h3><p>To handle the hit effects on the enemies let’s take a look at the BattleCharacter class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/0*6meeaq4vfKEXq4gx.png" /></figure><p>As you can see it’s pretty simple. In our case we want the slime to blink when it’s hit. So once it does get hit with a command we’ll call the TakeHit function. The function will start a coroutine that will toggle the visibility of the sprite for a short period of time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/0*2WYjO7EaPjhtY_iF.gif" /></figure><p>For the spells, we’ll make a grayscale effect. It shifts the color from the regular one to it’s grayscale. So like toggling the sprite effect but with the color. Unity offers a script to do grayscale on your camera on their standard assets package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/0*1dxT_z4PGU8G_ua2.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/0*nqEiVQdfS9XBD17I.png" /></figure><p>Like with the screen shake effect, we add a parameter to signal the grayscale effect. We then call it in case it’s set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/0*7KSroxzRJsyVQtk-.gif" /></figure><h3>Sound and Music</h3><p>Since I already have a class that handles all the audio this section was more brute work. The basic idea is that I have two controllers, one of music and another for sound effects. One manager will load up the audio files and set them to each controller. We then have a variable pointed to it for ease of use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/0*msrnteANHTs_ROyV.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/0*t7lsY-7BVCuC3V9f.png" /></figure><p>We then fire the music when the game starts and when each of the attacks happens. I also had to add to the command class a variable that mentioned what audio to play. The battle character as you can see already has that. So when the enemy takes a hit, it will have an audio set to it already. This way it will be synchronized, the hit effect with the audio being played.</p><h3>Final Thoughts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*7w7a4wK9TakPmxU2Hz_TpA.gif" /><figcaption>Final Result</figcaption></figure><p>Thanks for following the process up to the end. I hope you enjoyed it.</p><p>If you haven’t seen the other posts you can check them here:<br><a href="https://medium.com/@silviocarrera/dragon-quest-battle-system-part-i-8aac007936d">Part1 </a>— <a href="https://medium.com/@silviocarrera/dragon-quest-battle-system-part-ii-91c9fe91c05d">Part2 </a>— <a href="https://medium.com/@silviocarrera/dragon-quest-battle-system-part-iii-a8864237dc88">Part3</a></p><p><em>Originally published at </em><a href="http://tumblr.com/"><em>https://www.tumblr.com</em></a><em> on December 15, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e47459385947" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>