I decided on a packet-based system for NetBLAM's communication, similar to that used in Minecraft. The code I use to deserialize the different Packet subclasses is a little weird. Basically, I have an array that maps numbers to classes. Then, once I have the ID of a text than represents some type of Packet, I do this on it:
Packet.PacketClass(PACKET ID).GetMethod("FromText", _
Reflection.BindingFlags.Static).Invoke(Nothing, {SERIALIZED TEXT})
Since the FromText function is static, I don't need to have an instance of the class with which to invoke the method. To be honest, this code has never run, so I'm not actually sure if it works. It should, though.
After defining some packets today, I created the client interface's start-up screen. (I would put up a screenshot if I had finished making it look nice.) It can create an integrated server and it has all the controls necessary to connect to a server, though I might eventually figure out how to implement a server list. The packets so far will be used in the initial "handshake" to determine player and server information.
No comments:
Post a Comment