Commit graph

50 commits

Author SHA1 Message Date
72b63aeee1 Impl being able to debug locally
CORS (Cross-Origin Resource Sharing) prevented the application's
networked (multiplayer) support from working locally. The
debug_local_testing branch has changes to allow running the game
locally. The backend must be run with `cargo run --release` or `cargo
run`, and the frontend must be run with `trunk serve`, and the
browser(s) must open `http://localhost:8080/`.
2024-04-03 11:05:19 +09:00
2d7c8c37e5 Maintenance update
`cargo update` to update Cargo.lock for backend and frontend Rust
projects.
2024-04-03 11:04:52 +09:00
59b2bc34fb back-end: Do refactorings 2022-05-05 12:35:30 +09:00
1872c4877e Fix bug: board not updated on win/lose/draw 2022-05-04 14:55:01 +09:00
f4f3ad7a5b Refactorings, fix bug where board doesn't update
Also silence warnings related to unused code since the front-end and
back-end share some code.
2022-05-03 13:18:07 +09:00
b2ea79a7f7 Impl conditionally update front-end board
When the front-end polls the back-end for the game-state, the back-end includes
a "date_updated" String in the JSON. If the String is the same as in the
front-end, then no updates are needed, but if they are not the same, then the
front-end will update the board. Because the front-end polls the back-end's
board state approximately every second, this should make the front-end more
efficient.
2022-04-30 16:44:48 +09:00
105cd880f2 Impl sending/receiving emotes 2022-04-29 18:30:41 +09:00
36dd43bb70 Fixes related to new send emote functionality 2022-04-29 17:24:42 +09:00
5381578b08 Update specs, impl back-end support for send emote 2022-04-29 17:16:32 +09:00
a4bf4cbd25 Change fn string_from_board to accept board ref 2022-04-29 15:21:22 +09:00
174875b88b back-end/front-end: Rust clippy fixes/refactorings 2022-04-27 16:51:57 +09:00
dcc9400483 back-end: Minor fix related to phrase handling
Fixes passing an empty string to the db in (probably) rare cases.
2022-04-27 14:16:34 +09:00
665dff94fe back-end: Enforce max-length of user-input phrase 2022-04-27 14:11:02 +09:00
059d0608b6 Impl match players via phrase
Front-end now has option to input phrase on game start.
Fixed back-end accepting empty strings (will treat empty strings as if
no phrase was given).
2022-04-27 12:47:45 +09:00
f9338d4093 back-end: Impl "phrase", update protocol 2022-04-27 11:42:28 +09:00
87d93e5b4f back_end: Update back-end for new "phrase" column 2022-04-27 11:15:53 +09:00
501ce91ac3 back_end refactorings
Have back_end cleanup stale players/games on an interval, not every
iteration of its loop.

Replace usage of recursion in db_handler.rs .
2022-04-20 14:14:03 +09:00
c9ba80e6a4 Impl "too_many_players" response from back-end
Previous implementation did not respond with the proper JSON response if
there were too many players.
2022-04-08 11:01:33 +09:00
23d9b5647e Fix bug: backend didn't cleanup stale players 2022-04-07 11:16:50 +09:00
74ca3fd696 Add GPL3 Licence headers to sources 2022-04-06 20:49:54 +09:00
62431f0d0e Update README.md for backend and frontend 2022-04-06 20:38:49 +09:00
50221a0356 Add Licenses for frontend and backend (GPL3) 2022-04-06 20:34:45 +09:00
89b9bf860b Working multiplayer between frontend backend
WIP Need to set the URL and host the backend on the website.
2022-04-06 18:43:17 +09:00
8c84aae173 605.607 WIP! working get-id and disconnect
The frontend "server" and backend server must be served via the same
port/address. This can be done by using nginx as the server, and using
reverse-proxies from nginx to the frontend and backend servers.
2022-04-06 13:39:12 +09:00
8712d4cd8b frontend: WIP! request id in progress
Frontend is able to successfully send a Request, but is failing to
get/parse the Response.
2022-04-05 18:16:04 +09:00
2a7a961c9c Minor refactorings 2022-04-01 20:04:40 +09:00
c8eb6ab5be Impl turn timeouts, db entry timeouts
AI takes a players turn if they take too long on their turn (currently
set to 25 seconds).
Backend times out player/game entries in database.
2022-04-01 19:52:46 +09:00
d851d90640 Refactorings, split lengthy code into separate fn 2022-04-01 17:37:37 +09:00
0d9e35dd28 Refactorings and bug fixes
Protocol was also updated to match the output from the backend.
Fixed "id" not returning as an integer from the backend.
2022-04-01 17:17:42 +09:00
8782a731bc Move some backend fns to the shared "state.rs" 2022-03-31 21:02:52 +09:00
dbb1c3ad35 backend: Impl "place_token" protocol
Some edge-cases might not be addressed.

Need to impl. "timers" for clearing out stale entries in the database.
2022-03-31 20:38:22 +09:00
473e76a1bc Impl disconnect protocol (and related changes)
Players can now make a "disconnect" request, and requests for
"game_state" will respond once that an opponent has disconnected before
removing the game from the DB.
2022-03-31 17:38:03 +09:00
fbf47027ef backend: refactorings, impl "board_state" query
Implemented the fifth backend protocol request/response ("board_state").
Some refactorings involve improving readability from handling unwrapping Option
of &Connection objects.
2022-03-30 20:44:18 +09:00
8706f8a90d Add note for debugging the backend
Just in case I lose my terminal history, I'm saving a curl command used
to test the backend.
2022-03-29 17:30:26 +09:00
c5b9156df3 backend: Some refactoring
Reuse "check if player exists" fn where needed. Also, the same fn was
refactored to handle using an existing DB Connection.
2022-03-29 17:10:12 +09:00
fe56adf562 backend: Impl second backend protocol query 2022-03-29 17:02:57 +09:00
545b5a3a1b backend: Move fn init_conn into handler struct 2022-03-29 15:05:23 +09:00
40b2333767 Refactor db_handler to use struct to split up code
Also refactored the GetID send value type.
2022-03-29 15:03:08 +09:00
ec7f664c81 Symlink/adapt shared code from frontend to backend 2022-03-29 14:45:49 +09:00
e7c3670498 backend: Update db_handler's db spec. 2022-03-28 17:13:32 +09:00
a1668aa0b6 backend: Remove "games.date_changed" from db spec. 2022-03-28 17:12:01 +09:00
760a6bda4f backend: Add "date_added" column to db spec. 2022-03-28 17:10:49 +09:00
fcd20af9bd backend: Use enum to handle multiple db requests 2022-03-28 16:31:53 +09:00
6c47ce948b Impl graceful shutdown of backend on failure 2022-03-18 23:43:15 +09:00
5a0c0696d1 Impl enough backend to assign ids to players 2022-03-18 19:29:38 +09:00
2cedc0804f Refactoring/cleanup of backend 2022-03-16 13:10:21 +09:00
b9921e6f47 Have backend always return JSON String 2022-03-16 13:09:07 +09:00
97ca4adecc Refactorings/fixes for back-end 2022-03-16 12:31:18 +09:00
7c4d38549f Update backend protocol, skeleton backend project 2022-03-16 12:26:18 +09:00
3d61c0d626 Back-end skeleton project, backend protocol spec 2022-03-14 14:33:51 +09:00