-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiplayer quickstart #107
base: main
Are you sure you want to change the base?
Conversation
+ AbsPosition_ThreadFree + Start of Multiplayer client & server
…ernions (Compatible with OH2.5.3)
+ Use nuget version of OH in multiplayer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very messy for an example, please tidy it up and follow the prescribed code style.
//vehicle.AbsPosition_Inv = update.abs_position_inv; | ||
i++; | ||
} | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tidy this up a bit.
readonly static int MINOR_VERSION = 0; | ||
public static void ParseMessage(byte[] message, Telepathy.Client client, GameClient gameClient) | ||
{ | ||
message.AsSpan<byte>(0, message.Length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use this lovely span you just made?
{ | ||
internal class GameClient | ||
{ | ||
public Tuple<int, long, long> LastPing; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tuple<int, long, long> LastPing
--> (int xxx, long yyy, long zzz) lastPing
default: | ||
{ | ||
Console.WriteLine($"Data received {message}"); | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be consistent with where you put your break statements.
while (true) | ||
{ | ||
Telepathy.Message msg; | ||
while (client.GetNextMessage(out msg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just realised that the version of Telepathy on NuGet is really out of date (from 2019)...
Latest build is here: https://github.com/MirrorNetworking/Telepathy/actions/runs/10029006044
Anyway, is this a blocking method? If so, why do you thread sleep at the end of this method?
{ | ||
case OMSIMPMessages.Messages.REQUEST_VERSION: | ||
{ | ||
byte[] buff = new byte[12]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this is an avoidable allocation...
No description provided.