DOTSNET icon indicating copy to clipboard operation
DOTSNET copied to clipboard

Automate message ID in MessageComponents

Open vipvex opened this issue 5 years ago • 2 comments

Would it be possible to automate the creation of IDs for Network messages? My project will eventually have thousands of unique messages. So it's inevitable that the IDs will clash constantly because of human error and oversight.

It would greatly simplify the workflow to now have to manage the IDs and have it be automated.

automate

vipvex avatar Jul 06 '20 16:07 vipvex

I get around this by creating an enum of Game Messages e.g.

Enum GameMessage { ClientUnitTransform = 0x2004 }

Now i can write deterministic code as I know what I'm looking for.

Having them auto generated removes the ability for writing deterministic code as they could end up being different each time.

LemonDevv avatar Jul 09 '20 17:07 LemonDevv

Hey guys. The enum makes sense and I recommend it. The reason why I didn't do this is because you guys can't extend my enum. Automated makes sense too. We did this with Mirror, but this time I didn't want to force it on everyone because debugging message headers is definitely harder. Instead, you can use it if you want to use it. I should probably add an example on how to do that.

miwarnec avatar Jul 23 '20 20:07 miwarnec