This repository introduces an intact "multillayer online arena" game, with centralized framesync@30fps(tunable), room management and player session management.
Currently both frontend and backend are aligned to support only 1v1 mode, but the backend is comparatively easy to be configured to support 2v2 ~ 5v5 etc. (tested), while the frontend is not as easy to tune. The sync algorithm is applicable to UDP as well.
The corresponding BotSpawningService can be found here.
We decided to open source this project due to lack of resource to maintain it, therefore new feature proposal, bug report or pull-request might not be handled in time -- and we'll try our best.
The database product to be used for this project is MySQL 5.7.
We use skeema for schematic synchronization under <proj-root>/database/skeema-repo-root/
which intentionally doesn't contain a .skeema
file. Please read this tutorial for more information.
You can use this node module (still under development) instead under Windows10
, other versions of Windows are not yet tested for compatibility.
The following command(s)
### Optional.
user@proj-root/database/skeema-repo-root> cp .skeema.template .skeema
###
user@proj-root/database/skeema-repo-root> skeema diff
is recommended to be used for checking difference from your "live MySQL server" to the latest expected schema tracked in git.
See https://github.com/genxium/Go111ModulePrac for details.
On a product machine, you can install and manage MySQL
server by these scripts.
- It needs
<proj-root>/battle_srv/configs/*
which is generated bycd <proj-root>/battle_srv && cp -r ./configs.template ./configs
and necessary customization.
- It needs
<proj-root>/frontend/assets/plugin_scripts/conf.js
which is generated bycd <proj-root>/frontend/assets/plugin_scripts && cp conf.js.template conf.js
.
Please check "Map.js > forceBigEndianFloatingNumDecoding = true" when building for cc.sys.WECHAT_GAME
and uncheck it for others.
本游戏具备账号系统且主要注册方式为"Phonenum+SMSCaptcha",考虑到开发者和公司内部测试的需要,服务器将提供以下的"ServerEnv"s供在runtime of backend service按需采用。
user@proj-root/battle_srv> make run-prod
将不允许使用“测试账号”。
user@proj-root/battle_srv> make run-test
将允许使用“测试账号”,详见 https://shimo.im/docs/Q7wqNHlvyYQu0nYP 说明。
ErrFatal {"err": "MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error."}
Just restart your redis-server
process.
Please make sure that you've read "https://app.yinxiang.com/shard/s61/nl/13267014/d6b1f7aa-8c6b-4200-b8e4-8b5a21b22fa1" as a prerequisite.
To publish this game to wechatgame
platform, you'll have to first upload it to the platform which requires the whole package to be no larger than 8MB.
A non-tricky way to make package size always uploadable is to
- upload the local
<proj-root>/frontend/build/wechatgame/res/
to wherever specified by magic variablewxDownloader.REMOTE_SERVER_ROOT
in<proj-root>/frontend/build-templates/wechatgame/game.js
(often an additional nginx config file lookup effort is necessary), then - delete the local
<proj-root>/frontend/build/wechatgame/res/
, then - upload the residual package files in "微信开发者工具(downloaded from https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html)".
shell> nslookup bgmoba.lokcol.com
Server: XiaoQiang
Address: 192.168.31.1
Non-authoritative answer:
Name: bgmoba.lokcol.com
Address: 58.87.122.61
# Shows 2 lines before as well as 2 lines after the matching line.
shell> cat ~/.ssh/config | grep -B 2 -A 2 58.87.122.61
Host lokcol-4-ubuntu
Hostname 58.87.122.61
User ubuntu
Host lokcol-4-pomelo
Hostname 58.87.122.61
User pomelo
# The file `/etc/nginx/vhost/bgmoba.lokcol.com` on `58.87.122.61`.
server {
listen 443;
server_name bgmoba.lokcol.com;
root "/var/www/html/bgmoba";
index index.html;
access_log /var/log/nginx/bgmoba-access.log;
error_log /var/log/nginx/bgmoba-err.log;
ssl on;
ssl_certificate /etc/nginx/certs/bgmoba.lokcol.com.fullchain.cer;
ssl_certificate_key /etc/nginx/certs/bgmoba.lokcol.com.key;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 5;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-http
hp application/json application/javascript;
gzip_vary on;
}
, you should
- set
REMOTE_SERVER_ROOT = "https://bgmoba.lokcol.com/static/"
in the build panel
and then upload by the following command(s).
shell> scp -r ./frontend/build/wechatgame/res/* ubuntu@bgmoba.lokcol.com:/var/www/html/bgmoba/static/res/
Please make sure that you've set ignorecase = false
in your [core] section of <proj-root>/.git/config
.