Unity + Fishnet crash course problem

Hello all, new member here. I'm trying to follow the guide at https://rivet.gg/learn/unity/tutorials/fishnet/crash-course (Testing locally section for now). I think the steps might be outdated? After running rivet init I only got the yaml file created and the game linked, but no token was provided. I checked the dashboard and found this command: rivet token create dev -n staging, so I created the token that way. However after I put the token in the RivetManager in the Main scene and try the game, I get this error:
POST https://api.staging2.gameinc.io/matchmaker/lobbies/ready ProtocolError: HTTP/1.1 400 Bad Request {"code":"TOKEN_INVALID","message":"Token is invalid: invalid
POST https://api.staging2.gameinc.io/matchmaker/lobbies/ready ProtocolError: HTTP/1.1 400 Bad Request {"code":"TOKEN_INVALID","message":"Token is invalid: invalid
Any clues on what could be wrong? Thanks in advance!
30 Replies
AngelOnFira
AngelOnFiraโ€ข2y ago
Hey! Ya, those docs are out of date. I think I have a mostly-finished version of the new crash course, let me see if I can get that out ASAP
AngelOnFira
AngelOnFiraโ€ข2y ago
For the time being, there are some updated instructions on the plugin GitHub repo, do you want to try following them? https://github.com/rivet-gg/plugin-unity
GitHub
GitHub - rivet-gg/plugin-unity: Plugin for Rivet + Unity
Plugin for Rivet + Unity. Contribute to rivet-gg/plugin-unity development by creating an account on GitHub.
Pelax
PelaxOPโ€ข2y ago
Sure, thanks! I'll give it a try
AngelOnFira
AngelOnFiraโ€ข2y ago
Ping me as you run into issues, I'll make sure you can get up and running ๐Ÿ‘๐Ÿป
Pelax
PelaxOPโ€ข2y ago
will do, thanks!
AngelOnFira
AngelOnFiraโ€ข2y ago
Ok, I do have the code for Unity example, let me see if I can get that merged soon at least
rbest
rbestโ€ข2y ago
Well idk if its related but in diep lately sometimes people gets this message and cant connect
rbest
rbestโ€ข2y ago
No description
AngelOnFira
AngelOnFiraโ€ข2y ago
This doesn't seem related to this thread, feel free to open another thread if you need :ferristhumbsup:
Pelax
PelaxOPโ€ข2y ago
Ok so I downloaded the plugin and imported it, and linked the project with it. I'm a bit unsure what the next step is to be able to test locally. I created a ParrelSync clone and also linked it. I clicked "playtest" and "this machine", but I don't think the server is starting. Maybe I'm missing something else in the scene? I'm using the same example project
Pelax
PelaxOPโ€ข2y ago
This is what the console show when game starts
No description
AngelOnFira
AngelOnFiraโ€ข2y ago
Hmm I'm not sure if I've set up a server running locally in the background yet. That setting will work if you manually host a local server, and when you make a request to Rivet to find a lobby, it will give you a link that points to localhost. I think that if you build and run a server docker container, it should start a local server This is the Dockerfile I have for it:
# MARK: Runner
FROM debian:12
WORKDIR /app

# Install necessary libraries for Unity
RUN apt-get update && apt-get install -y \
ca-certificates \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -ms /bin/bash rivet

# Copy the precompiled Unity server files
COPY builds/LinuxServer/ /app
RUN ls /app && chmod +x /app/LinuxServer.x86_64

# Change to user rivet
USER rivet

ENV UNITY_SERVER=1

# Run the server
ENTRYPOINT ["/app/LinuxServer.x86_64", "-batchmode", "-nographics"]
# MARK: Runner
FROM debian:12
WORKDIR /app

# Install necessary libraries for Unity
RUN apt-get update && apt-get install -y \
ca-certificates \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& useradd -ms /bin/bash rivet

# Copy the precompiled Unity server files
COPY builds/LinuxServer/ /app
RUN ls /app && chmod +x /app/LinuxServer.x86_64

# Change to user rivet
USER rivet

ENV UNITY_SERVER=1

