<?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: Dzaki Maulid Hidayat</title>
    <description>The latest articles on DEV Community by Dzaki Maulid Hidayat (@dzakimaulidh).</description>
    <link>https://dev.to/dzakimaulidh</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%2F4271695%2F494d4cf9-ce3d-4be6-8338-971c03f30a91.png</url>
      <title>DEV Community: Dzaki Maulid Hidayat</title>
      <link>https://dev.to/dzakimaulidh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dzakimaulidh"/>
    <language>en</language>
    <item>
      <title>My browser fighting game's models: resample saved nothing, meshopt saved 59%</title>
      <dc:creator>Dzaki Maulid Hidayat</dc:creator>
      <pubDate>Sun, 29 Nov 2026 04:43:04 +0000</pubDate>
      <link>https://dev.to/dzakimaulidh/my-browser-fighting-games-models-resample-saved-nothing-meshopt-saved-59-3j6h</link>
      <guid>https://dev.to/dzakimaulidh/my-browser-fighting-games-models-resample-saved-nothing-meshopt-saved-59-3j6h</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw3xil49rf6ei489cdf6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw3xil49rf6ei489cdf6z.png" alt=" " width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fniw6jz4dtq161hge9in2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fniw6jz4dtq161hge9in2.png" alt=" " width="800" height="338"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I made SKY BRAWL, a 2.5D low-poly fighting game that runs in the browser, built with Three.js and Vite. You can try it at &lt;a href="https://dzakimaulid.web.id" rel="noopener noreferrer"&gt;https://dzakimaulid.web.id&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The tip
&lt;/h2&gt;

&lt;p&gt;After I shared it, someone pointed out that about 55% of my six hero &lt;code&gt;.glb&lt;/code&gt; files was animation keyframes, not mesh, and suggested &lt;code&gt;gltf-transform resample&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I measured
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;Total size of 6 models (bytes)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Original&lt;/td&gt;
&lt;td&gt;4,050,032&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After &lt;code&gt;resample&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;4,050,152&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;After &lt;code&gt;meshopt&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;1,673,848&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;resample&lt;/code&gt; made practically no difference on my files. &lt;code&gt;meshopt&lt;/code&gt;, which compresses geometry and animation, cut the total by about 59%.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx @gltf-transform/cli meshopt input.glb output.glb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loader then needs the decoder that ships with Three.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;GLTFLoader&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;span class="nc"&gt;MeshoptDecoder&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"three/examples/jsm/loaders/GLTFLoader.js"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"three/examples/jsm/libs/meshopt_decoder.module.js"&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;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;gltf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;GLTFLoader&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;span class="nf"&gt;setMeshoptDecoder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MeshoptDecoder&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loadAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&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;p&gt;In my Vite build the decoder is a 26.48 kB chunk (7.26 kB gzipped). I compared file sizes only, not load times or FPS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other things I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The 3D models are visual only. Physics and hitboxes stayed in the original code, which made the swap much safer.&lt;/li&gt;
&lt;li&gt;Holding "back" put the fighter in a block state, so the new model froze in a defend pose while moving. It needed its own walk case.&lt;/li&gt;
&lt;li&gt;The model pack has no jump or crouch clips, so I had to fake both.&lt;/li&gt;
&lt;li&gt;AI coding agents sometimes reported work as done when it wasn't. Checking the diff and the numbers myself became part of the job.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hero models are from the RTS Units pack at 3d-asset.com.&lt;/p&gt;

&lt;p&gt;If you have ideas for making it lighter or better on phones, I'd love to hear them.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The game was built with AI assistance, and this article was drafted with AI help and reviewed by me.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>threejs</category>
      <category>gamedev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
