I’ve always been kind of curious on how I should go upon handling new features specific to new revisions in my server. How I’m handling it now is simply having it separate from my actual event system and just having the handler-script executed by the low-level revision-specific decoder. As in:
[quote=“frank_, post:4, topic:371897”]i thought you were trolling, now i realise you are actually handicapped[/quote]how the fuck does a question on a best approach depict that in any way
I would suggest looking up the Command Pattern, it tends to adapt well in these situations.
With a little bit of magic you could have a server supporting multiple client types (i.e. 317 & 503 players at once).
EDIT:
Here is some starting code. (I didn’t finish what I was doing with the design because I got bored… and I’m pretty drunk right now so… sorry if its crap)
public
Rev317ClanChatPacket (IPacketClient sender, byte[] data)
{
p_sender = sender;
//decode data here... store in dictionary
}
public object
GetPacketData (String dataKey)
{
//return data...
}
IPacketClient
GetPacketClient ()
{
return p_sender;
}
int
GetPacketId ()
{
return 123;
}
private IPacketClient p_sender;
}
class Rev317PacketDecoder implements IPacketDecoder
{
private
Rev317PacketDecoder ()
{
//Use some sort of dictionary… HashTable may not be best
p_packetDictionary = new HashTable ();
[quote=“meiscooldude, post:11, topic:371897”]Adapter and the Command Pattern[/quote]do you not realize that the command pattern is not at all what i was looking for? i already have my multi-revision design setup, i just wanted a better method then: