项目作者: JayJayDee

项目描述 :
Free uncharted water web game API
高级语言: TypeScript
项目地址: git://github.com/JayJayDee/FreeChartedWater-Server.git
创建时间: 2014-12-06T16:48:54Z
项目社区:https://github.com/JayJayDee/FreeChartedWater-Server

开源协议:

下载


  1. ______ _____ _ _ _ _ _ _
  2. | ___| / __ \ | | | | | | | | | |
  3. | |_ _ __ ___ ___| / \/ |__ __ _ _ __| |_ ___ __| | | | | __ _| |_ ___ _ __
  4. | _| '__/ _ \/ _ \ | | '_ \ / _` | '__| __/ _ \/ _` | |/\| |/ _` | __/ _ \ '__|
  5. | | | | | __/ __/ \__/\ | | | (_| | | | || __/ (_| \ /\ / (_| | || __/ |
  6. \_| |_| \___|\___|\____/_| |_|\__,_|_| \__\___|\__,_|\/ \/ \__,_|\__\___|_|

FreeChartedWater-Server

I’m a big fan of the Koei’s Uncharted Waters series. but as you know, recent series (UW5, UW6) are sucks!

so, I decided to make my own Uncharted Water game, so this is the reason why the name of project is ‘FreeChartedWater’.

Game Concept

The coodinate system

The game is modeling the earth’s surface, but not strictly using the exact coordinate system.

For ease of development, I used a simple two-dimensional planar coordinate system rather than latitude/longitude model.

For example, city: Lisbon’s coordinates can be expressed like followings:

  1. city: { x: 3000, y: 3000, radius: 30 }

Suppose you have a fleet named Raphael. The flagship of this fleet has coordinates and has a discoverable radius.
the fleet can be expressed like followings:

  1. fleet: { x: 2990, y: 2990, discoverable_radius: 30 }

If a collision between two circles is detected, the fleet may assume that it has found the city.

Environments

  • node.js 10.x
  • MariaDB or MySQL
  • Redis (Optional, but recommended, for scaling out the websocket)

Applications

each applications in this repository can be run like followings:

  1. npm run util:pourer # initial data pourer util
  2. npm run webserver # http API server

you can run each application with a development mode.

  1. npm run dev:util:pourer
  2. npm run dev:webserver

applications are same as followings:

  • util:pourer
  • util:sync
  • webserver
  • websocket
  • worker

webserver

a GraphQL server for in-game logics.

command

  1. npm run webserver

configurations

  1. MYSQL_HOST= mysql host
  2. MYSQL_PORT= mysql port
  3. MYSQL_USER= mysql user
  4. MYSQL_PASSWORD= password of user
  5. MYSQL_DATABASE= database name
  6. MYSQL_CONNECTION_LIMIT= number of connection limitation
  7. WEBSERVER_PORT= webserver port

websocket

websocket(socket.io) server for asynchronous events.

command

starts a Websocket(socket.io) server.

  1. npm run websocket

configurations

  1. MYSQL_HOST= mysql host
  2. MYSQL_PORT= mysql port
  3. MYSQL_USER= mysql user
  4. MYSQL_PASSWORD= password of user
  5. MYSQL_DATABASE= database name
  6. MYSQL_CONNECTION_LIMIT= number of connection limitation
  7. WEBSOCKET_PORT= websocket server port
  8. WEBSOCKET_USE_REDIS= (nullable) using redis when set TRUE, default is FALSE
  9. WEBSOCKET_REDIS_HOST= (nullable) redis host
  10. WEBSOCKET_REDIS_PORT= (nullable) redis port

worker

worker for periodical jobs. for example, changing the date in the game, changing inflation rate between cities.. will be executed in worker.

command

starts a Worker.

  1. npm run worker

configurations

  1. MYSQL_HOST= mysql host
  2. MYSQL_PORT= mysql port
  3. MYSQL_USER= mysql user
  4. MYSQL_PASSWORD= password of user
  5. MYSQL_DATABASE= database name
  6. MYSQL_CONNECTION_LIMIT= number of connection limitation
  7. WORKER_PERIOD= e.g) 60 -> worker will run every 60 seconds.

util:sync

synchronizes schemas with given database configuration. it is useful when setting up a new database server.

command

  1. npm run util:sync

configurations

  1. MYSQL_HOST= mysql host
  2. MYSQL_PORT= mysql port
  3. MYSQL_USER= mysql user
  4. MYSQL_PASSWORD= password of user
  5. MYSQL_DATABASE= database name
  6. MYSQL_CONNECTION_LIMIT= number of connection limitation

How to test

TBD

run with docker-compose

TBD