<?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: Rui Aparecido de Moraes</title>
    <description>The latest articles on DEV Community by Rui Aparecido de Moraes (@rui_aparecidodemoraes_1).</description>
    <link>https://dev.to/rui_aparecidodemoraes_1</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1930986%2Ff5402d5b-b83c-4270-ae0a-f786eb0e9848.jpg</url>
      <title>DEV Community: Rui Aparecido de Moraes</title>
      <link>https://dev.to/rui_aparecidodemoraes_1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rui_aparecidodemoraes_1"/>
    <language>en</language>
    <item>
      <title>From Capcom to the Backend: High-Performance Data Streaming in .NET (Part 1)</title>
      <dc:creator>Rui Aparecido de Moraes</dc:creator>
      <pubDate>Tue, 06 Oct 2026 17:39:48 +0000</pubDate>
      <link>https://dev.to/rui_aparecidodemoraes_1/from-capcom-to-the-backend-high-performance-data-streaming-in-net-part-1-55nh</link>
      <guid>https://dev.to/rui_aparecidodemoraes_1/from-capcom-to-the-backend-high-performance-data-streaming-in-net-part-1-55nh</guid>
      <description>&lt;p&gt;From Capcom to the Backend: High-Performance Data Streaming in .NET (Part 1)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;From MT Framework and RE Engine to REX: Building Zero-Allocation Telemetry Pipelines with Lessons from Capcom's Next-Gen Architecture&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Prelude: The Lineage of Capcom's Engines (MT Framework → RE Engine → REX)
&lt;/h2&gt;

&lt;p&gt;To understand why a library like &lt;strong&gt;REDox&lt;/strong&gt; matters to software engineering at large, one must understand Capcom's unique engineering philosophy over the past two decades.&lt;/p&gt;

&lt;h3&gt;
  
  
  The MT Framework Era (2006)
&lt;/h3&gt;

&lt;p&gt;During the transition to the PS3 and Xbox 360 era, Capcom broke away from fragmented, game-specific codebases and engineered &lt;strong&gt;MT Framework&lt;/strong&gt; (&lt;em&gt;Multi-Target Framework&lt;/em&gt;). Debuting with titles like &lt;em&gt;Dead Rising&lt;/em&gt; and &lt;em&gt;Lost Planet&lt;/em&gt;, MT Framework established Capcom's reputation for squeezing maximum concurrency and multi-threading efficiency out of complex hardware architectures (such as the Cell Broadband Engine).&lt;/p&gt;

&lt;h3&gt;
  
  
  The RE Engine Revolution (2017)
&lt;/h3&gt;

&lt;p&gt;A decade later, photorealism and sub-millisecond input response became paramount. Capcom unveiled the &lt;strong&gt;RE Engine&lt;/strong&gt; (&lt;em&gt;Reach for the Moon Engine&lt;/em&gt;) alongside &lt;em&gt;Resident Evil 7: Biohazard&lt;/em&gt;. RE Engine was groundbreaking not only for its rendering and modular C# scripting layer, but also for its internal pipeline orchestration: fast hot-reloading, deterministic memory management, and cross-platform scalability spanning &lt;em&gt;Monster Hunter Rise&lt;/em&gt;, &lt;em&gt;Devil May Cry 5&lt;/em&gt;, and &lt;em&gt;Street Fighter 6&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Next Frontier: REX and REDox (2026)
&lt;/h3&gt;

&lt;p&gt;As hardware demands advanced toward exponential asset scale, AI-driven simulations, and cross-platform streaming, Capcom introduced &lt;strong&gt;REX&lt;/strong&gt; (&lt;em&gt;RE neXt ENGINE&lt;/em&gt;). REX is engineered to scale beyond existing RE Engine constraints, focusing heavily on modern modularity, extreme throughput, and data serialization efficiency.&lt;/p&gt;

&lt;p&gt;In October 2026, Capcom's R&amp;amp;D division reached a historic milestone by open-sourcing &lt;strong&gt;REDox&lt;/strong&gt; (&lt;code&gt;CAPCOM-TD-OSS/REDox&lt;/code&gt;) under the Apache 2.0 license. Defined as a &lt;em&gt;"high-performance, token-based structured data engine for .NET,"&lt;/em&gt; REDox is not an isolated experiment—it is a core architectural pillar of the REX engine itself.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. When Game Engine Architecture Meets Backend Engineering
&lt;/h2&gt;

