<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Muhammad Daffa</title>
    <description>The latest articles on Forem by Muhammad Daffa (@dap23).</description>
    <link>https://forem.com/dap23</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1412577%2F772f623a-65b2-4708-97bf-2e2b472c83bb.jpeg</url>
      <title>Forem: Muhammad Daffa</title>
      <link>https://forem.com/dap23</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/dap23"/>
    <language>en</language>
    <item>
      <title>Why I Chose libGDX Over Unity for My First 2D Game</title>
      <dc:creator>Muhammad Daffa</dc:creator>
      <pubDate>Sat, 07 Feb 2026 02:13:04 +0000</pubDate>
      <link>https://forem.com/dap23/why-i-chose-libgdx-over-unity-for-my-first-2d-game-3oag</link>
      <guid>https://forem.com/dap23/why-i-chose-libgdx-over-unity-for-my-first-2d-game-3oag</guid>
      <description>&lt;h2&gt;
  
  
  When the itch to make a game hits, but the engine feels too heavy
&lt;/h2&gt;

&lt;p&gt;I remember the night I stared at Unity’s splash screen, wondering if I &lt;em&gt;had&lt;/em&gt; to wrestle with a visual editor, scene hierarchy, and a mountain of packages just to get a single sprite moving. The idea of building a tiny 2D platformer felt &lt;strong&gt;buried&lt;/strong&gt; under layers of abstraction I didn’t need. That’s when I dug into libGDX, a name I’d heard in a few Reddit threads but never actually tried.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;“If you want control, you have to write code. If you want a visual editor, you give up some control.”&lt;/em&gt; – my unofficial mantra during that experiment.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What you’ll walk away with
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Why a code‑first framework can feel faster for small games&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The practical pain points beginners hit when they first open a libGDX project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;When libGDX shines and when you should politely decline it&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  libGDX in plain English
&lt;/h2&gt;

&lt;p&gt;At its core, libGDX is a &lt;strong&gt;Java‑based game framework&lt;/strong&gt;. It gives you the low‑level building blocks—rendering, input handling, asset management—without imposing a scene editor or a drag‑and‑drop workflow. Think of it as a toolbox rather than a fully assembled workshop. You write the main loop yourself, you decide how assets are loaded, and you ship to &lt;strong&gt;desktop, Android, and web&lt;/strong&gt; (via GWT) from the same codebase.&lt;/p&gt;

&lt;p&gt;That distinction matters. Unity and Godot ship with an editor that &lt;em&gt;looks&lt;/em&gt; like a game already; libGDX hands you a blank canvas and says, “Write the canvas.”&lt;/p&gt;




&lt;h2&gt;
  
  
  The feeling of control vs. the comfort of a visual editor
&lt;/h2&gt;

&lt;p&gt;When I first opened the generated &lt;code&gt;core&lt;/code&gt; module in IntelliJ, the only thing that greeted me was a &lt;code&gt;DesktopLauncher&lt;/code&gt; class with a tiny &lt;code&gt;LwjglApplication&lt;/code&gt;. No drag‑and‑drop hierarchy, no inspector panels, just a &lt;strong&gt;&lt;code&gt;create()&lt;/code&gt;&lt;/strong&gt; method waiting for me to sprinkle some code. That rawness can be intimidating, but it also feels &lt;strong&gt;empowering&lt;/strong&gt;. Every pixel that appears on screen is the result of a line I wrote, not a hidden script the editor runs behind the scenes.&lt;/p&gt;

&lt;p&gt;Unity’s inspector lets you tweak a sprite’s position in a GUI, which is great for rapid iteration, but you quickly discover you’re &lt;strong&gt;tied to the editor&lt;/strong&gt;. Exporting to Android means the Unity build pipeline runs, and you spend minutes waiting for the editor to re‑import assets you barely touched. With libGDX, a quick &lt;code&gt;gradlew desktop:run&lt;/code&gt; launches the game in seconds, and any Java change is reflected on the next run.&lt;/p&gt;




