New features

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:

....revision decoder.....
//packet 123 (suppose it's clan chat)
ClanChatDick dick = ..parse nigger shit..
invokeNiggerScript("ClanChatHandlerShit", dick)

Thoughts on best approach?

edit: also, best thoughts on how to handle crap that has changed over revisions like added interfaces in player trading and such

lol

[quote=“blakeman8192, post:2, topic:371897”]lol[/quote]problem?

i thought you were trolling, now i realise you are actually handicapped

[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 guess protocol/content adapter interface and implementations

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)

[code=java]interface IRawPacket
{
IPacketClient
GetPacketClient ();

int
GetPacketId ();

}

interface IPacket implements IRawPacket
{
//IDK how generics work in Java… =/
object
GetPacketData (String dataKey);
}

interface IPacketDecoder
{
IPacketHandler Parse(IPacket packet);
}

class Rev317ClanChatPacket implements IPacket
{

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 ();

	//define packets
	p_packetDictionary.put (Integer(123), Rev317ClanChatPacketConstructor); //ref to Rev317ClanChatPacket's Constructor.
}

IPacket
Parse (IPacketClient sender, int packetId, byte[] data)
{
	if (!p_packetDictionary.containsKey(Integer(packetId)))
		throw Exception();
	
	return p_packetDictionary.get (Integer(packetId)).createInstance(sender, data);
}

private Dictionary  p_packetDictionary;

}

[/code]

That’s actually not what I was asking at all. But anyways, my main doubt right now is this:

adapter pattern

[quote=“blakeman8192, post:9, topic:371897”]adapter pattern[/quote]I hadn’t seen your previous post, but that’s a great suggestion, thanks

Adapter and the Command Pattern

[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: