[IPhone-Games] common data organization and analysis in games

Source: Internet
Author: User

1. xml

The longest way to use, this standard is also very good. Needless to say.

  < Protocol >
< Move >
  < From >
< Point > 0, 0
< Point />
</ From >
< To >
< Point > 30,30
</ Point >
</ To >
</ Mvoe >
< Attack >
....
....
....
</ Attack >
</ Protocol >

 

 

 

2. JSON

[{0}/* from */, {30, 30}/* to */}/* move */, {0, 0}/* from */{30, 30}/* to */}/* attack */]

Of course, the above JSON is not a good definition method, not very object-oriented, but it is still a feasible and resolvable method. Careful friends can carefully study the differences with XML.

 

3. Binary

FFFF (length) 0001 (MOVE) 00000000 (from: x = 0) 00000000 (from Y = 0) 00011110 (to X = 30) 00011110 to (y = 30) 0010 (attack) 00000000 (00000000 00000000 00000000 0010 zookeeper

 

The Protocol definition is so simple that it is actually more complex and complete.

Start with the several-byte Definition

The type of the first protocol uses 4 bits, such as 0001 move, 0010 attack

    • Move from X, a byte,
    • From y of the move Protocol, one byte,
    • X of the move protocol to, one byte,
    • Y of the move Protocol, one byte.
    • Next is the second protocol. 0010, attack

The preceding three methods are commonly used to define data structures.

Resolution and analysis follow up later...

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.