&lt;h2&gt;
  
  
  The usual stumbling blocks for newcomers
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Project setup feels manual&lt;/strong&gt; – The Gradle scripts generated by the &lt;code&gt;gdx-setup&lt;/code&gt; wizard are functional, but they’re not a one‑click “Create New Project” button. You’ll spend a few minutes tweaking the &lt;code&gt;build.gradle&lt;/code&gt; files, especially if you want to add a third‑party library.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No visual editor&lt;/strong&gt; – There’s nothing to click and drag. All asset placement, animation timing, and UI layout happen in code or external tools (e.g., TexturePacker). That can feel like a regression if you’re used to Unity’s scene view.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asset pipeline quirks&lt;/strong&gt; – libGDX expects assets in a specific folder structure (&lt;code&gt;assets/&lt;/code&gt; for each platform). Forgetting to copy a texture into the Android module’s assets folder is a classic “Why does it work on desktop but not on my phone?” moment.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I spent an entire afternoon hunting down a missing &lt;code&gt;png&lt;/code&gt; that only failed on Android. The fix was a single line in the &lt;code&gt;android&lt;/code&gt; module’s &lt;code&gt;build.gradle&lt;/code&gt; to include the assets folder. Small, but a reminder that &lt;strong&gt;the framework trusts you&lt;/strong&gt; to keep things tidy.&lt;/p&gt;




&lt;h2&gt;
  
  
  A realistic first project: a simple 2D “catch‑the‑falling‑object” game
&lt;/h2&gt;

&lt;p&gt;Instead of diving straight into a full‑blown RPG, I started with a &lt;strong&gt;single‑screen game&lt;/strong&gt; where the player moves a bucket left and right to catch falling apples. The scope is narrow enough to finish in a weekend, yet it forces you to touch every major subsystem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Input&lt;/strong&gt; – Keyboard or touch handling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rendering&lt;/strong&gt; – SpriteBatch for drawing textures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asset management&lt;/strong&gt; – Loading textures, sounds, and disposing of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Screen management&lt;/strong&gt; – Switching from a start menu to the gameplay screen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross‑platform testing&lt;/strong&gt; – Running the same code on desktop and an Android emulator.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because libGDX abstracts the platform layer, the same &lt;code&gt;Game&lt;/code&gt; class runs everywhere. The only platform‑specific code lives in the launchers (&lt;code&gt;DesktopLauncher&lt;/code&gt;, &lt;code&gt;AndroidLauncher&lt;/code&gt;, &lt;code&gt;HtmlLauncher&lt;/code&gt;). That separation kept my codebase clean and gave me confidence that the game would behave the same on a phone as it did on my laptop.&lt;/p&gt;




&lt;h2&gt;
  
  
  When libGDX is the right tool – and when it isn’t
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Great fit&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You enjoy &lt;strong&gt;writing code&lt;/strong&gt; more than fiddling with UI panels.&lt;/li&gt;
&lt;li&gt;The game is &lt;strong&gt;2D, lightweight, and targeted at multiple platforms&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You want &lt;strong&gt;full control over the rendering pipeline&lt;/strong&gt; (e.g., custom shaders, precise batching).&lt;/li&gt;
&lt;li&gt;You’re comfortable with &lt;strong&gt;Java/Kotlin&lt;/strong&gt; (or willing to learn).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Not a good fit&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your vision includes &lt;strong&gt;complex 3D scenes, physics, or a large team of artists&lt;/strong&gt; who rely on a visual workflow.&lt;/li&gt;
&lt;li&gt;You need &lt;strong&gt;out‑of‑the‑box networking, multiplayer, or advanced animation tools&lt;/strong&gt; that are baked into engines like Unity.&lt;/li&gt;
&lt;li&gt;You’re on a &lt;strong&gt;tight deadline&lt;/strong&gt; and can’t afford the initial setup overhead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In those latter cases, the time you spend wrestling with Gradle and asset pipelines can outweigh the benefits of libGDX’s flexibility.&lt;/p&gt;




&lt;h2&gt;
  
  
  Grounded takeaway
&lt;/h2&gt;

&lt;p&gt;If you’re the kind of developer who feels a surge of satisfaction every time a line of code makes something appear on screen, libGDX is worth a try. It forces you to &lt;strong&gt;understand the fundamentals&lt;/strong&gt;—render loops, input polling, asset lifecycles—rather than hiding them behind a polished editor. That knowledge pays off later, whether you stay in the libGDX ecosystem or migrate to a larger engine.&lt;/p&gt;

&lt;p&gt;But don’t mistake “lightweight” for “easy.” The lack of a visual editor means you’ll spend more time &lt;strong&gt;setting up the project&lt;/strong&gt; and &lt;strong&gt;debugging asset paths&lt;/strong&gt;. If those chores feel like a roadblock, a more heavyweight engine might actually get you to ship faster.&lt;/p&gt;

&lt;p&gt;Either way, the most important thing is to start small, finish something, and let the experience guide the next decision. Happy coding!&lt;/p&gt;

</description>
      <category>libgdx</category>
      <category>gamedev</category>
      <category>java</category>
    </item>
  </channel>
</rss>
