Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > EQ2 Development

EQ2 Development Everquest 2 Emulator development

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2005, 08:31 PM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default Proposed Network Meta-Language

This is a proposition for a meta-language for networking. This would provide us with a way to build packet parsers with little to no hassle. These can be compiled to C code (which would be a struct, or series of structs, and a function that builds the packet or reads the data into a usable struct) or can be loaded/modified on the fly for development.

Syntax:

Code:
struct struct_name (optional size) {
	type	item_name;
	type	item_name = default_value;
	type	item_name = 's'; // This works as in C.
	type	item_name[count];
	type	item_name[count] = {5, 6, 7, 8};
	type	item_name[count] = 'non-terminated string';
	type	item_name[count] = "null-terminated string";
	struct struct_name	item_name;
	struct struct_name	item_name[count];
};
You can also use a map structure to rename items without actually changing their name, this is useful for keeping structures named as they are elsewhere, while keeping compatibility with existing code.

You can use struct items as the count for an array, unlike in C. However, this means it can not be translated to a single array, and must be processed separately. This should not be any more of a performance hit than doing it by hand.

Maps are defined as such:

Code:
struct ... {
...
} map {
	Access_Name: name_in_struct;
};


Examples:

A simple struct and map.

Code:
struct NameApproval (76) {
	char	name[64];	/* 00000000 */
	uint32	race;		/* 00000064 */
	uint32	class;		/* 00000068 */
	uint32	deity;		/* 00000072 */
} map {
	Name:	name;
	Race:	race;
	Class_:	class;
	Deity:	deity;
};
A dynamic length string.

Code:
struct DynamicLength {
	uint32	length;
	char	name[length];
};
Any input would be welcome.

Thanks,
Lord Daeken M. BlackBlade
(Cody Brocious)
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote
  #2  
Old 06-07-2005, 03:09 AM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

im not gunna get too involved in this discussion, but I will throw in what I took away from me and Doodman talking about this a while back.

Basically the best way to achieve independance from struct changes in the client is to do what I did for opcodes: Make all the game code use an internal representation of the struct which will not change, and therefore not need recompile. Then have some agent to convert from this internal representation to the actual net-layer representation when you send or receive the packet.

Your meta layer would address some of this in that it could generate the internal structures, and assuming it supported different named maps for each 'patch' you supported then it could generate most or all of the translation routines as well.

The major problem with this scheme is that you have to keep in mind what a struct change normally means: they added something to the packet. The internal packet representation would work fine if they scrambled or shortened a packet, but that is rarely the case. In the case of addition, in order to do something useful with the additional field, you would have to also add something to the internal representation of the packet to get that additional information down to the packet translator, which means recompile. Granted, if you just wanted to leave the new space as 'unknown' then you could get away without recompiling. But this kinda limits the utility of it to pure testing and ignoring the new fields.

Also keep in mind that there are many dynamic length packets which do not contain their length at all, but instead rely on (possibly many different) null terminated strings to dictate their length. Also arrays of dynamic length structs. Both of these are getting more and more common in eq1, so I can only imagine they are coming from eq2-isms.

I am sure there are other ways to pull this off as well, such as using some dynamic structure in memory, and a dynamic converter, but your talking about significant overhead in those situations.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 12:30 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3