pont:基于Qwirkle的在线小游戏

网友投稿 663 2022-11-05 12:01:32

pont:基于Qwirkle的在线小游戏

About

Project homepage

pont is an online game based on Qwirkle (by Mindware Games)

Notably, both the client and server are written in Rust; the only Javascript is a shim to load the WebAssembly module.

Hosting

It's easiest to run the whole application on a single VM, using NGINX to both serve static content and to act as a secure proxy for websocket communication. The latter means we don't need SSL support in the game server itself.

The system looks something like this:

I'm hosting a copy of the game at https://pont.mattkeeter.com, using a $5/month droplet from Digital Ocean and Dreamhost for domain registration.

Initial setup

sudo apt updatesudo apt install build-essentials libssl-dev pkg-configcurl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

Installing NGINX and setting up Let's Encrypt

sudo apt install nginxsudo apt-get install software-properties-commonsudo add-apt-repository universesudo add-apt-repository ppa:certbot/certbotsudo apt-get updatesudo apt-get install certbot python3-certbot-nginxsudo certbot --nginx

(read and follow certbot's instructions)

Turn on a firewall to improve security

sudo ufw allow sshsudo ufw allow httpsudo ufw allow httpssudo ufw allow 8081sudo ufw enable

Building the client webassembly file

git clone https://github.com/mkeeter/pont.gitcd pont/pont-clientwasm-pack build --target web

Deploy the nginx config

sudo cp pont.conf /etc/nginx/sites-enabled/pont.confsudo rm /etc/nginx/sites-enabled/defaultsudo nginx -s reload

This won't work out of the box, because the configuration assumes the url is pont.mattkeeter.com, which won't be true for you; edit it accordingly.

Running the server

cd pont/pont-servercargo run --release

(leave this in a screen session for easy persistence!)

License

© 2020 Matthew Keeter

Licensed under either of

Apache License, Version 2.0 (LICENSE-APACHE or http://apache.org/licenses/LICENSE-2.0)MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Vue2.0作的音乐播放小例子
下一篇:线性表环形单链表的约瑟夫问题如何实现实现
相关文章