-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Use a dedicated type for client ID #41
Comments
I would suggest to use |
@lucaspoffo I started on something here. This is my implementation, so far. What do you think of it? #[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
pub struct NetworkId(pub u64);
impl From<u64> for NetworkId {
fn from(value: u64) -> Self {
Self(value)
}
}
impl Deref for NetworkId {
type Target = u64;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl Display for NetworkId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
} Also, where do you think would be a good spot for this to live? |
I wonder when you say |
I map entities to entities directly using built-in
I'm not sure... I like the explicitness of the name, but it's a bit too long. I suggested |
Pretty interesting, i will look into this, thank you!
I mean you could like with NetworkId -> NetId name it like ConnectionId -> ConnId, but generally shouldn't the name length not really matter, as long as it make sense and the use is descriptive for everybody, before you shorten names. Ah okay i come from Unity, so thats why i was not aware of Godot naming here. In Unity you usally has |
I agree with you. Maybe go with |
I would support that name ( |
@roboteng what do you think about this name? |
I get that |
@roboteng we thinking about |
It would be great to wrap client ID (currently
u64
) into a newtype. This will improve code readability and eliminate possible mistakes by using it in wrong place.Something like
Entity
in Bevy.The text was updated successfully, but these errors were encountered: