GithubHelp home page GithubHelp logo

joeyhengst / game-architecture Goto Github PK

View Code? Open in Web Editor NEW

This project forked from game-arch/mmo-arch

0.0 1.0 1.0 1.84 MB

Base Architecture for creating scalable games using microservices through Angular, Phaser, NestJS, NATS, and MySQL

Makefile 0.81% TypeScript 90.18% JavaScript 2.64% HTML 5.15% CSS 1.06% Shell 0.16%

game-architecture's Introduction

Game Architecture

As a hobby project, I have been putting together some technologies that may help beginner game developers with constructing multiplayer games.

Technologies Used

The Idea

Using microservices as a way to separate responsibilities of an application helps developers understand how to scale (not just for games). By splitting up each responsibility into its own fully autonomous application, it allows other aspects of the system to go down without affecting said microservice. The only bottle necks of communication at this point becomes the gateways and REST controllers that the end users must connect to.

Global Services

  • Lobby (1+ instances)
    • Entry point for a user to discover world servers
    • Login/Register is exposed here
  • Presence (1 instance should only be needed)
    • World Server Discovery
    • When a world comes online or goes offline, the Presence service will be updated
  • Account (1+ instances)
    • To register, login, and verify a user has access to the system

World Instance Services

  • Item (1+ instances)
    • Handles items that would be accessible to a world and a character's inventory
    • If an item does not exist here, it should not be respected anywhere
    • Items can be associated with a quest once mechanics are built for it
  • Quest (1+ instances)
    • Handles quest requirements and rewards
    • requirements could be of a multitude of requirement types once defined
    • rewards would come in the form of currency, item ID and quantity, or EXP of some kind
  • Chat (1+ instances)
    • Handles any communication end users may want to send to other users
    • (Other services will be created to handle more long-term communication in the future)
  • Character (1+ instances)
    • Handles character-to-account association
    • To create, sign in, get info on, and sign out of characters
  • Commerce (1+ instances)
    • Handles trade interactions
    • Handles marketplace/auction-like interactions
  • Map (1 instance per map)
    • Handles NPC position, movement, and respawn
    • Handles Resource position and respawn
    • Handles movement actions using Phaser Arcade Physics
    • Handles transitions between maps based on a character's movement
    • Handles In-Range checks against other players, resources, NPCs
    • Handles optional quest progress in regions of a map
    • A single instance is used per map.
      • If you need 10 maps, you need 10 instances with different configurations per map
      • This is due to a restriction to headless Phaser and to help keep operations on different threads when possible
  • Server (1+ instances)
    • Handles all traffic from a client Websocket connection
    • Authenticates the socket using a JWT against the Account service
    • Verifies character selections against the Character service
    • Propagates events to responsible services to handle micro-interactions outside of the current thread if possible
    • Handles events sent from services that are intended to report something to the end-user

Current Progress

  • Presence
    • World Presence is handled by the Presence microservice
    • Character Presence is handled by the Character microservice
  • Authentication
    • Register with Email
    • Login with Email
  • World Selection
    • Worlds connected to the appropriate NATS server will auto-register upon running
    • Worlds will be marked offline after the server goes down
  • Characters
    • Character Creation (name and gender)
    • Character Selection
  • Map
    • 1 Map so far
    • Player input (movement directions) are sent to server
    • The server broadcasts the connected users on the map at a given interval (id, name, x, y, movement directions)
    • Velocity is calculated upon an input event and upon receiving the list of players
    • No NPCs at this time (will be implemented on the map server directly, not with another microservice)

game-architecture's People

Contributors

joeyhengst avatar

Watchers

James Cloos avatar

Forkers

ityn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.