<?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>DEV Community: Lukas Rennhofer</title>
    <description>The latest articles on DEV Community by Lukas Rennhofer (@lrdev).</description>
    <link>https://dev.to/lrdev</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%2F2979193%2Fe506e647-244b-40f5-9138-f87990f48190.png</url>
      <title>DEV Community: Lukas Rennhofer</title>
      <link>https://dev.to/lrdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lrdev"/>
    <language>en</language>
    <item>
      <title>Building a Low-Level Game Engine from Scratch</title>
      <dc:creator>Lukas Rennhofer</dc:creator>
      <pubDate>Wed, 26 Mar 2025 17:53:45 +0000</pubDate>
      <link>https://dev.to/lrdev/building-a-low-level-game-engine-from-scratch-1ome</link>
      <guid>https://dev.to/lrdev/building-a-low-level-game-engine-from-scratch-1ome</guid>
      <description>&lt;p&gt;For a while now, I’ve been working on CHIFEngine, a low-level graphics engine designed for large-scale open-world games. The goal? To create something different from others. I am focusing on making a Engine, that´s completely customizable and easy to extend but tailored for my own needs—performance-focused and capable of handling massive, procedurally generated worlds.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture – A Custom Approach
&lt;/h2&gt;

&lt;p&gt;CHIFEngine is built around an ECS (Entity Component System) to keep things modular and efficient. Instead of handling entities in an OOP-heavy way, components are stored in contiguous memory to improve cache efficiency and performance.&lt;/p&gt;

&lt;p&gt;For rendering, I’m using OpenGL (later on Vulkan), but the architecture allows for future extensions like DirectX or even ray tracing implementations. The engine is also built to support both PC and Switch Homebrew, meaning portability is key.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some key features:

&lt;ul&gt;
&lt;li&gt;✅ Custom ECS – High-performance, flexible, and minimal overhead.&lt;/li&gt;
&lt;li&gt;✅ Procedural Generation – Handling large, infinite terrains dynamically.&lt;/li&gt;
&lt;li&gt;✅ Low-Level Rendering – Optimized Graphics API pipelines.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Job System – Keeping Everything Fast
&lt;/h2&gt;

&lt;p&gt;One of the core features of CHIFEngine is its custom job system, which ensures that expensive tasks like physics, AI, and procedural generation run asynchronously without blocking the main thread.&lt;/p&gt;

&lt;p&gt;The job system follows a task graph model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Tasks are broken down into independent units.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The system distributes them across available CPU threads.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dependencies are handled automatically to prevent race conditions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows for parallel execution of heavy workloads, such as terrain generation, background asset loading, or even GPU-based calculations. Without this system, handling open-world mechanics at scale would be far too slow.&lt;/p&gt;

&lt;p&gt;An example of a simple and modified Job System:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cpp"&gt;&lt;code&gt;&lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;JobDispatchArgs&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;jobIndex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;groupIndex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="n"&gt;chif&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Core&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;JobSystem&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Create the internal resources such as worker threads, etc. Call it once when initializing the application.&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Initialize&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;// Add a job to execute asynchronously. Any idle thread will execute this job.&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Divide a job onto multiple jobs and execute in parallel.&lt;/span&gt;
    &lt;span class="c1"&gt;//  jobCount    : how many jobs to generate for this task.&lt;/span&gt;
    &lt;span class="c1"&gt;//  groupSize   : how many jobs to execute per thread. Jobs inside a group execute serially. It might be worth to increase for small jobs&lt;/span&gt;
    &lt;span class="c1"&gt;//  func        : receives a JobDispatchArgs as parameter&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;jobCount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;uint32_t&lt;/span&gt; &lt;span class="n"&gt;groupSize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;function&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;JobDispatchArgs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Check if any threads are working currently or not&lt;/span&gt;
    &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;IsBusy&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;// Wait until all threads become idle&lt;/span&gt;
    &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="n"&gt;Wait&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Struggles – Every Engine Has Them
&lt;/h2&gt;

&lt;p&gt;🛠 Memory Management – Keeping everything fast without unnecessary allocations is a challenge. ECS helps, but proper memory tracking is crucial.&lt;/p&gt;

&lt;p&gt;🌍 Procedural Generation – Balancing performance with quality when generating large environments on the fly.&lt;/p&gt;

&lt;p&gt;📦 Asset Handling – Implementing an efficient way to load, unload, and manage assets dynamically.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There’s still a long way to go, but seeing CHIFEngine evolve is incredibly rewarding. If you're into game engine development, rendering, or large-scale world design, I’d love to discuss ideas! 🚀&lt;/p&gt;

&lt;p&gt;What are your thoughts on building custom engines? Ever tried working with ECS or procedural rendering? Let’s talk!&lt;/p&gt;

&lt;p&gt;CHIFEngine´s Github Repo: &lt;a href="https://github.com/LukasRennhofer/CHIFEngine" rel="noopener noreferrer"&gt;Github Link&lt;/a&gt;&lt;/p&gt;

</description>
      <category>learning</category>
      <category>productivity</category>
      <category>opengl</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
