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

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 09-15-2004, 12:48 AM
Dimorge02
Fire Beetle
 
Join Date: Sep 2004
Posts: 29
Default

I agree that it's a pretty amazing program. To properly design an OO program takes time. And as you stated, the race to beat the next patch does effect things.
Now with that said, i have started porting over the code from EQEmuSharedMem to C#. Mostly converting packet structs to C# structs. It's a great way to learn the innerds of the program.
C# struct have some limitations that can be overcome with interop.

Example:

C++
Code:
struct NameApproval
{
	char name[64];
	int32 race;
	int32 class_;
	int32 deity;
};
C#

Code:
[StructLayout( LayoutKind.Sequential )]
	public struct NameApproval
	{			
		[MarshalAs(UnmanagedType.ByValArray, SizeConst=64)]
		public char[]	name;	
		public int		race;
		public int		class_;
		public int		diety;
	}
Unions
C++
Code:
struct Color_Struct
{
	union
	{
		struct
		{
			int8	blue;
			int8	green;
			int8	red;
			uint8	use_tint;	// if there's a tint this is FF
		} rgb;
		uint32 color;
	};
};
C#
Code:
   /// <summary>
	/// RGB_Struct
	/// Size: 4 Bytes
	/// **Used internally in Color_Struct**
	/// </summary>
	[StructLayout( LayoutKind.Sequential )]
	public struct RGB_Struct
	{
		public sbyte	blue;
		public sbyte	green;
		public sbyte	red;
		public byte	use_tint;
	}
	/// <summary>
	/// Color_Struct (Union)
	/// Size: 4 bytes
	/// Used for convenience
	/// Note: Orginal source used an anonymous union (rgb).
	/// </summary>
	[StructLayout( LayoutKind.Explicit, Size=4, CharSet=CharSet.Unicode, Pack=1)]
	public struct Color_Struct
	{
		[FieldOffset( 0 )]
		public RGB_Struct	rgb;
		[FieldOffset( 0 )]
		public uint		color;
	}
Also C# does not natively support bitfields. But i found a working bitfield class (i didn't write) for that.

I am not writing this because i think it will be superior to C++ release. I am writing it so i can get a deeper understanding of the code. Once i do this, I will analyze the structure and try to implement proper OO design.

Regardless of patches,The fact is some things that do not change. Players still run, cast spells, Meditate, interact with mobs, chat, ect. How those actions get implemented should be done at a lower layer.

I think redesign is a great idea. But i do understand the limited time and resources peope have so i won' t hold my breath
:lol:
Reply With Quote
Reply

Thread Tools
Display Modes

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 06:02 PM.


 

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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3