惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
L
LangChain Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Recent Announcements
Recent Announcements
U
Unit 42
Recorded Future
Recorded Future
C
Check Point Blog
Microsoft Azure Blog
Microsoft Azure Blog
A
Arctic Wolf
N
News and Events Feed by Topic
AI
AI
TaoSecurity Blog
TaoSecurity Blog
S
Security Archives - TechRepublic
美团技术团队
小众软件
小众软件
Blog — PlanetScale
Blog — PlanetScale
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Scott Helme
Scott Helme
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Hacker News: Ask HN
Hacker News: Ask HN
V
V2EX
人人都是产品经理
人人都是产品经理
量子位
云风的 BLOG
云风的 BLOG
T
The Blog of Author Tim Ferriss
Hacker News - Newest:
Hacker News - Newest: "LLM"
B
Blog RSS Feed
宝玉的分享
宝玉的分享
I
InfoQ
S
Secure Thoughts
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security @ Cisco Blogs
Microsoft Security Blog
Microsoft Security Blog
IT之家
IT之家
F
Fortinet All Blogs
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threatpost
J
Java Code Geeks
L
LINUX DO - 最新话题
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com

Hacker News

Introducing Claude Opus 4.7 Qwen Studio The Future of Everything is Lies, I Guess: Where Do We Go From Here? GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis Ancient DNA reveals pervasive directional selection across West Eurasia [pdf] Moving a large-scale metrics pipeline from StatsD to OpenTelemetry / Prometheus GitHub - Nightmare-Eclipse/RedSun: The Red Sun vulnerability repository GitHub - SethPyle376/hiraeth: Local AWS emulator focused on fast integration testing, with SQS support, SQLite-backed state, and a debug-friendly web UI. GitHub - macOS26/Agent: Any AI, replaces Claude Code, Cursor, OpenClaw. Over 18 LLM providers (Claude, OpenAI, Gemini, Ollama, Zai, HF, Qwen) wired into a native Mac app that writes code, builds Xcode projects, bumps versions, manages git, automates Safari, use AppleScript, JS or Accessibility, extend Agent! w/ MCP Servers, run tasks from your iPhone via Messages. YouTube now lets you turn off Shorts I Made a Terminal Pager Burgers | マクドナルド公式 Commands — HackerNews CLI documentation ChatGPT for Excel PiCore - Raspberry Pi Port of Tiny Core Linux Live Nation illegally monopolized ticketing market, jury finds Google Broke Its Promise to Me. Now ICE Has My Data. Founding Engineer at Adaptional | Y Combinator CRISPR takes important step toward silencing Down syndrome’s extra chromosome GitHub - saffron-health/libretto: The AI toolkit for building reliable browser automations US v. Heppner (S.D.N.Y. 2026) no attorney-client privilege for AI chats [pdf] Unexpected €54k billing spike in 13 hours: Firebase browser key without API restrictions used for Gemini requests Retrofitting JIT Compilers into C Interpreters IPv6 – Google The Accursèd Alphabetical Clock Cybersecurity Looks Like Proof of Work Now Fragments: April 14 Cal.com Goes Closed Source: Why AI Security Is Forcing Our Decision | Cal.com - Scheduling Software for Online Bookings Laravel raised money and now injects ads directly into your agent When moving fast, talking is the first thing to break Too much Discussion of the XOR swap trick – Heather Cafe Introduction to Spherical Harmonics for Graphics Programmers The Grand Line Building a Z-Machine in the worst possible language High-Level Rust: Getting 80% of the Benefits with 20% of the Pain GitHub - duguyue100/midnight-captain: Inspired by Midnight Commander, tailored to my taste. How to build a `git diff` driver · Jamie Tanna | Software Engineer Center for Responsible, Decentralized Intelligence at Berkeley The Local Universe’s Expansion Rate Is Clearer Than Ever, but Still Doesn’t Add Up - A new synthesis of astronomical measurements confirms a persistent mismatch that could point to physics beyond current models The air throughout our homes is infused with microplastics. But there are things you can do to breathe less of them The disturbing white paper Red Hat is trying to erase from the internet – OSnews The Future of Everything is Lies, I Guess: Annoyances ‘Abhorrent’: the inside story of the Polymarket gamblers betting millions on war Productive procrastination — Max van IJsselmuiden maps, territory and LMs 447 Terabytes per Square Centimetre at Zero Retention Energy: Non-Volatile Memory at the Atomic Scale on Fluorographane Show HN: Pardonned.com – A searchable database of US Pardons 20 Years on AWS and Never Not My Job The Seasons are Wrong Artemis II crew splashes down near San Diego after historic moon mission We gave an AI a 3 year retail lease in SF and asked it to make a profit | Andon Labs How a dancer with ALS used brainwaves to perform live On filing the corners off my MacBooks Installing every* Firefox extension OpenClaw’s memory is unreliable, and you don’t know when it will break Steve Blank Nowhere Is Safe Chimpanzees in Uganda locked in vicious 'civil war', say researchers watgo - a WebAssembly Toolkit for Go linux/Documentation/process/coding-assistants.rst at master · torvalds/linux GitHub - callumlocke/json-formatter: Makes JSON easy to read. Founding Product Engineer at Bild AI | Y Combinator A compelling title that is cryptic enough to get you to take action on it GitHub - Keychron/Keychron-Keyboards-Hardware-Design: Industrial design files for Keychron keyboards and mice. 100+ models with CAD assets in STEP, DXF, DWG, and PDF. Source-available, with commercial use allowed for original compatible accessories within the license terms. [ANNOUNCE] WireGuardNT v0.11 and WireGuard for Windows v0.6 Released 1D-Chess Helium Is Hard to Replace Cooperative Vectors Introduction | Evolve Keeping a Postgres queue healthy — PlanetScale Our response to the Axios developer tool compromise Do Americans read print books, e-books or audiobooks more? The Zettelkasten Method in Obsidian: A Practical Setup Guide Artemis II Is Competency Porn and We Are Starving For It WeakC4 Flight Viz — Cockpit View A Mexican surveillance giant you’ve never heard of is now watching the U.S. border Surelock: Deadlock-Free Mutexes for Rust RISC-V 101 – what is it and what does it mean for Canonical? | Ubuntu The Problem That Built an Industry How Much Linear Memory Access Is Enough? | Solidean Investigating Split Locks on x86-64 Simplest hash functions Sybilproof reputation mechanisms (2005) [pdf] What is a property? How Complex is my Code? Static code analysis in Kotlin — tools overview Toffoli gates are all you need PGLite evangelism dcmake: a new CMake debugger UI Clojure on Fennel part one: Persistent Data Structures Fragments: April 2 Python Release Python install manager 26.1 The Life and Death of the Book Review - Liberties Bitcoin miners are losing $19,000 on every BTC produced as difficulty drops 7.8% God sleeps in the minerals Building slogbox Apple Silicon and Virtual Machines: Beating the 2 VM Limit Who was “Not Even Wrong” first? Pokemon Evolution Vs Darwinian Evolution The APL Programming Language Source Code
Porting Match Morphosis To WASM | ernesernesto io
2026-06-13 · via Hacker News