&lt;p&gt;Software engineers outside the gaming industry might initially assume that engine-level code is too esoteric for general-purpose applications. In reality, modern game engines and distributed cloud backends share an identical core problem: &lt;strong&gt;how to serialize, transmit, and parse massive volumes of structured data with ultra-low latency and zero memory allocations.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whether maintaining 60 frames per second on a modern console or ingesting millions of telemetry signals per second across a distributed cloud cluster, the physical constraints of computing are identical:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU branch mispredictions and text-conversion overhead consume valuable clock cycles.&lt;/li&gt;
&lt;li&gt;Continuous memory allocations on the managed heap induce Garbage Collector (GC) pressure, triggering non-deterministic latency spikes.&lt;/li&gt;
&lt;li&gt;Verbose payloads strain network bandwidth and storage I/O.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By adopting the same architectural principles that power REX—continuous token streaming, contiguous memory views (&lt;code&gt;Span&amp;lt;T&amp;gt;&lt;/code&gt;), and stack-only lifecycle guarantees (&lt;code&gt;ref struct&lt;/code&gt;)—backend engineers can build dramatically faster, leaner distributed systems.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. The Real-World Scenario: Continuous GPS Telemetry
&lt;/h2&gt;

&lt;p&gt;Consider a large-scale logistics, fleet management, or shared-mobility platform. Vehicles, delivery couriers, and IoT edge devices continuously stream breadcrumb coordinates back to ingestion gateways:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Breadcrumb = { timestampUtc, latitude, longitude, speedKmh }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When ingesting updates at high frequencies (e.g., 10 Hz across tens of thousands of active nodes), payloads accumulate rapidly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="k"&gt;record&lt;/span&gt; &lt;span class="nc"&gt;struct&lt;/span&gt; &lt;span class="nf"&gt;GeoLocationPoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;TimestampUtc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;Latitude&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;Longitude&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="kt"&gt;float&lt;/span&gt; &lt;span class="n"&gt;SpeedKmh&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Latent Cost of the JSON Standard
&lt;/h3&gt;

&lt;p&gt;In modern enterprise architectures, JSON over HTTP or WebSockets remains the default standard due to its ubiquity and human-readable format. However, high-frequency JSON pipelines exhibit notable architectural bottlenecks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Floating-Point Formatting Penalty:&lt;/strong&gt; Converting a native 64-bit IEEE 754 floating-point number (&lt;code&gt;double&lt;/code&gt;) into an ASCII/UTF-8 string representation (e.g., &lt;code&gt;-23.435512&lt;/code&gt;) requires repeated string slicing and decimal formatting algorithms.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bandwidth Inflation:&lt;/strong&gt; A single coordinate triplet and metadata in formatted JSON typically requires between 120 and 160 bytes. In raw binary form, that identical payload requires less than 30 bytes—an immediate ~75% footprint reduction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Garbage Collection Churn:&lt;/strong&gt; Traditional deserializers allocate intermediary object graphs, arrays, or string instances on the managed heap, forcing Gen0 and Gen1 garbage collections under sustained ingestion loads.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  4. The Core Concept: Token-Based Sequential Engines
&lt;/h2&gt;

&lt;p&gt;Instead of constructing an entire Document Object Model (DOM) in memory or generating temporary strings, a &lt;strong&gt;token-based engine&lt;/strong&gt; structures data as a flat stream of markers and contiguous primitive payloads:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[StartTrack] -&amp;gt; [StartPoint] -&amp;gt; [Timestamp] (8B) -&amp;gt; [Latitude] (8B) -&amp;gt; [Longitude] (8B) -&amp;gt; [Speed] (4B) -&amp;gt; [EndPoint] -&amp;gt; ... -&amp;gt; [EndTrack]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why Tokens?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stream Processing:&lt;/strong&gt; Consumers can inspect tokens sequentially on the fly, performing calculations (such as boundary checks or aggregate speeds) without deserializing subsequent fields.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Predictable Memory Layout:&lt;/strong&gt; Binary sizes are deterministic and fixed, allowing developers to write directly into pre-allocated memory pools or stack-allocated buffers.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Modern .NET Primitives: The Secret Behind Zero-Allocation
&lt;/h2&gt;

&lt;p&gt;To replicate the performance characteristics demonstrated by engines like REDox, three features in the modern .NET type system are essential:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;code&gt;Span&amp;lt;T&amp;gt;&lt;/code&gt; and &lt;code&gt;ReadOnlySpan&amp;lt;T&amp;gt;&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Introduced as fundamental building blocks in .NET, a &lt;code&gt;Span&amp;lt;T&amp;gt;&lt;/code&gt; provides a type-safe, contiguous window over arbitrary memory—whether that memory lives on the managed heap, the execution stack (&lt;code&gt;stackalloc&lt;/code&gt;), or unmanaged native buffers. &lt;/p&gt;

