It's funny how often you have to look backwards to solve a new problem.

    I've been trying to build a proper spatial registry on-chain. Basically, making sure polygons don't overlap and area is conserved. You'd think this is simple, but if you try doing it on EVM, or even Solana and Aptos, you hit a wall pretty fast. Their execution models just aren't built for traversing dynamic objects at runtime without burning insane amounts of gas.

    I realized blockchains are essentially just very slow, resource-constrained computers. You know who else had to write code for slow, resource-constrained computers? Game developers in the 1990s.

    So I dug up some old game engine math. Specifically, exact SAT (Separating Axis Theorem) for collision detection, and Morton Z-curves for addressing.

    I found that if you combine these old-school primitives with Sui's object model — which actually handles dynamic objects well — it works perfectly. It scales logarithmically instead of linearly.

    It worked well enough that I decided to rip it out of our main product and just open-source it. We call it Mercator https://github.com/mercaearth/mercator

    I wrote down some thoughts on how game engine architecture translates to distributed systems here: https://docs.merca.earth/blog/1990s-game-dev-algorithms-distributed-systems

    Has anyone else here tried porting old dev tricks into web3? Curious what kind of bottlenecks you ran into.

    Game Engine Collision Detection to Smart Contracts
    byu/WoodenIndependent626 inCryptoTechnology



    Posted by WoodenIndependent626

    Leave A Reply
    Share via
    Share via