server
+client
is written by typescript languageGate
is an entry server (or scheduling server) + login server + cluster management server (simple three-in-one), there is a need to be separated
Backend
Game logic server, like a cost game, one server corresponds to a global game, all connected players are considered to join this game. You can also join the concept of the room
frontend
Game client (including 2 demo), imported to Creator 3.4.2 projects run Creator's Demo
Configure connection information in the configuration file of Gate
and backend
Use TSRPC as a communication frame, so the code generated / synchronous module comes with this framework, resulting in a directory name of each item and a relative path (not familiar with the chaos Result in an error)
PS: The root of each project requires each execution npm i
, frontend
Nery to open once with Creator *
npm install
(can be performed once)Gate
and backend
Directory gf.*.config.json
s (mainly configuring redis and mysql)gate
, run npm run dev
backend
, run npm run dev
Run/SimpleDeploy/run.bat
Notice! Dependence: redis, mysql
Each side directory (GATE, BACKEND) executes npm install
(can be performed once)
Each directory (GATE, BACKEND) executes NPM Run Buildts
, then package the following files:
./deploy
./dist
./node_modules
. / GF.*.config.json (configuration is modified according to the actual situation)
Windows deployment, providing shortcut deployment services, right-click administrator runs deploy/install_runasadmin.cmd
Linux deployment, you can use pm2
start: pm2 start dist/index.js
frontend
directory execution npm install
(can be performed once)frontend
Import Creator, start assets / occupationthewar / occupationscene.scene
)
private
window, or switch to two browsers) *frontend
Directory Perform NPM Run Devue
(If you don't start the browser, manually open the address of the output)
Status data separation, such as classic ECS design, convenient state synchronization, or frame synchronization is used as an intermediate state cache
Input operation separation: convenient access frame synchronization
In fact, as long as it is online game, you need to do the design above, just here to give the design principles proposed in this framework.
Game
, then call thestartgame()
(Default Turn on Function: Frame Synchronization + Random Requirements Client Synchronization Status to the server)afterframes
: chasing the frame message, the client based on the status data + subsequent frames in the messageSyncFrame
: server frame synchronization message, the default 60 frames per second (ie 60 messages per second)Inpframe
: The client's input frame message, it is recommended to collect, the timing is sent (such as 30ms send a batch), will take effect on the next frame received on the serverRequiResyncState
]: [Optional, default open] The server requires the client to collect the game data of this frame, use the syncstate
message to the serversyncstate
]: [Optional, default open] The client will send the game data status, send it to the server, and can quickly restore the game from this status + subsequent frame when followed up.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.