&lt;p&gt;Slicing a &lt;code&gt;Span&amp;lt;T&amp;gt;&lt;/code&gt; via &lt;code&gt;.Slice(start, length)&lt;/code&gt; performs a pure pointer/length offset calculation: &lt;strong&gt;$0$ heap allocations and $O(1)$ complexity&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;code&gt;ref struct&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;A &lt;code&gt;ref struct&lt;/code&gt; is restricted by the C# compiler to live exclusively on the &lt;strong&gt;stack&lt;/strong&gt;. Because it cannot be boxed, captured in asynchronous state machines (&lt;code&gt;async/await&lt;/code&gt;), or assigned as a field of a regular heap class, it guarantees that its lifecycle is bounded strictly to the local execution frame.&lt;/p&gt;

&lt;p&gt;This makes &lt;code&gt;ref struct&lt;/code&gt; the ideal construct for building high-speed parsers and serializers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Stack-only Token Reader: completely invisible to the Garbage Collector&lt;/span&gt;
&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;ref&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="nc"&gt;GeoTokenReader&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="n"&gt;ReadOnlySpan&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;_data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;_cursor&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;GeoTokenReader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ReadOnlySpan&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;_data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="n"&gt;_cursor&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="nf"&gt;ReadNextToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt; &lt;span class="kt"&gt;byte&lt;/span&gt; &lt;span class="n"&gt;tokenType&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_cursor&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;_data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;tokenType&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;tokenType&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;_cursor&lt;/span&gt;&lt;span class="p"&gt;++];&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&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;h3&gt;
  
  
  3. &lt;code&gt;System.Buffers.Binary.BinaryPrimitives&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Rather than relying on legacy &lt;code&gt;BitConverter&lt;/code&gt; calls that allocate byte arrays, &lt;code&gt;BinaryPrimitives&lt;/code&gt; provides static methods to read and write little-endian and big-endian scalars directly to and from spans:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Encodes a 64-bit float directly into a span with zero memory allocation&lt;/span&gt;
&lt;span class="n"&gt;BinaryPrimitives&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteDoubleLittleEndian&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;destinationSpan&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;latitude&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  6. What's Next in Part 2?
&lt;/h2&gt;

&lt;p&gt;In this first part, we examined Capcom's lineage from MT Framework through RE Engine to REX, the architectural motivation behind token-based data engines, and the core memory mechanics that make zero-allocation processing achievable in .NET.&lt;/p&gt;

&lt;p&gt;In &lt;strong&gt;Part 2&lt;/strong&gt;, we will roll up our sleeves and implement:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A fully functional &lt;code&gt;TokenStreamWriter&lt;/code&gt; and &lt;code&gt;TokenStreamReader&lt;/code&gt; tailored for high-density GPS coordinates.&lt;/li&gt;
&lt;li&gt;A formal &lt;strong&gt;BenchmarkDotNet&lt;/strong&gt; harness comparing JSON (&lt;code&gt;System.Text.Json&lt;/code&gt;) against tokenized binary streaming across 100, 1,000, and 10,000 coordinates.&lt;/li&gt;
&lt;li&gt;Cold-hard metrics: payload sizes, execution latency, and heap allocation graphs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Stay tuned, and get ready to benchmark your pipelines!&lt;/p&gt;




&lt;h2&gt;
  
  
  7. References &amp;amp; Further Reading
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Capcom Research &amp;amp; Development.&lt;/strong&gt; (2026). &lt;em&gt;REDox: High-performance, token-based structured data engine for .NET&lt;/em&gt;. GitHub Repository: &lt;a href="https://github.com/CAPCOM-TD-OSS/REDox" rel="noopener noreferrer"&gt;CAPCOM-TD-OSS/REDox&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capcom Co., Ltd.&lt;/strong&gt; (2023). &lt;em&gt;Capcom R&amp;amp;D / REX Engine Technology Presentation&lt;/em&gt;. Capcom Investor Relations &amp;amp; Technology Highlights.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Microsoft Learn.&lt;/strong&gt; (2024). &lt;em&gt;Memory and Span Usage Guidelines&lt;/em&gt;. Microsoft Documentation: &lt;a href="https://learn.microsoft.com/dotnet/standard/memory-and-spans/" rel="noopener noreferrer"&gt;learn.microsoft.com/dotnet/standard/memory-and-spans&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watson, Ben.&lt;/strong&gt; (2018). &lt;em&gt;Writing High-Performance .NET Code&lt;/em&gt; (2nd Edition). DBC Press.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Toure, Stephen &amp;amp; Microsoft Docs.&lt;/strong&gt; (2023). &lt;em&gt;How to use Utf8JsonReader and Utf8JsonWriter in C#&lt;/em&gt;. Microsoft Learn Documentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apache Software Foundation.&lt;/strong&gt; &lt;em&gt;Apache License, Version 2.0&lt;/em&gt;. &lt;a href="https://www.apache.org/licenses/LICENSE-2.0" rel="noopener noreferrer"&gt;apache.org/licenses/LICENSE-2.0&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>dotnet</category>
      <category>json</category>
      <category>capcom</category>
      <category>csharp</category>
    </item>
  </channel>
</rss>
