@Override
	protected void writeEventStream(GameEvent g, OutputStream outputStream)
			throws IOException {
		ERGameEvent e = (ERGameEvent)g;
		ObjectOutputStream oos = new ObjectOutputStream(outputStream);
		
		oos.writeInt(e.eventType);
		
		switch(e.eventType){
			case (ERGameEvent.EVENT_MESSAGE_C):
				oos.writeUTF((String)(e.data[0]));
				break;
			case (ERGameEvent.EVENT_MESSAGE):
				oos.writeUTF((String)(e.data[0]));
				oos.writeUTF((String)(e.data[1]));
				break;
			case (ERGameEvent.EVENT_UPDATE_C):
				oos.writeFloat((Float)(e.data[0]));//new destination x
				oos.writeFloat((Float)(e.data[1]));//new destination y
				break;
			case (ERGameEvent.EVENT_UPDATE):
				oos.writeInt((Integer)(e.data[0]));//id
				oos.writeFloat((Float)(e.data[1]));//x
				oos.writeFloat((Float)(e.data[2]));//y
				oos.writeFloat((Float)(e.data[3]));//destination x
				oos.writeFloat((Float)(e.data[4]));//destination y
				break;
			case (ERGameEvent.EVENT_DESTROY):
				oos.writeInt((Integer)(e.data[0]));//id
				break;
			case (ERGameEvent.EVENT_INTERACT_C):
				oos.writeInt((Integer)(e.data[0]));//id of target of interaction
				break;
			case (ERGameEvent.EVENT_INTERACT):
				oos.writeInt((Integer)(e.data[0]));//id of source of interaction
				oos.writeInt((Integer)(e.data[1]));//id of target of interaction
				break;
			default:
				break;
		}
		oos.flush();
	}