
preface
This site has compiled source code.Seven Star Card Local Card Shaoyang Card Repair Edition
I believe many people have obtained the source code. The source code construction requires a certain programming foundation.
This article briefly talks about the local environment construction process of Seven Star source code. The local environment built can be used for debugging during the second opening to find errors and exceptions faster.
1. Tools
Since the source code is developed by js, we use the webstorm development tool.
2. Environmental preparation
1. node js environment installation
Install node js environment locally,Download the Node.js version for your system:
After the installation is complete, check whether the installation was successful.
Install pomelo
After installation, we import the code
This is my directory. Everyone chooses your own background directory to import it. My directory contains all the background, including some test code, management background, scheduled tasks, and all kinds of miscellaneous things.
2. Add startup item
Add node js startup entry. As shown in the picture:
Click on this configuration. I have already configured this one.
As shown in the figure above, first click the + sign to create a new Node.js.
Select the server-side project directory. The server-side project directory here is game-server, and the pomelo project has this name by default.
Select app.js in the home directory to start js. Add a startup parameter, which is used in the code. Linux systems use environment variables. We need to add them ourselves for debugging here. The environment to start based on this parameter is different.
3. code configuration item
First of all, the database needs to be installed, mysql. I won't say much here. You can install one on your Cloud Virtual Machine or install one locally. Import sql data from the source code. This is not much.
Code database configuration. (The config directory here is the configuration directory of each env. We started the Shaoyang for parameter configuration before, so the files in the Shaoyang directory will be loaded here)
Configure mysql.js as shown
I didn't cut it all, so you can see for yourself. There should be branch libraries here, and we can configure the same ones. Fill in the corresponding information in your database here.
Then redis configured that I used the default port 6379. If there is no password, I can install a redis to start it. The configuration file is the reddis.js file configuration in the same directory.
Server IP configuration
Configure your own IP and port in the server.js configuration in the same directory.
Next is the configuration of the game server, as shown in the figure
Configure master.json server.json This is the configuration file for the pomelo framework. It can be convenient to configure multiple server nodes and expand the server. We only need to configure one for testing
master.json
This also needs to correspond to the env configuration. Our env parameter configuration is Shaoyang and the first one will be launched here.
server.json
The various servers configured here include connection servers, login servers for players, relatives and friends circles, major leagues, and room servers. Configure the startup ip and port. Similarly, the Shaoyang beginning with json should correspond to env.
The configuration has been completed here. The next step is to activate.
Start complete..
warm reminder
Due to the large number of versions, some of them may have bugs and need to fix some errors yourself.
There is no guarantee that everyone will start successfully.
Comments0