Author Topic: User Packet ID start  (Read 2920 times)

Scorch

  • Jr. Member
  • **
  • Posts: 55
  • Karma: 2
    • View Profile
User Packet ID start
« on: March 14, 2006, 01:43:50 PM »
Rakkar, I was knowticing that you have several ID_RESERVED_N identifiers in your packet cmd value code,
and in your example video you used ID_RESERVED_9 + your own index to get a valid value. 
What I would like to recomend is you add a ID_USER_ID_START to this enumeration list, and define proper usage of application/user level enumerations to start with this value and allways add.  For example

Code: [Select]
// note this is pseduo code, I havn't tried to compile this //
typdef enum
{
         CMD_PacketStart = ID_USER_ID_START,
         CMD_UpdatePlayer,
         CMD_KillPlayer,
         CMD_AddPlayer,
         etc...,
         CMD_TOTAL_IDS
} APPLICATION_COMMAND_ID;

#if  CMD_TOTAL_IDS > 256
   #error "To many CMD values"
#endif

Then when you add in new PacketID's in your rakknet internal development, you just need to increment up ID_USER_ID_START, and when people re-compile with your new code, they won't end up duplicating command values, and you won't have to risk running out of reserved numbers as much.

Of course, I think you could come up with a better name than "ID_USER_ID_START" ... i'm not very good at comming up with creative variable names.

Just an Idea ... not critical to my project.

Rak'kar

  • Administrator
  • Hero Member
  • *****
  • Posts: 6895
  • Karma: 291
    • View Profile
    • RakNet
Re: User Packet ID start
« Reply #1 on: March 14, 2006, 02:08:51 PM »
Yeah that's a good idea.

wrt

  • Full Member
  • ***
  • Posts: 139
  • Karma: 0
    • View Profile
Re: User Packet ID start
« Reply #2 on: March 14, 2006, 05:10:27 PM »
well, having those numbers would theoretically allow using using different versions of raknet together. I don't know if that would even work in reality, but it's always a good idea to prevent errors before they occur ...

cu wrt