-
Notifications
You must be signed in to change notification settings - Fork 65
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
Tp3 network rewrite #646
base: main
Are you sure you want to change the base?
Tp3 network rewrite #646
Conversation
- network replicators - bigint PeerIndex/NetworkID types - spawn/despawn/update messages
This reverts commit 8417a42.
🚀 Deployed on https://deploy-preview-646--thirdroom.netlify.app |
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.
Looking great so far!
rigVelocity: float_t[3] | ||
} | ||
|
||
struct AvatarXRModeUpdate { |
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.
Can we explain what this struct is used for in this document? Is it an RPC?
const type = schema[key]; | ||
const value = object[key]; | ||
const write = BinaryToWriteFunction[type]; | ||
write(v, value as never); |
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 are you casting to never
here?
import { Codec } from "./Codec"; | ||
|
||
export enum NetworkMessage { | ||
// old |
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.
Can we remove the old messages before we merge?
let b = 0; | ||
|
||
const position = node.position; | ||
changeMask |= writePropIfChanged(v, position, 0) ? 1 << b++ : b++ && 0; |
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.
Can this use your new mutationEncoder
?
@@ -1,28 +1,28 @@ | |||
import { addComponent } from "bitecs"; |
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.
How much of this file do we still need? Can we get rid of it now?
addChild(container, rig); | ||
|
||
quat.fromEuler(rig.quaternion, 0, 180, 0); | ||
const avatarFactory = (ctx: GameContext) => { |
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 looks great! Good proof that using the replicator API internally cleaned some things up.
@@ -77,7 +77,7 @@ export function useWorldLoader(): WorldLoader { | |||
|
|||
registerMatrixNetworkInterface(matrixNetworkInterface); | |||
|
|||
await enterWorld(mainThread, session.userId); | |||
// await enterWorld(mainThread, session.userId, hostId); |
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.
Can we remove this now?
@@ -1,31 +1,23 @@ | |||
// import { describe, it } from "vitest"; | |||
import { ok, strictEqual } from "assert"; |
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.
What happens with these network tests after we've removed the old network messages? Is this no longer needed?
return createBall(ctx, module, physics, 2, emissiveMaterial, ballAudioData, kinematic); | ||
}, | ||
}); | ||
module.replicators = { |
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.
We should come up with a better way of registering replicators on load/enter world for our own internal code.
remaining: