Skip to content

Conversation

@amathieson
Copy link
Collaborator

No description provided.

@amathieson amathieson requested a review from space928 September 27, 2024 11:26
 + Use nuget version of OH in multiplayer
Copy link
Owner

@space928 space928 left a 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
Copy link
Owner

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);
Copy link
Owner

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;
Copy link
Owner

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;
Copy link
Owner

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))
Copy link
Owner

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];
Copy link
Owner

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants