| Crates.io | sfn-tpn |
| lib.rs | sfn-tpn |
| version | 1.0.4 |
| created_at | 2025-07-17 19:29:43.752506+00 |
| updated_at | 2025-07-18 00:28:56.423512+00 |
| description | saffron's two-player networking code for turn-based games. |
| homepage | |
| repository | https://github.com/wade-cheng/sfn-tpn |
| max_upload_size | |
| id | 1758001 |
| size | 139,498 |
saffron's two-player networking code for turn-based games.
The changelog is currently the commit log. A proper changelog may be added in the future.
This crate provides a tiny interface for adding multiplayer to casual two-player turn-based games.
"Casual" is important because we connect two players directly and trust the bytes they send. "Hacking" in these games is not an issue because you would simply not accept game invitations from people you do not want to play with.
"Two-player turn-based" specifically means two-player games that have strict turns. That is, each player is allowed to take a turn if and only if it is not the other player's turn, and players alternate turns.
Examples include chess, checkers, Connect 4, (two-player) Blokus, and such. Nonexamples could include games that allow actions on the other player's turn, like activating Trap Cards in Yu-Gi-Oh, though you might be able to define the concept of a turn such that it works with sfn-tpn.
This crate exposes a NetcodeInterface with functionality for
I promise to "do my best" regarding security and not leaking resources, but I do not guarantee everything is perfect. Please feel encouraged to read the source code to make sure any risks or inefficiencies are tolerable for your use case (they are for mine, else I'd have fixed the code). Issues and PRs are appreciated, if you'd like!
Additionally, these features are currently considered out of scope for sfn-tpn: