Register for your free account! | Forgot your password?

Go Back   elitepvpers > Conquer Online 2 > CO2 PServer - Discussions / Questions > CO2 PServer Guides & Releases
You last visited: Today at 15:52

  • Please register to post and access all features, it's quick, easy and FREE!


[6132+] 10005 Walk Packet Protobuff Serialization/Deserialization (the PROPER way)

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2011
Posts: 77
Received Thanks: 127
Post [6132+] 10005 Walk Packet Protobuff Serialization/Deserialization (the PROPER way)

Requirements
  • Download and include in project Protobuff-net
  • Make sure you strip the 4 bytes at the beginning of the packet (Size and Type) and ensure that you remove the packet footer (8 bytes containing the TQServer/ TQClient) before deserializing your packet. And obviously ensure you add the correct packet headers and footers when sending the serialized packets back to the client


[6132] Walk Packet Class Structure
Code:
    [ProtoContract]
    public class Packet_Movement
    {
        [ProtoMember(1)]
        public uint Direction { get; set; }

        [ProtoMember(2)]
        public uint UID { get; set; }

        [ProtoMember(3)]
        public uint Running { get; set; }

        [ProtoMember(4)]
        public uint TimeStamp { get; set; }

        [ProtoMember(5)]
        public uint MapID { get; set; }
    }

Protobuff .Net Deserialization Example
Code:
Serializer.Deserialize<Packet_Movement>(new MemoryStream(Packet));

Protobuff .Net Serialization Example
This also converts it from a MemoryStream into a Byte array
Code:
Packet_Movement PM_Class = new Packet_Movement();
byte[] Packet_Data;
using (var ms = new MemoryStream())
{
    Serializer.Serialize(ms, PM_Class);
    Packet_Data = ms.ToArray();
}



CrystalCastle is offline  
Thanks
6 Users
Old 10/25/2015, 03:40   #2
 
elite*gold: 12
Join Date: Jul 2011
Posts: 7,038
Received Thanks: 3,381
**** you! I was going to write this up before leaving this morning and put it on my wiki. I had an example project and everything. You win this round! *Shakes fist in air* Edit: Put up my version on the wiki anyways. Best to have more than one example / implementation, I suppose.


Spirited is offline  
Old 10/25/2015, 13:56   #3
 
elite*gold: 0
Join Date: Feb 2011
Posts: 77
Received Thanks: 127
Quote:
Originally Posted by Spirited View Post
**** you! I was going to write this up before leaving this morning and put it on my wiki. I had an example project and everything. You win this round! *Shakes fist in air* Edit: Put up my version on the wiki anyways. Best to have more than one example / implementation, I suppose.
Haha. Yeah dude, do as you please
CrystalCastle is offline  
Old 10/26/2015, 10:15   #4
 
elite*gold: 0
Join Date: Jul 2006
Posts: 1,933
Received Thanks: 664
The new intern at TQ HQ must have had fun implementing this in CO.


KraHen is offline  
Thanks
1 User
Old 11/01/2015, 21:48   #5
 
elite*gold: 0
Join Date: Oct 2009
Posts: 762
Received Thanks: 539
You might want to mark Direction and Running as Required fields in their proto attributes. In case they are 0 the serializer will not write them and the client will not use the packet, because the client defined the proto fields are required most likely (not writing them in the packet would result in failure in deserialization).
-impulse- is offline  
Thanks
1 User
Old 01/03/2016, 07:18   #6
 
elite*gold: 0
Join Date: Oct 2010
Posts: 7
Received Thanks: 0
it need array.copy
the final step
modyali2 is offline  
Old 01/03/2016, 17:23   #7
 
elite*gold: 67
Join Date: Aug 2014
Posts: 1,314
Received Thanks: 920
Quote:
Originally Posted by modyali2 View Post
it need array.copy
the final step
Why?
Xio. is offline  
Old 01/21/2016, 07:49   #8
 
elite*gold: 0
Join Date: Aug 2010
Posts: 6
Received Thanks: 0
CrystalCastle,I really appreciate your help very much, You really are a genius
MCJackson is offline  
Old 01/23/2016, 20:20   #9
 
elite*gold: 0
Join Date: Sep 2010
Posts: 242
Received Thanks: 77
[6132+] 10005 Walk Packet Protobuff Serialization/Deserialization (the PROPER...

I thought protobuf also include the proto member index in the encoded data? Wouldn't that cause the client to not be able to read the packet?
tkblackbelt is offline  
Old 01/23/2016, 20:36   #10
 
elite*gold: 12
Join Date: Jul 2011
Posts: 7,038
Received Thanks: 3,381
Quote:
Originally Posted by tkblackbelt View Post
I thought protobuf also include the proto member index in the encoded data? Wouldn't that cause the client to not be able to read the packet?
The header of the packet, which includes the packet length and identifier, doesn't go through Google Protocol Buffers. If you take a look at from my wiki website, the first int of data isn't included as a protomember. Each field is also required, so if the direction is zero or movement type is zero (for example), it won't crash the client or cause mishandling on the server.


Spirited is offline  
Reply



« Guide to opening Conquer Online Private Server | [Guide] Where to Host Your Server »

Similar Threads
new Groundmovement packet(10005)
10/21/2015 - CO2 PServer - Discussions / Questions - 13 Replies
in conquer last patch movement packet got an update i need help in analyzing the strange thing is the packet sometimes send with len 15 and sometimes with 14 and i can't find char uid(1591445) 15 00 15 27 08 E6 01 10 95 91 61 18 01 20 E1 92 F3 26 28 EA 07 14 00 15 27 08 68 10 95 91 61 18 01 20 E9 F6 F1 26 28 EA 07
[Question] Walk/Run Packet
10/19/2015 - CO2 PServer - Discussions / Questions - 1 Replies
After adding fully functional Tempest Wings to the source and client, there seems to be an issue with the Walk/Run packet that lags or glitches you out of the game resulting you to disconnect. Has anyone found any hint where to change the packet? or is it still not discovered yet. :handsdown: to those who have. or is this the result of adding mesh? or can it be the Move/Run speed within the Monsters?
walk packet - visual effect
06/28/2014 - Nostale - 9 Replies
Hi! I'm making packet-using bot and I have big problem - I stopped on walking event, beacuse sending "walk" only sends packet to server and our character (in client) is standing in the same place. Do you have any ideas to move our character visually with packet? :)
Walk packet
09/28/2011 - CO2 PServer - Discussions / Questions - 3 Replies
today i came across to a problem that when 1 client sends walk packet to other clients. That packet is delayed up to 1-4 secs. But this is when you send it at stand -> to walk. if you send walk packet when client is walking then there is no delay(not counting delay that was made stand ->walk). could that be client? or my source? i don't have problems with any other packet.... client is 4*** late something. Fun -= walk <-- video to better understand what I'm talking about!
Walk Packet
04/01/2010 - SRO Main - Discussions / Questions - 3 Replies
I've been following Pushedx (Drew) guides, and so far I've done some interesting things. Now I want to understand how the Walk packets works, but I can't find any pattern or place to start of, if anyone could help me please. That's what I have so far: 01 ?? ?? //Dunno what they are XX ?? //Left one indicates the X position, but dunno how ?? ?? YY ?? //Left one indicates the Y position, but dunno how



All times are GMT +1. The time now is 15:52.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.