cards/readme.md

93 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2024-04-06 18:17:11 -04:00
# Cards For Humanity
2024-04-05 22:38:41 -04:00
2024-12-03 17:55:19 -05:00
Live at [https://humanity.cards](https://humanity.cards)
2024-08-30 01:51:05 -04:00
2024-04-06 18:17:11 -04:00
A game master server for the popular game [Cards Against Humanity](https://www.cardsagainsthumanity.com/) using data from [Chris Hallberg](https://crhallberg.com/)'s project [JSON Against Humanity](https://github.com/crhallberg/json-against-humanity) (everyone say "Thanks, Chris!")
2024-04-05 22:38:41 -04:00
2024-04-06 18:17:11 -04:00
This started as a problem trying to play games with friends who are all on different platforms. This shall be as cross-platform as it gets. I want it to work on anything that can establish a connection and allow anyone to write any front-end they can dream up whether it be a web page, chat bot, VR, etc. Any clients who share a master server can play together across any platform.
2024-04-05 22:38:41 -04:00
2024-07-20 23:00:19 -04:00
## Test/Dev:
### Server
2024-08-05 00:08:29 -04:00
2024-07-20 23:00:19 -04:00
With auto-reload:
2024-08-05 00:08:29 -04:00
- [Install cargo-watch](https://github.com/watchexec/cargo-watch?tab=readme-ov-file#install)
2024-07-20 23:10:22 -04:00
2024-07-20 23:41:20 -04:00
Then:
2024-07-20 23:40:07 -04:00
2024-07-20 23:10:22 -04:00
```sh
2024-10-08 21:59:48 -04:00
./test
2024-07-20 23:07:05 -04:00
```
2024-07-20 23:00:19 -04:00
Without auto-reload:
2024-08-05 00:08:29 -04:00
2024-07-20 23:40:07 -04:00
```sh
2024-10-08 21:59:48 -04:00
cargo run -p server
2024-07-20 23:40:07 -04:00
```
2024-04-13 21:04:42 -04:00
2024-10-09 20:41:04 -04:00
Use `-b <ADDR>` or `--bind <ADDR>` to bind the server to a specific address. Default is 127.0.0.1:3030. You can also pass arguments to the test script.
2024-07-18 19:53:28 -04:00
### Client
2024-08-05 00:08:29 -04:00
- [Install Trunk](https://trunkrs.dev/#install)
2024-07-20 23:40:07 -04:00
2024-07-20 23:41:20 -04:00
Then:
2024-07-20 23:40:07 -04:00
```sh
trunk serve --open
```
2024-07-20 23:00:19 -04:00
## Build:
### Client
2024-08-05 00:08:29 -04:00
2024-07-20 23:40:07 -04:00
```sh
trunk build --release
```
2024-07-18 19:53:28 -04:00
### Server
2024-08-05 00:08:29 -04:00
2024-07-20 23:40:07 -04:00
```sh
2024-08-30 01:51:05 -04:00
cargo build --release
2024-07-20 23:40:07 -04:00
```
2024-07-18 19:53:28 -04:00
2024-08-05 00:08:29 -04:00
---
2024-04-27 02:34:28 -04:00
2024-12-03 17:55:19 -05:00
- The server automatically serves the built client from `/dist` at `127.0.0.1:3030`. When building for release the client automatically points to the live server.
2024-04-13 21:04:42 -04:00
2024-12-03 17:55:19 -05:00
- Configure any custom clients to connect to `ws://127.0.0.1:3030/websocket` for local testing or `wss://humanity.cards/websocket` to use my server.
2024-04-13 21:04:42 -04:00
2024-10-08 21:54:05 -04:00
## Tools:
There is a tool named socket_blaster used for stress testing the server.
Run
2024-10-08 21:59:48 -04:00
2024-10-08 21:54:05 -04:00
```sh
cargo run -p socket_blaster -- -h
```
2024-10-08 21:59:48 -04:00
2024-10-08 21:54:05 -04:00
to see available options.
2024-10-08 21:59:48 -04:00
Then
```sh
cargo run -p socket_blaster -- [COMMAND]
```
to run a command.
2024-04-05 22:38:41 -04:00
## TODO:
2024-08-05 00:08:29 -04:00
- prevent zombie users after browser crash
- figure out proper auth - client's problem?
- use db
- test bincode and probably move away from json
- make typescript sdk
- support card text editing
- prevent import of cards that have been seen already and edited
- handle duplicates
- efficiency
- make demo clients for multiple platforms and screens