# Run the server
ENTRYPOINT ["/app/LinuxServer.x86_64", "-batchmode", "-nographics"]
But that does rely on a LinuxServer binary being built. That should be doable from the plugin
Pelax
PelaxOPโ€ข2y ago
ok thanks. You mentioned earlier that you might update the example project, is that something planned for the near future? here I mean, unless I misunderstood something
AngelOnFira
AngelOnFiraโ€ข2y ago
Ya, I'm getting some items resolved on the Godot plugin right now, but Unity is next on the list ๐Ÿ’ฏ But I can at least push the branch for now, even if it's not ready to merge One sec
AngelOnFira
AngelOnFiraโ€ข2y ago
Ok @Pelax, there is some stuff like in the image that I have to fix, but you should be able to play around on that branch. It should be able to just run, but lmk if you find any hiccups https://github.com/rivet-gg/examples/pull/26
No description
Pelax
PelaxOPโ€ข2y ago
sounds awesome! Thank you for this!
Pelax
PelaxOPโ€ข2y ago
Ok got 2 more questions whenever you get the chance: 1- I couldn't figure out how to test locally. What would be the docker command to build that image? 2- I used "Build and Deploy" button and that seems to have worked. However when I tried to join from the unity client, I see the lobby and it doesn't get ready most of the time. It shows this:
No description
Pelax
PelaxOPโ€ข2y ago
It does work sometimes, but I'd say it's maybe 10% or less success rate Is that a normal behaviour or is there some setting wrong? The 2 errors I see most times are these:
Failed to find lobby: ProtocolError: HTTP/1.1 500 Internal Server Error {"code":"API_REQUEST_TIMEOUT","message":"Request took too long to complete.","documentation":"https://rivet.gg/docs/general/errors/api/request-timeout"}
Failed to find lobby: ProtocolError: HTTP/1.1 500 Internal Server Error {"code":"API_REQUEST_TIMEOUT","message":"Request took too long to complete.","documentation":"https://rivet.gg/docs/general/errors/api/request-timeout"}
Failed to find lobby: ProtocolError: HTTP/1.1 500 Internal Server Error {"code":"CHIRP_STALE_MESSAGE","message":"Stale message.","documentation":"https://rivet.gg/docs/general/errors/chirp/stale-message"}
Failed to find lobby: ProtocolError: HTTP/1.1 500 Internal Server Error {"code":"CHIRP_STALE_MESSAGE","message":"Stale message.","documentation":"https://rivet.gg/docs/general/errors/chirp/stale-message"}
In any case, feels good to finally see it working at least partially, thanks for the assistance!
AngelOnFira
AngelOnFiraโ€ข2y ago
From in the Rivet hub, what do the logs say? So like if you go to the logs tab on the left, and click the most recent lobby
Pelax
PelaxOPโ€ข2y ago
lol now that I'm trying to get you logs it's joining every single time
AngelOnFira
AngelOnFiraโ€ข2y ago
Something is wrong for sure, but this is on our end. I have this happen sometimes when doing Godot builds, it goes away after some point. For now, it seems erroneous, and isn't super consistant We're debugging it right now, I'll get back to you with updates on it
Pelax
PelaxOPโ€ข2y ago
cool, good to know! Thanks again for your help Hi, hope everything is going well ๐Ÿ™‚. I was wondering if there are any samples using fishnet 4 in the works? @AngelOnFira BTW I've tried to use the latest mirror version, it only required a few adjustments. I can build servers and deploy them, however I'm getting a new generic error when I try to connect:
POST https://api.rivet.gg/matchmaker/lobbies/find ProtocolError: HTTP/1.1 500 Internal Server Error {"code":"ERROR","message":"An internal error has occurred.","ray_id":"af21de8a-582a-40ec-b441-c58ec3bc7fbb","documentation":"https://rivet.gg/docs/general/errors/generic-error"}
POST https://api.rivet.gg/matchmaker/lobbies/find ProtocolError: HTTP/1.1 500 Internal Server Error {"code":"ERROR","message":"An internal error has occurred.","ray_id":"af21de8a-582a-40ec-b441-c58ec3bc7fbb","documentation":"https://rivet.gg/docs/general/errors/generic-error"}
Is that "ray_id" value useful to track the problem? No lobbies get created in the dashboard
AngelOnFira
AngelOnFiraโ€ข2y ago
Hmm, let me take a look at what's being used right now Ah yes, that would be a good item to do. I haven't built any demos with fishnet 4 yet, but we have been thinking about extending the plugin to come with helpers for different networking libraries. That still needing development though. I presume you're looking to use Fishnet 4?
Pelax
PelaxOPโ€ข2y ago
Yes that's the plan in this project. Adapting your sample wasn't hard though, just changed the [SyncVar] to SyncVar<type>. And one handler signature I think. However since no lobbies are showing up in the dashboard I thought maybe it wasn't a fishnet problem? The server built fine after the changes
AngelOnFira
AngelOnFiraโ€ข2y ago
Ah, great to know ๐Ÿ™‚ that shouldn't be hard for me to make a demo with oops meant to reply to that for something else ๐Ÿ˜› Regarding this error, have you seen it pop up today? We just deployed a fix last night that worked on the Godot side This error is interesting. I'll check out the ray on that one Ya, rays are for us to be able to track what functions/sql statements are made internally :ferristhumbsup:
Pelax
PelaxOPโ€ข2y ago
I haven't seen that one, only the new one shows consistently
AngelOnFira
AngelOnFiraโ€ข2y ago
Alright, I'll get back to you once I know more on that ๐Ÿ’ฏ
Pelax
PelaxOPโ€ข2y ago
Some extra info, I tried your example without changes (from the branch you shared the other day https://github.com/rivet-gg/examples/tree/05-30-feat_update_unity_bomber_example) I built and uploaded it, and I got the same error. Ray id was "0f5e3196-1812-47e5-9bc4-4ac9d7ef925b"
AngelOnFira
AngelOnFiraโ€ข2y ago
Sounds good, thanks for that! Can you send me an invite to your team on the Rivet hub? forest@rivet.gg Also, just wanting to check, what's in your rivet.yaml?
AngelOnFira
AngelOnFiraโ€ข2y ago
I think I've reproduced the issue on my end, where I deployed a version with a minimal rivet.yaml, like
engine:
unity: {}
engine:
unity: {}
and although it doesn't throw an error during upload, it needs the matchmaker field to properly do the upload. More information about that file can be found here (https://rivet.gg/docs/general/config#matchmaker), though examples will likely work better for you (say this example https://github.com/rivet-gg/examples/blob/c46ce4d1f6886446edc156913ad7aff9f3d9c341/javascript/tanks-socketio-canvas/rivet.yaml)

Did you find this page helpful?