Register for your free account! | Forgot your password?

You last visited: Today at 05:45

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

Advertisement



Packet Builder?

Discussion on Packet Builder? within the CO2 Programming forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
U2_Caparzo's Avatar
 
elite*gold: 0
Join Date: Aug 2011
Posts: 314
Received Thanks: 90
Packet Builder?

Hi everyone.

I just want to ask you if the efficiency of the Packet builder is something that you have to worry, or it doesn't make any big diference, it's because i dk if i should give it a try(try to build one by my own) or take it from an existing source.

thanks in advance
U2_Caparzo is offline  
Old 05/29/2012, 13:17   #2
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Data-structs and pointers is the way to go.
I don't have a username is offline  
Old 05/29/2012, 23:09   #3


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
Quote:
Originally Posted by I don't have a username View Post
Data-structs and pointers is the way to go.
Serialization anyone?
KraHen is offline  
Thanks
1 User
Old 05/30/2012, 07:17   #4
 
InfamousNoone's Avatar
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,885
Serialization usually impedes too much on performance for me to say I'd ever use it. If it's in a case where how fast it perms isn't significant (i.e. loading settings from a file) I'd advocate the use of serialization (in this case XML serialization because the XML-file format is extremely easy to edit).

Structures (with pointers) are nice and all (hell I use to abuse them all the time back a few years ago; just look at CSV2) however, they're not maintainable.

What I mean by that is writing code targeted at various versions of something requires the ability to be changed very easily with little to no effort. For example, say a parameter exists a new version of Conquer, but doesn't on an older version? In terms of a data structure if the user were to ever assign to this instance-member updating the code to the suitable version would become quite tedious. The second problem with this method is that it does not account for dynamic packets with variance in length (such as chat packets, synchoro/userattr packets, etc.)

Today, I utilize a method similar to that of a stream (essentially, a packet builder). You can compare the functions I use to that of BinaryWriter and BinaryReader, but obviously my implementation varies. I would not advocate the use of MemoryStream's with packets either if you thought that's where I was going.
InfamousNoone is offline  
Thanks
2 Users
Old 05/30/2012, 08:51   #5


 
KraHen's Avatar
 
elite*gold: 0
Join Date: Jul 2006
Posts: 2,216
Received Thanks: 794
I suppose you`re talking about the writer that overloads the > operator. I became a big fan of that (not just for packet building, operators rule), cheers.
KraHen is offline  
Old 05/30/2012, 20:26   #6
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by InfamousNoone View Post
Serialization usually impedes too much on performance for me to say I'd ever use it. If it's in a case where how fast it perms isn't significant (i.e. loading settings from a file) I'd advocate the use of serialization (in this case XML serialization because the XML-file format is extremely easy to edit).

Structures (with pointers) are nice and all (hell I use to abuse them all the time back a few years ago; just look at CSV2) however, they're not maintainable.

What I mean by that is writing code targeted at various versions of something requires the ability to be changed very easily with little to no effort. For example, say a parameter exists a new version of Conquer, but doesn't on an older version? In terms of a data structure if the user were to ever assign to this instance-member updating the code to the suitable version would become quite tedious. The second problem with this method is that it does not account for dynamic packets with variance in length (such as chat packets, synchoro/userattr packets, etc.)

Today, I utilize a method similar to that of a stream (essentially, a packet builder). You can compare the functions I use to that of BinaryWriter and BinaryReader, but obviously my implementation varies. I would not advocate the use of MemoryStream's with packets either if you thought that's where I was going.
I agree that that maintainability can be an issue but you can definitely write your packets in a way that the maintenance aspect is simpler.

I know dev was using such a system now where he still used pointers for all his packets but the offsets were all related to the offset of the previous value being written. As such you could simply insert a value in the middle of the writer and all future offsets would update.

That combined with the netstringpacker that TQ uses in their official servers makes accounting for variable length data much simpler then it might otherwise be.
pro4never is offline  
Reply


Similar Threads Similar Threads
Hybrids packet builder
02/16/2011 - CO2 Private Server - 11 Replies
Alright so hybrids packet builder; It has 5 functions, each doing these: Writing a UInt16 Writing a UInt32 Writing a UInt64 Writing a String Writing a String with Length Now I made this function, and I'm wanting it to be universal, used to do all of the above. Would this work?
[RELEASE] My first packet builder.
05/08/2010 - CO2 PServer Guides & Releases - 3 Replies
This is a release of my first, packet builder I've ever made. It is very old, and I doubt there aren't any better around here, this one is just pretty logical to my opinion, where others failed. This will be a part of the things I will be dumping after I formatted my PC without being prepared. I'm sorry for all other info I still had on the CO2 PServer development, it is not available for my any more. I was going to release it all though, but not just yet. public class PacketCreate { ...



All times are GMT +1. The time now is 05:47.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.