gemini-capsule

My gemini capsule
git clone git://jb55.com/gemini-capsule
Log | Files | Refs

2021-07-12-protoverse-metaverse-protocol.gmi (6830B)


      1 # protoverse, a metaverse protocol experiment
      2 
      3 Ever since I read the book Ready Player One I've been fascinated by the idea of the metaverse. Imagine instead of joining an IRC chatroom, you joined a virtual room with objects: chairs, tables, robots, other people? A virtual shared space where you could meet up with your friends and hang out. This is typically envisioned as some sort of virtual reality where you meet with people face to face, but the metaverse could be much more general than that.
      4 
      5 I started thinking about, what could a metaverse protocol look like? Is such an ambitious project even possible? How do we avoid the mess that is the web? Could we keep it simple and extensible? I believe I have a pretty good plan on how to achieve this: I'm calling it the protoverse.
      6 
      7 ## Goals
      8 
      9 Before we start thinking about the ingredients needed to build a metaverse protocol, first let's look at some high level goals:
     10 
     11 * Accessible. The metaverse shouldn't exclude those who are blind. This was one of the goals of the original web and we should strive to have an accessibility plan.
     12 
     13 * Simple. We should learn from the web and not force client vendors to implement a large number of ad-hoc specifications.
     14 
     15 * Flexible. It should support many different use cases and environments. You should be able to connect to a server and be served a multiplayer game, a room, or whatever experience the server operator wishes.
     16 
     17 * Interconnected. Like the web with hyperlinks, there should be some way to jump from server to server in a standard way.
     18 
     19 ## Enter the protoverse
     20 
     21 The protoverse is the metaverse protocol I'm working on that is trying to achieve all these goals. At a high level, protoverse is a network of abstract virtual spaces. It achieves this with a few key ideas:
     22 
     23 ### Level of detail
     24 
     25 You define a "space" with a high-level description like so:
     26 
     27 ```
     28 (room (shape rectangle)
     29   (material "gold")
     30   (name "Satoshi's Den")
     31   (width 10) (depth 10) (height 100)
     32   (group
     33     (table (id welcome-desk)
     34            (name "welcome desk")
     35            (material "marble")
     36            (width 1) (depth 2) (height 1)
     37            (light (name "desk")))
     38 
     39     (chair (id welcome-desk-chair)
     40            (name "fancy"))
     41 
     42     (light (location ceiling)
     43            (name "ceiling")
     44            (state off)
     45            (shape circle))))
     46 ```
     47 
     48 When you first connect to a server, you pull this high-level description to quickly get an idea of where you are and what types of entities are in the environment. The server could dynamically generate this description or it could be static. This "space" is analogous to html documents. So far so good.
     49 
     50 At this point, if there is a more detailed description of the room, the client could start pulling additional texture and model information via protocol messages.
     51 
     52 Due to this level-of-detail feature, simple text clients can still do something useful here. For instance, if you just want to get an idea of what the room is about without rendering anything, you can use a text-description client:
     53 
     54 
     55 ```
     56 $ ./protoverse serve index.space 
     57 serving protoverse on port 1988...
     58 
     59 $ ./protoverse client proto://localhost
     60 ```
     61 
     62 Output:
     63 
     64 > There is a clean and shiny rectangular room made of solid gold called Satoshi's Den. It contains four objects: a welcome desk table, fancy chair, throne chair and ceiling light.
     65 
     66 As you can see, in this case the client simply parses the high-level description and outputs a description of the room. More advanced clients could render a 2D representation of the room, and even more advanced clients could render full VR-capable experiences.
     67 
     68 ## Programming the protoverse
     69 
     70 To support a wide variety of experiences, we need some concept of computability within the metaverse. This would be the analog of javascript from the web. The protoverse uses WebAssembly (WASM) to enable computation for clients interacting with the metaverse. WASM was originally devised as a generic virtual machine for the web, but it is general enough to use for cases beyond that.
     71 
     72 With WASM you can use any programming language to code the metaverse.  Protoverse comes with an embedded WASM interpreter that can execute WASM code. You will be able to augment clients to render your space in greater detail, show HUD elements, create multiplayer games, etc.
     73 
     74 You can already do a lot without client computation. For instance, your space could be served dynamically, which you could periodically fetch to get an updated description of the room. This would be equivalent to "refresh the page" on the web, except due to the level-of-detail nature of the protoverse, you wouldn't need to refetch the entire room. The client could cache models and other details that have been previously fetched.
     75 
     76 The default, high-level description of the room could include position information, so you will be able to see things that have moved when you "refetch" the state of the room. State updates like this could be a bit jarring, so most likely you wouldn't want to reload the room for position updates, these can be served via "object state/position update" network messages.
     77 
     78 What you do with these network messages could be handled automatically for simple cases by the client, but otherwise could be handled by WASM code served by the protoverse server.
     79 
     80 ## Thin clients
     81 
     82 Thanks to WASM, we can offload much of the rendering to WASM code that chooses how to render its environment. This does affect accessibility, so we need to be careful, but it does have the benefit of avoiding a huge pain point of the web: the massive growth of specifications required to implement web functionality. If we have a very thin client with a small set of rendering APIs (Vulkan? Curses?), then protoverse servers can provide any experience it desires. It could serve full multiplayer video games!
     83 
     84 ## Interconnection
     85 
     86 I still have more to think about with respect to server-to-server communication, but there is some interesting potential here. For now, the protocol only cares about client to server communication, such as updating entity positions, etc. I think it makes sense for there to be a variety of server-to-server protocols for something like the metaverse, I just haven't thought too deeply as to what those could be yet.
     87 
     88 ## Conclusion
     89 
     90 The design space for metaverse protocols is huge. I would love to brainstorm new ideas about how I could improve the protoverse. If you have any ideas feel free to send your thoughts to the protoverse mailing list at:
     91 
     92 => https://lists.sr.ht/~jb55/protoverse-discuss
     93 
     94 Also, patches welcome! I'm currently working on the protoverse WASM interpreter. If you want to help hack on the project feel free to email patches to `jb55@jb55.com`
     95 
     96 => http://git.jb55.com/protoverse
     97 
     98 That's all for now. I plan on posting more protoverse updates here on my gemlog in the future!