Code Monkey home page Code Monkey logo

multiplayer-server's Introduction

Coin chase server

Multiplayer capabilities

UDP로 상태를 갱신 및 전파하며, 패킷 경량화를 위해 protocol buffer를 이용합니다.

유저의 상태는 단순히 메모리에 유지됩니다. 서버가 꺼지면 유저의 정보도 사라집니다. 이렇게 구현한 이유는 게임 로직이 간단하기도 하고, 프로젝트의 목적을 고려하여 설계했습니다. 프로젝트의 목적이란 다수의 유저로부터의 빠른 속도로 상태 수신(상태 변경시 마다) 및 전파(초당 10회. 클라이언트는 이 데이터를 기반으로 주위 유저의 상태를 동기화 합니다)를 서버에서 동시성 문제 없이, 빠른 속도로 처리하는 것입니다.

직접 구현한 워커풀을 사용합니다. 워커는 생성, 활성화, 비활성화, 장애 극복, 연관 자원 회수, 헬스 체크 등의 조치가 취해져 있습니다.

혹시라도 게임 로직을 발전시키고 데이터베이스를 활용하고 싶으신 분들은 batch processing과 같은 Disk IO를 최소화 할 수 있는 방법을 고려하여 설계하시기 바랍니다.

게임 규칙

  1. 로그인 한 유저들은 한 맵에 배치 됩니다(각 유저는 로그인시 사용한 아이디로 구분됩니다).
  2. 유저들의 시야는 2(게임상 그리드)로 제한됩니다. 그래서 자신이 획득해야 하는 자원이 현재 맵에 어디 있는지 알 수 없습니다. 그리드의 총 크기는 20 x 20입니다.
  3. 동전들은 최소 1개 최대 10개가 생성됩니다(대부분의 경우 10개 가까이 생성됩니다).
  4. 동전은 0.5초마다 랜덤위치로 도망갑니다. 유저의 위치로는 도망가지 않습니다(스스로 잡아먹히지 않습니다).
  5. 유저가 동전을 따라잡아 먹으면 동전이 사라지고 1점이 그 유저에게 쌓입니다.
  6. 아이템은 랜덤박스입니다. 시야가 두 배가 되거나, 절반이 됩니다. 아이템은 항상 두 개가 생성됩니다.
  7. 동전과 아이템은 모두 소진시 재생성 됩니다.
  8. 유저의 점수는 좌상단 스코어보드에 표시됩니다.

multiplayer-server's People

Contributors

bjs-kr avatar jsbyeon1 avatar

Watchers

 avatar

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.