Commit graph

89 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
090b8bbd30 Fix crash bug 2022-05-06 11:32:20 +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
b4eaba09c5 Refactorings/Fixes related to emoting 2022-04-29 19:21:59 +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
a4bf4cbd25 Change fn string_from_board to accept board ref 2022-04-29 15:21:22 +09:00
f799bae530 front-end: Minor refactorings fixes 2022-04-29 12:12:01 +09:00
b158e7347e front-end: Minor refactorings 2022-04-29 11:37:15 +09:00
e6152331b0 front-end: minor refactoring 2022-04-29 11:23:03 +09:00
e77d25996d front-end: fix repeated disconnects on close
When the front-end connects to the back-end, it creates a callback that
sends a disconnect message with the received ID on "pagehide" and
"beforeunload" events. The previous implementation did not "undo" these
callbacks when the game was reset and a new ID was received. This fix
prevents the front-end from resending disconnect messages with
previously received IDs on browser window/tab close.
2022-04-29 11:08:54 +09:00
e0ed5fc5d8 back_end: Fix bug where CyanWin is MagentaWin 2022-04-28 22:12:36 +09:00
174875b88b back-end/front-end: Rust clippy fixes/refactorings 2022-04-27 16:51:57 +09:00
3172af19f8 front-end/back-end: Tweaks to game AI 2022-04-27 15:02:53 +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
e060d94186 front-end: Minor fix related to reset button 2022-04-25 15:19:25 +09:00
b26c9ff6d1 front-end: Impl Reset button 2022-04-25 15:02:18 +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
2aa4200835 Fix not "disconnecting" (hopefully on mobile too)
Sometimes the player would not disconnect from the Network Multiplayer
session on the back-end. Seems to work on PC browsers, not so well with
moblie browsers. This commit hopefully fixes this for mobile browsers.
2022-04-08 12:41:20 +09:00
70eb1ca121 Fix not "disconnecting" on refresh (hopefully) 2022-04-08 12:17:15 +09:00
ee8187cabb Fix not "disconnecting" on page close/refresh
Hopefully this works this time.
2022-04-08 12:01:15 +09:00
284f294c6d Fix not "disconnecting" on refresh 2022-04-08 11:55:31 +09:00
392fc5e7f0 Fix whitespace in edited classes, try fix unload
The method to send the disconnect on page close was changed, but it is
still uncertain if it works correctly.
2022-04-08 11:42:18 +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
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
91c9eab05e Fix messages being displayed on networked game end 2022-04-06 20:17:27 +09:00
59bdcc2a34 Tweak "board to string" and back for better info 2022-04-06 20:09:22 +09:00
2e0b29ed70 Add "release" configuration for BACKEND_URL 2022-04-06 19:40:40 +09:00
567cec9500 Minor tweaks (and cargo fmt got aggressive) 2022-04-06 19:38:59 +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
83a9ab2ea0 frontend: WIP! in progress setting up id request 2022-04-04 18:25:17 +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
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
e4d4d6e153 Move enum from yew_components mod to state mod
Preparation for symlinking shared code into the backend project.
2022-03-29 14:41:04 +09:00
839e9021fa Refactor: Replace calling JS settimeout with Rust
web-sys and js-sys provides ways to use "settimeout" in pure Rust which
is used instead of calling into Javascript to do "settimeout".
2022-03-23 16:56:25 +09:00
d200a2fd7c Rename deferred_helper.js -> async_js_helper.js 2022-03-15 13:46:35 +09:00
ebf0cb5bb8 Impl async delay on AI choice
This commit is also a stepping-stone towards handling http requests
which will require deferred callbacks on Yew Components. By figuring
out how to delay callbacks in this commit, it should be easier to
figure out how to handle http requests that may require a deferred
callback.
2022-03-15 13:16:09 +09:00
8fa4093a0d Setup dependencies for connection to backend WIP 2022-03-14 13:18:11 +09:00
414740b7ce Reorder code to print winning move
Previously, the winning move was not printed at the bottom info_text.
2022-03-10 18:16:30 +09:00
92f91672fa Fix infinite loop bug, refactorings/fixes 2022-03-10 17:01:34 +09:00
38e7772d4f More AI tweaks 2022-03-10 16:44:01 +09:00