Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Installation guide of lordofpomelo

lwj edited this page Oct 26, 2012 · 26 revisions

Lordofpomelo is a massively multiplayer online role-playing game for pomelo framework and composed of character, mob, equipment, battle, chat, skill, upgrade and task system etc.

It is completed less than two months and has about 6000 lines codes in server and client side respectively. Base on pomelo framework on server side and colorbox framework on client side, lordofpomelo supports 1000 players concurrent access in one scene and shorten the response time to 200 millisecond.

Runing environment

  • operating system: Linux or Mac os
  • database: mysql

Installation

Download source

git clone https://github.com/NetEase/lordofpomelo.git

Install dependencies

cd lordofpomelo && sh npm-install.sh

Create database

location of sql file: './game-server/config/schema/Pomelo.sql'

  • Install mysql database
  • Login database: mysql -uUsername -pPassword
  • Create database: mysql> create database Pomelo
  • Choose database: mysql> use Pomelo
  • Import sql file: mysql> source ./game-server/config/schema/Pomelo.sql

Modify database configuration

The database configuration locate in './game-server/config/mysql.json' which you can modify the parameters.

    {
      "development": 
      {
         "host": "127.0.0.1",
         "port": "3306",
         "database": "Pomelo",
         "user": "root",
         "password": "123456"
      },
      "production":
      {
         "host" : "127.0.0.1",
         "port" : "3306",
         "database" : "Pomelo",
         "user" : "root",
         "password" : "123456"
      }
    }

Run game

Both game-server and web-server should be started, and game-server can be started by command

pomelo start (Installation guide of lordofpomelo)

while web-server is

cd web-server && node app

At last, please visit website of 'http://localhost:3001' or 'http://127.0.0.1:3001' by browser with websocket support. By the way, chrome is recommended.

Solution for some problems

  1. port conflicts

Modify configuration which locates in './game-server/config/server.json':

{
  "development":
    {
      "connector": [
  	{"id": "connector-server-1", "host": "127.0.0.1", "port": 4050, "wsPort":3050},
      ],
      "area": [
	{"id": "area-server-1", "host": "127.0.0.1", "port": 8050, "area": 1},
	{"id": "area-server-2", "host": "127.0.0.1", "port": 8051, "area": 2},
	{"id": "area-server-3", "host": "127.0.0.1", "port": 8052, "area": 3}
      ],
      "status": [
	{"id": "status-server-1", "host": "127.0.0.1", "port": 9050}
      ],
      "chat":[
        {"id":"chat-server-1","host":"127.0.0.1","port":6050}
      ],
      "path": [
	{"id": "path-server-1", "host": "127.0.0.1", "port": 7050}
      ] 
    },
  "production":
    {
      "connector": [
	{"id": "connector-server-1", "host": "192.168.144.136", "port": 4050, "wsPort":3050}
      ],
      "area": [
	{"id": "area-server-1", "host": "192.168.135.46", "port": 8050, "area": 1},
	{"id": "area-server-2", "host": "192.168.135.46", "port": 8051, "area": 2},
	{"id": "area-server-3", "host": "192.168.135.46", "port": 8052, "area": 3}
      ],
      "status": [
	 {"id": "status-server-1", "host": "192.168.127.146", "port": 9050}
      ]
    }
}

This file regulates the servers configuration information, such as serverType, serverId, host, port etc.

Also you can modify configuration of '/web-server/public/js/config/config.js':

BASE_URL: "http://127.0.0.1:3015",
IMAGE_URL: "http://192.168.147.207:81"

BASE_URL is the access of http and you can get static resources by IMAGE_URL.

Details fo configurations

  • ./game-server/config/master.json

The master server configuration information about serverId, host and port etc in both development and production environment. The master which aim is not only to start and shutdown, but also monitor other servers is very important to project.

  • ./game-server/config/servers.json

The configuration information for area, connector and status server in all environments. The connector configuration needs websocket port parameter because of front server.

  • ./game-server/config/mysql.json

The database configuration information. You should modify the configuration parameters after installing lordofpomelo in development environment.

  • ./web-server/public/js/config/config.js

The configuration information for static resources in client and http accessing.

Supplementary for login

Not only you can create a new account, but also use account of github, google, facebook, twitter and Sina Weibo after authorized to access to lordofpomelo. Of course, you should get the authority and modify the configuration parameters locating in './web-server/config/oauth.json'.

Clone this wiki locally