I wrote a game in plain C with a custom engine (bgfx, SDL2, miniaudio, cimgui) and recently ported it to web via Emscripten. Its live on itchio now. Here’s everything non-obvious that I ran into, hopefully saves someone some pain.

0. Had to go back to Visual Studio. Ugh.

I use RemedyBG as my daily debugger and its great, but it doesnt support 32-bit processes. Since WASM is 32-bit, I needed a 32-bit native build to reproduce bugs locally, which meant firing up Visual Studio again.

Turns out you don’t need a solution file. Just run:

devenv build\main.exe

and before you build, add vcvars32 to your build process

call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars32.bat"

On VS, just Hit F5 or F11 and it runs the exe directly. No sln file needed, works fine for stepping through code and catching crashes. Not ideal but got the job done.

1. Web is 32-bit. Your 64-bit structs will break.

This was the root cause of most of my bugs. WASM is 32-bit address space, pointers are 4 bytes not 8. I was serializing asset structs directly to disk (pak file) that had raw pointers in them:

typedef struct AssetSprite {
    u32 width, height;
    u8* dataBytes;  // 8 bytes on 64-bit, 4 bytes on WASM
    i32 dataSize;
} AssetSprite;

When I packed assets on 64-bit Windows and loaded them on WASM, the struct layout was completely different. sizeof(Assets) was 26328 on native and 25556 on web. Every field after the first pointer was at the wrong offset, so all texture and shader data came out as garbage.

In hindsight this is probably obvious to anyone who builds cross platform regularly, but I havent built 32-bit in years so I tripped on the pointer size thing.

Fix: I separated runtime data from baking data entirely. Instead of a pointer living inside the asset struct, I now have a flat array on the side:

AssetDataBytes assetData[TOTAL_ASSET_COUNT];
i32 assetDataId;

typedef struct AssetDataBytes {
    u8* data;
    i32 size;
} AssetDataBytes;

