[Fun open source project] Deploying adarkroom text style adventure game on Linux system

1. Introduction to adarkroom mini-game

1.1 Introduction to adarkroom mini-game

"Adarkroom" is a text-style adventure game. Players need to survive and explore in a dark room, and improve their survival ability by making tools, building buildings and collecting resources. The game has a simple screen, but the gameplay is in-depth, requiring players to patiently explore and explore. The game gradually upgrades, including building more advanced buildings, recruiting more residents, exploring wider maps, etc., providing a rich gaming experience. The difficulty of the game gradually increases, requiring players to explore and respond to various challenges and improve their wisdom and skills. Overall, this is a very interesting text adventure game suitable for players who like exploration and challenges.

1.2 Project address

Github address: https://github.com/doublespeakgames/adarkroom

Insert image description here

2. Introduction to this practice

2.1 Local environment planning

This practice is a personal test environment, and the operating system version is centos7.6.

hostname IP address Operating system version Kernel version
jeven 192.168.3.166 centos 7.6 3.10.0-957.el7.x86_64

2.2 Introduction to this practice

1. This practice environment is a personal testing environment, please be cautious in the production environment;
2. Deploy adarkroom text-style adventure mini-game in centos7.6 environment.

3. Install httpd software

3.1 Check the yum repository

If there is no mirror source, you can use Alibaba Cloud's mirror source.

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo

Check the status of the yum warehouse to ensure that each mirror source is normal.

[root@jeven ~]# yum repolist enabled
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * epel: mirrors.bestthaihost.com
repo id                                                                       repo name                                                                                  status
!base/7/x86_64                                                                CentOS-7 - Base - mirrors.aliyun.com                                                       10,072
!epel/x86_64                                                                  Extra Packages for Enterprise Linux 7 - x86_64                                             13,767
!extras/7/x86_64                                                              CentOS-7 - Extras - mirrors.aliyun.com                                                        518
!mongodb-org                                                                  MongoDB Repository                                                                            342
!mysql-connectors-community/x86_64                                            MySQL Connectors Community                                                                    227
!mysql-tools-community/x86_64                                                 MySQL Tools Community                                                                         100
!mysql57-community/x86_64                                                     MySQL 5.7 Community Server                                                                    678
!updates/7/x86_64                                                             CentOS-7 - Updates - mirrors.aliyun.com                                                     5,176
repolist: 30,880

3.2 Install httpd software

Use yum directly to install the httpd software.

yum -y install  httpd

Insert image description here

3.3 Start httpd service

Start the httpd service and enable it to start automatically at boot.

systemctl start httpd && systemctl enable  httpd

3.4 View httpd service

Check the httpd service status to ensure that the httpd service is normal.

[root@jeven html]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Sat 2023-11-04 11:58:30 CST; 1 weeks 0 days ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 48980 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
 Main PID: 37556 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
    Tasks: 11
   Memory: 4.2M
   CGroup: /system.slice/httpd.service
           ├─37556 /usr/sbin/httpd -DFOREGROUND
           ├─48996 /usr/sbin/httpd -DFOREGROUND
           ├─48997 /usr/sbin/httpd -DFOREGROUND
           ├─48998 /usr/sbin/httpd -DFOREGROUND
           ├─48999 /usr/sbin/httpd -DFOREGROUND
           ├─49000 /usr/sbin/httpd -DFOREGROUND
           ├─55302 /usr/sbin/httpd -DFOREGROUND
           ├─67593 /usr/sbin/httpd -DFOREGROUND
           ├─67594 /usr/sbin/httpd -DFOREGROUND
           ├─67595 /usr/sbin/httpd -DFOREGROUND
           └─67596 /usr/sbin/httpd -DFOREGROUND

Nov 04 11:58:30 jeven systemd[1]: Starting The Apache HTTP Server...
Nov 04 11:58:30 jeven systemd[1]: Started The Apache HTTP Server.
Nov 05 10:22:01 jeven systemd[1]: Reloading The Apache HTTP Server.
Nov 05 10:22:01 jeven systemd[1]: Reloaded The Apache HTTP Server.

3.5 Firewall and selinux settings

  • Set up selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
  • Turn off the firewall. If you want to turn on the firewall, you need to allow port 80.
systemctl stop firewalld && systemctl disable firewalld

3.6 Browser testing web services

Open the browser: http://192.168.3.166 and replace the IP with your own server IP address.

Insert image description here

4. Deploy adarkroom text style adventure mini-game

4.1 Download the mini-game source code

Enter the root directory of the web page

[root@jeven ~]# cd /var/www/html/
[root@jeven html]#

Pull the adarkroom game source code from github

 git clone https://github.com/doublespeakgames/adarkroom.git

Insert image description here

4.2 View the project source code directory

View the project source code directory

[root@jeven html]# tree -L 1 ./adarkroom
./adarkroom
├── audio
├── browserWarning.html
├── contributing.md
├── css
├── dev-server.js
├── doc
├── favicon.ico
├── img
├── index.html
├── lang
├── lib
├── LICENSE.md
├── mobileWarning.html
├── package.json
├── README.md
├── script
├── tools
└── yarn.lock

8 directories, 10 files

4.3 Restart the httpd service

Restart httpd service

systemctl restart httpd

4.4 Access the mini-game web page

Access address: http://server IP address/adarkroom, enter the adarkroom text-style adventure mini-game page in the browser.

Insert image description here

5. Try adarkroom text style adventure mini-game

5.1 Set game language

In the lower right corner of the page, select "language" and set the language to Simplified Chinese.

Insert image description here
Insert image description here

5.2 Turn off/on game sound

In the lower right corner, set sound on/sound off to turn on and off the game sound.

Insert image description here

5.3 Set night mode

Click "Night Mode" in the lower right corner and the background is adjusted to night.

Insert image description here

5.4 Trial the game

Through the page prompts, you can try out the adarkroom text-style adventure mini-game.

Insert image description here

Guess you like

Origin blog.csdn.net/jks212454/article/details/134351800