Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vkoskiv/nmc2
Lightweight, high-performance WebSocket server for No Man's Canvas, the pixel drawing game.
https://github.com/vkoskiv/nmc2
c game json-api websocket
Last synced: about 5 hours ago
JSON representation
Lightweight, high-performance WebSocket server for No Man's Canvas, the pixel drawing game.
- Host: GitHub
- URL: https://github.com/vkoskiv/nmc2
- Owner: vkoskiv
- License: mit
- Created: 2022-02-05T03:31:27.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-02T21:40:47.000Z (6 months ago)
- Last Synced: 2024-06-02T22:58:49.559Z (6 months ago)
- Topics: c, game, json-api, websocket
- Language: C
- Homepage: https://pixel.vkoskiv.com
- Size: 462 KB
- Stars: 9
- Watchers: 3
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
~~~
nmc2 - new backend websocket server for No Man's Canvas
Dependencies: sqlite3, uuid, zlib, libbsd, gcc with nested function support
You can try this, but it's linux so you'll probably have to google it anyway:Ubuntu: sudo apt install uuid-dev libsqlite3-dev zlib1g-dev libbsd-dev
Arch: sudo pacman -S sqlite zlibTo build: make -j4
To run: bin/nmc2macOS Caveat:
Change cc -> gcc-11 in Makefile before compilingWeb client can be found here: https://github.com/EliasHaaralahti/No-Mans-Canvas-Client
The original Swift 3.1 + Vapor 2 implementation is here:
https://github.com/vkoskiv/NoMansCanvasYou can find some runtime config options in params.json:
* new_db_canvas_size - Edge length of square canvas when generating a new one.
* getcanvas_max_rate - Max rate of getCanvas requests
* getcanvas_per_seconds - Per this many seconds^
* setpixel_max_rate - Max rate of postTile request
* setpixel_per_seconds - Per this many seconds^
* max_users_per_ip - Try to limit the amount of users per host to this amount
* canvas_save_interval_sec - Save the canvas to db once every this many seconds
* websocket_ping_interval_sec - Ping active websockets every this many seconds
* admin_uuid - Doesn't have to be an uuid. Just the password to invoke admin commands at runtime (see tools directory)
* listen_url - Address, port for listening
* dbase_file - Name of the database file to use
* colors - Array of colors of format [R, G, B, id]. id has to be unique. Order in array determines which order they show up in the client.You can reload the config file at runtime by sending SIGUSR1 to the running process:
`kill -SIGUSR1 $(pidof nmc2)`You can tell the running server to save a backup of the database under backups/ by sending SIGUSR2.
The script backup_db.sh shows you a nice way to run backups with cron~~~