This now works and Kawari has achieved basic multiplayer! This is of course with
a hundred caveats:
* Previously spawned players are not backfilled
* There is no range or zone detection
* They are carbuncle clones of you, not the other character's data
But it actually WORKS!
I think the current way I'll accomplish this for now is to use the other
task to send all messages from the global server state back into the
main connection loop.
This is quite the architecture change, and I started working on the
first Tokio actor tutorial I could find. This actually works though,
and you can now chat between two characters on the server.
The next steps are to clean up my mess, and send actors over the wire.
Instead of standalone functions in the common module to perform game data tasks,
there is now a shared GameData struct that these functions moved to. This speeds
up a few things, and can take advantage of Physis' built-in index caching.
I know the current solution isn't ideal (each connection has to mutex lock to
access gamedata) but it's at least better than before.
This is based off existing work in FFXIVClientStructs, but I did make
sure to double-check what these actually did as well. These also can be
a combination of flags, but FFXIVClientStructs doesn't consider it one
yet.
It turns out (amazingly) that this data exists client-side, I guess because the
server and the client share the same planevent LGB file. So instead of
hardcoding the starting location in each city, it's now literally like retail*
* Except for the fact that we don't support rotation yet, and positions in pop
ranges are probably randomized too. But it's close!
There is now a dedicated StatusEffects struct that provides a nicer API
to work with these. The list is also sent when needed and only when a
status effect changes, as the client handles the ticking down of
durations itself.
This is to make it easier to interpolate with other tools and projects,
and to reduce the mental barrier (of me and other contributors) of
changing these. This only ports the Lobby connection to use JSON so far,
the World connection is next.