KryoNet + obfuscation

Is there a solution to renaming the fields in the packets that are sent?
when I obfuscate i have to disable the obfuscation of the fields, else the server doens’t recognize them.
I would rather have that the clients fields are a,b,c,d etc. and the server keeps their names.
It probably isnt possible

I highly doubt it. The server would not only have to know the unobfuscated names, but the obfuscated ones as well. If you wrote a custom client server with this in mind then you could do this, but…

Why would you want to? If the client code is obfuscated then the server might as well be. I doubt it’s worth the effort to implement this.

The packets do not contain any field names at all, but the default serializer might cause the problems.
You can write a custom serializer, which shouldn’t cause problems with obfuscation since it gets obfuscated too idk.


public class Vector3Serializer extends Serializer<Vector3>{
	@Override
	public Vector3 read(Kryo kryo, Input in, Class<Vector3> vectorClass) {
		return new Vector3(in.readFloat(), in.readFloat(), in.readFloat());
	}
	
	@Override
	public void write(Kryo kryo, Output out, Vector3 vec) {
		out.writeFloat(vec.x);
		out.writeFloat(vec.y);
		out.writeFloat(vec.z);
	}
}

I forgot about making custom serializers, it should be possible with those. I’ll try it when I have time. Gotta focus on gameplay first.

I don’t understand why you want to obfuscate your code in the first point, it’s pretty much useless unless you have a large fanbase that wants to steal your code…?

Cause if someone decompiles the client and changes the minimap to render all players instead of team mates only, it would give him massive advantage.
And it would be easy to write an aimbot or something in it.

I understand your concern, but this is nothing to worry about until you have an actual user base. I don’t think you should just give up and not figure this out, but if it were me I wouldn’t spend more than a couple hours on it until it becomes essential. Worrying about hacking/cheaters can eat up a lot of your development time and isn’t worth it until you actually need it.