#+title: Growing Community with Spritely Goblins #+date: 2023-02-11 #+author: David Thompson #+email: dave@spritely.institute #+language: en #+REVEAL_THEME: moon #+REVEAL_TITLE_SLIDE:

%t

#+REVEAL_HLEVEL: 1 * Introduction ** Hi! I'm David Thompson, the Core Infrastructure Architect at the Spritely Networked Communities Institute! - I've been a professional software developer for >10 years - I joined Spritely in December 2022 - I want to share my experience as a beginner with Spritely Goblins ** About Spritely Institute #+ATTR_HTML: :width 75% [[./images/spritely-logo.png]] We are a 501(c)(3) nonprofit that is focused on *re-decentralizing* networked communities. ** Founders - Christine Lemmer Webber (FOSS and social networking) - ActivityPub - The Spritely Project - MediaGoblin - Randy Farmer (40+ years working with social platforms) - Electric Communities - Avatars - E - JSON ** What is Goblins? Goblins is a library for building distributed applications! - Peer-to-peer communication (no *gatekeepers*!) - Secure by default (*object capabilities*) - Write local code that *just works* over the network ** Why build new architecture? Goblins opens doors for *new* (and *secure*!) decentralized social experiences that go beyond federated web applications such as interactive virtual worlds! ** Let's talk about games - I think games are a fun, engaging way to demonstrate new ideas - I like to garden - Christine (cofounder) suggested I make a tile-based gardening game to demonstrate my progress with understanding Goblins * Build a game demo with Goblins ** The concept My demo was modeled after a community garden: - Multiple users share the garden space represented as an 8x8 tile grid - Users can plant and dig up tiles, but they must abide by the community rules that state which kinds of plants are allowed ** Limitations - I didn't know how to program with Goblins yet - I only had *2 days* Thus I had to keep things *really simple*! ** The result #+ATTR_HTML: :width 75% [[./images/graphics.png]] ** The actors - *The Garden:* The shared growing space - *The Gardener:* Someone who can modify a garden - *The Botanist:* The resident plant expert that says which plants are allowed to be grown in the garden - *The Garden Gate:* The place where gardeners check-in to get approval before planting something ** Example: The botanist #+BEGIN_SRC scheme (define (^botanist bcom) (define-values (seal-plant unseal-plant approved-plant?) (make-sealer-triplet)) (methods ((approve-plant plant) (seal-plant plant)) ((check-plant plant) (if (approved-plant? plant) (unseal-plant plant) (error "plant is not allowed" plant))))) #+END_SRC ** Example: Spawning a new garden #+BEGIN_SRC scheme ;; Create the garden. (define the-botanist (spawn ^botanist)) (define the-garden-gate (spawn ^garden-gate the-botanist)) (define our-garden (spawn ^garden "Spritely Institute Community Garden" (make-garden-bed 8 8) the-garden-gate)) ;; Sunflowers are allowed. (define sunflower/approved ($ the-botanist 'approve-plant sunflower)) ;; Alice likes to garden. (define alice (spawn ^gardener "Alice" our-garden)) ($ alice 'plant 2 2 sunflower/approved) #+END_SRC ** Text visualization With the essential actors in place, I could edit the garden with code and output the garden state as text. [[./images/text-render.png]] That's not very exciting, so I quickly moved on to adding a graphical renderer that was shown a few slides back! ** Network interaction - The program was split up into a host side and a client side - A Tor Onion service was used as the network transport layer - Messaging remote actors works just like messaging local ones! - This is the first time I've ever made a multiplayer game! ** Multiplayer in action [[./images/multiplayer.png]] ** Example: Sharing a garden #+BEGIN_SRC scheme (define garden (spawn ^garden ...)) (define community (spawn ^garden-community garden)) (define user-name "Bob") (define user ($ community 'register-gardener user-name)) (define onion-netlayer (new-onion-netlayer)) (define mycapn (spawn-mycapn onion-netlayer)) (let ((community-sref ($ mycapn 'register (community host) 'onion))) (format #t "Connect to: ~a\n" (ocapn-id->string community-sref)) #+END_SRC ** Example: Joining a shared garden #+BEGIN_SRC scheme (define community-sref (string->ocapn-id community-address)) (define onion-netlayer (new-onion-netlayer)) (define mycapn (spawn-mycapn onion-netlayer)) (define community (<- mycapn 'enliven community-sref)) (define user-name "Alice") (define user (<- community 'register-gardener user-name)) #+END_SRC ** Audit logging It's good for the host to know what events have occurred in the garden, so I added a log. [[./images/audit-log.png]] ** A notable omission - This demo is auditable, but access to the garden is not revokable should someone abuse their privileges! - This was a limitation of time, not Goblins! - A future version of this demo could easily add the revocation capability ** Extrapolating - A real community garden simulator could have lots of social elements! - Users could visit/host many gardens, each with their own community rules * Conclusion ** Summary - Goblins presents concepts that are new to many of us - However, the basics *can* be learned quickly! - Goblins enables iterative development - Focus on modeling actors first - Networking is easily added after ** Our supporters #+ATTR_HTML: :width 20% [[./images/FFDW-logo.png]] #+ATTR_HTML: :width 20% [[./images/logo_nlnet.png]] #+ATTR_HTML: :width 20% [[./images/mmgdao.svg]] #+ATTR_HTML: :width 20% [[./images/Agoric-logo-color.png]] ** Thank you! For more information, check out: [[https://spritely.institute]] [[https://spritely.institute/goblins/]]