0xFableOrg / 0xFable

A fully on-chain trading card game. There will be elves, wizards & shit. Drama and broken friendships also.
https://twitter.com/0xFableGame
BSD 3-Clause Clear License
105 stars 39 forks source link

Investigate the possibility of migrating to MUD #29

Open norswap opened 1 year ago

norswap commented 1 year ago

This is for after the tech demo.

MUD simplifies development by synchronizing the frontend and the backend easily (amongst other things).

We can't really use MUD today because the game is "session-based": each player only really needs the data about the game he is currently in, as well as the cards he owns. MUD, on the other hand, synchronizes the whole "world" state, which in our case would be every game and global card ownership mappings. This is way overkill and wasteful.

I heard from Justin at Lattice (who develops MUD) that they intend to enable selective sync. We can consider using MUD once this is in, or we could try to contribute this feature upstream.

Another concern I have is that currently, 0xFable works without indexer, but MUD requires an indexer (it is possible to use a frontend indexer, but the necessity to reprocess the whole blockchain history makes this an impractical solutions outside of demos). The reason why an indexer is required in MUD is that everything is stores in tables, which are essentially mapping of keys to structures. Without storing the list of keys on the blockchain, it is impossible to know the extent of a table. There is talk about enabling a mode where keys are stored, and maybe this is can even be implemented independently as a "MUD module" (although the synchronization part on the frontend will require more invasive changes).

I'm torn on the issue. Besides the missing features outlined above, using a framework means less low-level control, and I feel like we have already figured out a bunch of the difficulties that MUD is supposed to alleviate. On the other hand, it means we get to benefit from all the new MUD features for free.

A simple way to figure it out would be to try and do a rewrite (maybe limiting ourselves to the tech demo features) to figure out how we feel about this in practice, and where the practical pain points end up being.

norswap commented 1 year ago

Here's what's next for MUD: https://twitter.com/latticexyz/status/1675840828621705216

They don't mention custom sync, but the sync stack refactor seems to be a positive step in that direction.