Every time I add a new asset during baking, just bump assetDataId and write the bytes there. The serialized asset struct has no pointers at all, so layout is identical on 32 and 64-bit. Packer is single threaded and still finishes under 3 seconds for the whole game, good enough for my use case since asset count is relatively small.

2. Debug in 32-bit native, not the browser

This was the biggest productivity unlock honestly. Since 32-bit native has the same struct sizes as WASM, bugs that only appeared on web also appeared on 32-bit native, where I had real breakpoints, memory watch, and call stacks.

For actually hunting the bugs I used a combination of /fsanitize=address when compiling plus data breakpoints. Trigger the bug, ASan will catch the bad access. Data breakpoint would also tells you exactly what wrote to that address. Makes what would be a multi hour hunt into something you can solve pretty quickly. Dont try to debug WASM crashes from the browser console alone since its painful and slow.

3. A bug that was silently correct on 64-bit

typedef struct ThingHandle {
    i32 id;
    i32 generation;
} ThingHandle;

// wrong
game->boardPieces = swAlloc(sizeof(ThingHandle*) * row * column);

// correct
game->boardPieces = swAlloc(sizeof(ThingHandle) * row * column);

On 64-bit, sizeof(ThingHandle*) is 8, which happens to be the same as sizeof(ThingHandle). So the wrong code allocated exactly the right amount of memory by coincidence and worked fine for a while. On 32-bit WASM, sizeof(ThingHandle*) is 4, so it allocated half the memory it needed and corrupted whatever came after it. Pretty classic mixup, just hidden for a long time by 64-bit making them accidentally equal.

4. OpenGL ES (WebGL) is way stricter than Direct3D

bgfx uses Direct3D on Windows and OpenGL ES on web. A bunch of things I got away with on D3D broke hard on WebGL:

Vertex layout renderer type: I was passing BGFX_RENDERER_TYPE_NOOP to bgfx_vertex_layout_begin. Works on D3D, broken on OpenGL because it cant assign correct attribute locations. Use bgfx_get_renderer_type() instead.

Component count mismatch: I had COLOR1 declared as 2 components in the layout but the shader used vec4. D3D ignores the mismatch. OpenGL ES throws a fatal every frame. Component counts must exactly match what the shader declares.

Framebuffer Y flip - OpenGL has Y=0 at the bottom, D3D has Y=0 at the top. My fullscreen blit was upside down on web. Fixed by flipping UV V coordinates in the final render target texture blit.

5. Shaders need recompiling for GLSL ES

bgfx’s shaderc compiles for specific backends. My shaders were HLSL compiled for DirectX. On web I needed GLSL ES, profile flag changes from -p s_5_0 to -p 300_es.

Two things that tripped me up:

  • lerp() is HLSL only. GLSL uses mix(). bgfx’s bgfx_shader.sh already defines mix as a cross platform macro so just use that everywhere and both platforms work.
  • GLSL ES is strict about integer vs float. Passing 0 or 1 to a float parameter is a compile error. Has to be 0.0 and 1.0.

6. Web Audio autoplay + a weird Emscripten exports issue

Google has implemented a policy in their browsers that prevent automatic media output without first receiving some kind of user input. Miniaudio handles this internally by registering click and touchend listeners that resume the AudioContext automatically. I spend too much time trying to make miniaudio web build works messing around with a lot of it’s flags AUDIO_WORKLET, WASM_WORKERS, ASYNCIFY. Even trying to make a different initialization path between web & native, the web init after the first touch, but it still not working, there’s still an error throws on the js console when the AudioContext initialized.

Turns out newer versions of Emscripten seem to remove some runtime exports by default. miniaudio needs HEAPF32 to be available from JS side and it wasnt. Had to explicitly add it:

-s EXPORTED_RUNTIME_METHODS="['ccall','cwrap','HEAPF32']"

Not sure if this is a newer Emscripten behavior or a combination of my flags, couldn’t find anything on google about it, might save someone an hour of head scratching. All things considered, miniaudio really get the job done, nothing need to be initialized differently between native and web

Final thoughts

Genuinely happy with how it turned out, I spent a weekend on this port and honestly expected it to take longer. Writing a custom C engine, porting it to web, having the game load fast and play instantly with no Unity or Godot baggage, that feels really good.

The Emscripten toolchain is solid. Most of the pain came from things that worked by accident on Windows that the web holds you accountable for. Once you know what to look for, fixing them is pretty straightforward.

Game is live https://zhongda8.itch.io/matchmorphosis

And you can wishlist it https://store.steampowered.com/app/4131100/Match_Morphosis

Thanks for reading!