The multi-server communication framework written in Java is basically formed. In order to provide multi-language support for the Framework, it can support communication with clients developed in multiple languages. Currently, Flash, Java, C language. Google protocol buffer is used for comprehensive consideration. Previously, protobuf was used in game server development projects. It seems that it is a little less functional than ice, but because it is a Google company, there are more people using it than ice.
1. Download
Protobuf
Address: http://code.google.com/p/protobuf/downloads/list
Refer supports C, Java, and python. protobuf-2.4.0a.zip is used here for selecting the support for as3.
As3
There are many protobuf library projects that support as3 on the network, but it is not ideal if you have selected a few projects.Protoc-gen-as3, and want to rewrite an impulse, but unfortunately no time.
Address: http://code.google.com/p/protoc-gen-as3/downloads/list
The latest development package contains the Java package 2.4.0a. Therefore, this version of protobuf is also selected.
2. Deployment
For ease of operation, I put these libraries in a project and run them using BAT. The specific project structure is as follows:
Click Run. BAT to generate a JavaCodeYou only need to introduce this project to the developed project.
After reading this, do you know what I want to do next?
Currently, a problem occurs: protobuf has no inheritance relationships and cannot express the inheritance relationships such as command and clientcommand in my original Java code. At present, although it can be implemented, the method is still not elegant, you need to be more familiar with protobuf in the future, or wait for protobuf to add support for the inheritance relationship before making improvements.