Skip to content
/ pastry Public

An experimental DistributedObject client/server architecture

Notifications You must be signed in to change notification settings

pennomi/pastry

Repository files navigation

Pastry is a DistributedObject architecture that makes creating MMO games easy as pie!

Here's some architecture inspiration material:

DistributedObject class:

  • Functions like a Django Model, with metaclass MAGIC
  • Behaves differently depending on if you're an AI, Client, or OTP Server
  • Standard Notifications
    • Created
    • Updated
    • Deleted
    • Other (Kind of like RPC?) (a @distributed decorator on func?)
  • Must have an owner, which defaults to the AI
  • Has a UUID (DoID)
  • Fields:
    • int
    • float
    • str
    • bytes (print in hex)
    • datetime
    • array
  • Field keywords:
    • required
    • ram (force to sync to new connections)
    • db (permanently persist)
    • broadcast (public)
    • clsend (a client has permission to set this)
    • ownsend (only the owner may set this)
    • ai (only the AI may set this)
  • Fields can have:
    • Validators
    • Clean methods

OTP Server:

  • Relays message back and forth. Handles "interest"
  • Components:
    • Message Director (sends messages)
    • State Server (persists objects in memory)
    • DB (non-volatile persistence)
    • Client Agent (?)
  • State Server:
    • Holds a zone graph
    • Each zone has DOs in it
    • For instance, a GRID of zones, where client has interest in adj. zones
    • For instance, a tavern
    • Interest (and zones) are nested. But is this necessary for me?
    • Adding interest sends client "create" on all DOs
    • Upon full sync, send "interest complete". But this is generally not good.
    • Removing interest sends client "delete" on all DOs
  • UberDOG:
    • Game-globals
    • Stateless
    • Things like auth

AI:

  • Privileged Client. Probably subclasses that?
  • Basically IS the game logic
  • Generally has exactly one interest - everything within the zone
  • One AI per zone. Or could there be more? Need at least one.

Client:

  • Normal connection from a user.
  • Must have clock synchronization with server
  • Subscribes to "interests" which are basically zones
  • Unsubscribes when moving away from that zone
  • Disable vs Delete so as to not crash

About

An experimental DistributedObject client/server architecture

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages