Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Reducing Client/Server size

Status
Not open for further replies.
Owner
Member
Joined
May 13, 2011
Messages
1,497
Reaction score
157
Hi i am now working on reducing client/server files.

These files have i changed.
Spec_Item Reduced to 953KB will get an bit lower since i removed SEX_MALE/SEX_FEMALE from all CS and Normal set items.(Reason is below)....(mdlDyna.inc)
PropSkill reduced to 122KB Removed unnecessary rows
PropskillAdd reduced to 40KB. All Skill have Max Level 1(To help in balancing)
PropMoverEx reduced to 213KB All DropItem/DropKinds removed
PropDropEvent.inc will hold all droppable items.
---Keep in mind i will alter this file so you have also LegendDropItem(Legend weapon) This will also be scripted in the source so you can add it to Event.Lua as LegendDropItem Rate. to increase or decrease legendary drop.

MdlDyna.inc is an work in progress.
So far all Set items like II_ARM_F_VAG_SUIT01 and II_ARM_M_VAG_SUIT01 will be converted to 1
II_ARM_VAG_SUIT01 inside MdlDyna.inc this will result in
Code:
"GenMatSuitbox"    II_ARM_VAG_SUIT01      MODELTYPE_MESH "mVag01Upper/fVag01Upper"  0 MD_NEAR 0  1.0f 0 1 ATEX_NONE 1

Saves also an ton on extra codes.

If you have any tips or advice feel free to post it here. So i can check it out.

P.S. I know i change the priority of my build on lot. But sometimes its an bit necessary to change subjects

With kind regards.
 
Trust your senses
Joined
Sep 12, 2009
Messages
661
Reaction score
173
I think that the size of the text and resource files are rather insignificant compared to the size of the models and textures (what mostly defines the client size).
 
Owner
Member
Joined
May 13, 2011
Messages
1,497
Reaction score
157
Yes you are correct. The models/Bones etc take an lot of space.

What i am also doing is remove all models/textures and only insert the ones that are needed.

And sure 3MB for an file is not large but after some testing my client is loading faster. compared to the 3MB file
about 3 seconds.

Also its easier to manage since you dont have to make lines for male and female
so this

II_ARM_M_STORMB_HELMET_SET_KAL
II_ARM_F_STORMB_HELMET_SET_KAL

Is going to only II_ARM_STORMB_HELMET_SET_KAL and inside mdldyna.inc i have it like this
"GenMatSuitbox" II_ARM_STORMB_HELMET_SET_KAL MODELTYPE_MESH "mStormbSet01Cap/fStormbSet01Cap" 0 MD_NEAR 0 1.0f 0 1 ATEX_NONE 1
 
Initiate Mage
Joined
Nov 26, 2015
Messages
16
Reaction score
4
In your example you are using the same "field" in mdlDyna.inc to specify both models.
"GenMatSuitbox" II_ARM_STORMB_HELMET_SET_KAL MODELTYPE_MESH "mStormbSet01Cap/fStormbSet01Cap" 0 MD_NEAR 0 1.0f 0 1 ATEX_NONE 1


Did you consider splitting it up in 2 "fields" for better readability and to prevent accidents? Like this:

"GenMatSuitbox" II_ARM_STORMB_HELMET_SET_KAL MODELTYPE_MESH "mStormbSet01Cap" "fStormbSet01Cap" 0 MD_NEAR 0 1.0f 0 1 ATEX_NONE 1

Overall I like the idea, it also makes item trans useless and overall trading a lot simpler. You also have to load a significantly smaller amount of items and the set of possible Item-ID's also shrinks down.
 
Owner
Member
Joined
May 13, 2011
Messages
1,497
Reaction score
157
Hmm didnt thought of that. But yeah that could be done. i only need to modify the source so it reads the extra ""
Cause atm it will read it like this

Code:
TCHAR* pszPart2 = strchr( lpModelElem->m_szPart, '/' );
		if( pszPart2 == NULL )
			_tcscat( pszPartsName, lpModelElem->m_szPart );
		else
		{
			TCHAR szPartName[ 128 ];
			if( nSex == SEX_MALE )
			{
				_tcscpy( szPartName, lpModelElem->m_szPart );
				szPartName[ (int)pszPart2 - (int)lpModelElem->m_szPart ] = 0;
				_tcscat( pszPartsName, szPartName );
			}
			else
			{
				_tcscat( pszPartsName, pszPart2 + 1 );
			}
		}

So basicly its splitting the parts with an '/' then it checkes if its null if not the proceed with male / female parts loading.
 
One word! Im Fawkin Pro!
Member
Joined
Jul 1, 2010
Messages
1,254
Reaction score
359
An idea that could reduce a lot of the file size is to change a bit in the source so you only have to add "StormbSet01Cap"

Let me explain.

All sets does have the same name in the files the only thing seperating them is the "f" and "m" at the beginning of the name.

By only adding the file name by the actual name of the item will reduce a lot thought you would have to think out a way to make it work for fashion since all fashion does not have sets for both female and male.
A fix for that:
an extra column in propitem.txt (or spec_item(?)) to decide whether both gender or only female/male can wear this item.
example:
= : both
1 : male
2 : female

Pro & Cons.

1. Reduces mdldyna by a lot
2. adds 3 bites to every item (tab, character, tab) in game and makes propitem.txt a bit larger

The way I see it it would reduce more than gaining size.
 
Last edited:
Owner
Member
Joined
May 13, 2011
Messages
1,497
Reaction score
157
Thnx i will take an look into it. However keep in mind that
the model names are not the same

Part_mVag01Upper.o3d
and Part_fVag01Upper.o3d

So the way you suggest is to only have Part_Vag01Upper.o3d. so that isnt working What i can do is alter mdldyna so you only have mVag01Upper
and then true source do an Replace. for example
If(GetSex() == SEX_FEMALE) { Model.Replace("m", "f"); } else { Load normal model } they way i have it is already good cause it only takes up
48KB this is only the Parts that i have inside my mdlDyna.inc.

Atm my mdldyna.inc is 1.048KB big.

if i learn on how to read an array and implent it correctly i can reduce it even further
Take an look at this

Code:
"InfoPeng" MI_INFO_PENG MODELTYPE_ANIMATED_MESH "" 0  MD_MID 0  2.0f 0 1 ATEX_NONE 1
	{
		"idle1"     MTI_IDLE1
		"idle1"     MTI_IDLE2
		"sit"       MTI_SIT
		"SitStand"  MTI_SITSTAND
		"stand"     MTI_STAND
		"walk"      MTI_WALK
		"GetUp"     MTI_GETUP
		"stand"     MTI_JUMP1
		"stand"     MTI_JUMP2
		"stand"     MTI_JUMP3
		"stand"     MTI_JUMP4
		"walk"      MTI_RUN
	}

Why not implant an array that holds those standard values?
Then your mdldyna entrance is only this

"InfoPeng" MI_INFO_PENG MODELTYPE_ANIMATED_MESH "" 0 MD_MID 0 2.0f 0 1 ATEX_NONE 1

That will save an lot of code inside the file.
Whether or not its performance enhancing is something i need to figure out.
Cause it would mean that its loading those standard Motion names in the source.
 
Initiate Mage
Joined
Nov 26, 2015
Messages
16
Reaction score
4
I dont think you want to abstract the animation mapping away as it really is there for a reason (see how it maps all jump animations to standing?).

The thing is, you don't want to optimize load time by compromising too much freedom, you want to be able to change all the things that are in the file, I would even advise to give you more options to set just to make it more flexible.

If you want to go the extreme load time optimized way without loosing freedom, my choice would be keeping the filestructure as is, and preprocess the file into a binary file which can be read by the source. That way you still edit the human readable file, but process a binary-loadtime-optimized version on client and server. It will be the smallest you can ever get this file and will load significantly faster.




About not specifying those 2 seperate model names, i would also keep both full model names in just because you wanna stay flexible.
 
Owner
Member
Joined
May 13, 2011
Messages
1,497
Reaction score
157
I dont think you want to abstract the animation mapping away as it really is there for a reason (see how it maps all jump animations to standing?).

I dont remove the animation mapping. I only remove it from mdlDyna.inc and add it into the source. Since all movers uses the same animation.
So i want it like an array. So i dont have 100+ lines with the same code. instead it uses 1 base for all motions.

int a[12][12] { { "stand", MTI_STAND }, {"sit", MTI_SITSTAND" }, etc/

Full model names will be used. Cause you can't have 2x the same file inside 1 folder. Part_Vag01Helmet.o3d for both male and female that aint working.

So thats why i have mVag01Helmet/fVag01Helmet. The only thing that is the same for male en female is the dwID II_VAG01_HELMET
 
One word! Im Fawkin Pro!
Member
Joined
Jul 1, 2010
Messages
1,254
Reaction score
359
if you add the following code :

Code:
void CModelMng::MakePartsName( TCHAR* pszPartsName, LPCTSTR lpszRootName, DWORD dwIndex, int nSex )
{
	LPMODELELEM lpModelElem = GetModelElem( OT_ITEM, dwIndex );
	_tcscpy( pszPartsName, lpszRootName );
	[COLOR="#FF0000"]if(nSex == SEX_MALE)
	{
		_tcscat( pszPartsName, _T( "_m" ) );
	}else if (nSex == SEX_FEMALE)
	{
		_tcscat( pszPartsName, _T( "_f" ) );
	}else
	{
	_tcscat( pszPartsName, _T( "_" ) );
	}[/COLOR]
	if( nSex == SEX_SEXLESS || nSex == -1 )
		_tcscat( pszPartsName, lpModelElem->m_szPart );
	else
	{
		TCHAR* pszPart2 = strchr( lpModelElem->m_szPart, '/' );
		if( pszPart2 == NULL )
			_tcscat( pszPartsName, lpModelElem->m_szPart );
		else
		{
			TCHAR szPartName[ 128 ];
			if( nSex == SEX_MALE )
			{
				_tcscpy( szPartName, lpModelElem->m_szPart );
				szPartName[ (int)pszPart2 - (int)lpModelElem->m_szPart ] = 0;
				_tcscat( pszPartsName, szPartName );
			}else
			{
				_tcscat( pszPartsName, pszPart2 + 1 );
			}
		}
	}
	_tcscat( pszPartsName, _T( ".o3d" ) );
}

you are able to remove all the "f" and "m" for armor in mdldyna to make it the following:

Code:
"GenMatSuitbox"    II_ARM_M_VAG_SUIT01      MODELTYPE_MESH "[COLOR="#FF0000"]Vag01Upper[/COLOR]"  0 MD_NEAR 0  1.0f 0 1 ATEX_NONE 1
"GenMatSuitbox"    II_ARM_F_VAG_SUIT01      MODELTYPE_MESH "[COLOR="#FF0000"]Vag01Upper[/COLOR]"  0 MD_NEAR 0  1.0f 0 1 ATEX_NONE 1

Now all I have to do is to make a checkup in the "SEX_SEXLESS" field to wether it is a female or male character to load the correct model.. Probably have to access the db for this, will try not to since coding in the db is not my field.

This code reads from specitem.txt wether the male or female can wear it.
If "SEX_MALE" is written it will automaticly add Part_m
If "SEX_FEMALE" yeah you get the point.

If it is "SEX_SEXLESS" or "=" then it will read the file as it is ("Part_Vag01Upper.o3d"), will try to make something to check wether your current character is male or female so a code like this can be changed in mdldyna

Code:
"GenMatSuitbox"    II_ARM_VAG_SUIT01      MODELTYPE_MESH "[COLOR="#FF0000"]Vag01Upper[/COLOR]"  0 MD_NEAR 0  1.0f 0 1 ATEX_NONE 1

Then there wouldn't be a need for that extra "/".

This is just an example of how you are able to minimize the size by a lot :)

Wow, seriously.. Did not think it would be that easy really...

Here is what you have to do to make it work.

at
Code:
_tcscat( pszPartsName, _T( "_" ) );

change it to following:

Code:
if(nSex == SEX_MALE)
	{
		_tcscat( pszPartsName, _T( "_m" ) );
	}else if (nSex == SEX_FEMALE)
	{
		_tcscat( pszPartsName, _T( "_f" ) );
	}else
	{
	_tcscat( pszPartsName, _T( "_" ) );
	}

and at
Code:
if( nSex == SEX_MALE )
			{
				_tcscpy( szPartName, lpModelElem->m_szPart );

add

Code:
if( nSex == SEX_MALE )
			{
				[COLOR="#FF0000"]_tcscat( pszPartsName, _T( "_m" ) );[/COLOR]
				_tcscpy( szPartName, lpModelElem->m_szPart );

and for female:

Code:
}else
			{
				[COLOR="#FF0000"]_tcscat( pszPartsName, _T( "_f" ) );[/COLOR]
				_tcscat( pszPartsName, pszPart2 + 1 );
			}

in Mdldyna it is following:

Code:
"GenMatSuitbox"    [COLOR="#FF0000"]II_ARM_VAG_SUIT01[/COLOR]      MODELTYPE_MESH [COLOR="#FF0000"]"Vag01Upper"[/COLOR]  0 MD_NEAR 0  1.0f 0 1 ATEX_NONE 1

Notice also that if you havent removed "f" or "m" in mdldyna you get errors like:

"LoadObject : part_mmVag01Hand.o3d 읽기 실패"
or
"LoadObject : part_ffVag01Hand.o3d 읽기 실패"

The game will work but your hands will be invisible (so no crash).

Hope it helps your journey to make a smaller size :)

Oh probably dont have to tell YOU this but anyways.. if you change the ID in mdldyna dont forget to change it in specitem & define, haha made that mistake myself 2 times.

And only Sexless on armor items that have o3d for both female & male with the same name.

In other words, Fashion items have to have the "f" or "m" removed in mdldyna but no need to change anything else for them :)


Edit: I have only tried 2 or 3 random armor and it works fine.
And since Fashion should be not be sexless this will work out just fine for them too :)

edit2:

I did some random testing on what would happen if I only changed the o3d names in mdldyna (removing f & m on certain armors) but with the Gender restrict, works perfectly without any errors.

Edit
Noticed that a few cloaks are named "Parts_female"/"Parts_male" which either needs to be renamed or a fix in the current snippet is a need.
Aswell as some models for female/male (thought I think they are not to be touched as the models works fine)

going to continue tomorrow tho :)
 
Last edited:
Owner
Member
Joined
May 13, 2011
Messages
1,497
Reaction score
157
Thanks Xakzi that worked fine.

here is mine script for the icons inside the inventory to match Sex of the char.

Code:
ItemProp* pItemProp = pItemElem->GetProp();
			CString strIcon = pItemProp->szIcon;
			//pItemElem->GetTexture()->Render( p2DRender, CPoint( x, y ), nalpha ); //Get Texture of Items inside Inventory.
			if (g_pPlayer->GetSex() == SEX_MALE)
			{
				m_pTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, strIcon), 0xffff00ff);
				//pItemElem->GetTextureMale()->Render(p2DRender, CPoint(x, y), nalpha);
				m_pTexture->Render(p2DRender, CPoint(x, y), nalpha);
			}
			else if(g_pPlayer->GetSex() == SEX_FEMALE)
			{
				strIcon.Replace("Itm_m", "Itm_f");
				m_pTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, strIcon), 0xffff00ff);
				//pItemElem->GetTextureFemale()->Render(p2DRender, CPoint(x, y), nalpha);
				m_pTexture->Render(p2DRender, CPoint(x, y), nalpha);
			}
			else
			{
				pItemElem->GetTexture()->Render(p2DRender, CPoint(x, y), nalpha);
			}

It will replace szIcon Itm_m to Itm_f. I will make an switch into it so it only works on the parts that have no sex set.
 
One word! Im Fawkin Pro!
Member
Joined
Jul 1, 2010
Messages
1,254
Reaction score
359
Thanks Xakzi that worked fine.

here is mine script for the icons inside the inventory to match Sex of the char.

Code:
ItemProp* pItemProp = pItemElem->GetProp();
			CString strIcon = pItemProp->szIcon;
			//pItemElem->GetTexture()->Render( p2DRender, CPoint( x, y ), nalpha ); //Get Texture of Items inside Inventory.
			if (g_pPlayer->GetSex() == SEX_MALE)
			{
				m_pTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, strIcon), 0xffff00ff);
				//pItemElem->GetTextureMale()->Render(p2DRender, CPoint(x, y), nalpha);
				m_pTexture->Render(p2DRender, CPoint(x, y), nalpha);
			}
			else if(g_pPlayer->GetSex() == SEX_FEMALE)
			{
				strIcon.Replace("Itm_m", "Itm_f");
				m_pTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, strIcon), 0xffff00ff);
				//pItemElem->GetTextureFemale()->Render(p2DRender, CPoint(x, y), nalpha);
				m_pTexture->Render(p2DRender, CPoint(x, y), nalpha);
			}
			else
			{
				pItemElem->GetTexture()->Render(p2DRender, CPoint(x, y), nalpha);
			}

It will replace szIcon Itm_m to Itm_f. I will make an switch into it so it only works on the parts that have no sex set.

Ohh, did not really mind the icons haha ^^ Well that could be a cool feature indeed.

A little update with the female/male is the same progression.

Works fine for npc's too.. If the npc is a female it will get female armor, if male then male armor..
Tho I find it funny that the knight helmet stayed male for some reason :p But everyone else got the female armor all around ^^

dea6a558f655f528837deb96cc27a422 - Reducing Client/Server size - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
Last edited:
Owner
Member
Joined
May 13, 2011
Messages
1,497
Reaction score
157
Here is an better version of the icons of the inventory

Code:
if( bRander == 0 )
		{
			ItemProp* pItemProp = pItemElem->GetProp();
			CString strIcon = pItemProp->szIcon;
			switch (pItemProp->dwItemKind3)
			{
			case IK3_HELMET:
			case IK3_SUIT:
			case IK3_GAUNTLET:
			case IK3_BOOTS:
				switch (g_pPlayer->GetSex())
				{
				case SEX_MALE:
					m_pTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, strIcon), 0xffff00ff);
					m_pTexture->Render(p2DRender, CPoint(x, y), nalpha);
					break;
				case SEX_FEMALE:
					strIcon.Replace("Itm_m", "Itm_f");
					m_pTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, strIcon), 0xffff00ff);
					m_pTexture->Render(p2DRender, CPoint(x, y), nalpha);
					break;
				}
				break;
			default:
				pItemElem->GetTexture()->Render(p2DRender, CPoint(x, y), nalpha);
				break;
			}
		}
		else
		if( bRander == 1 )	// »ç¿ëÇÒ¼ö ¾ø´Â°Í
		{
			pItemElem->GetTexture()->Render2( p2DRender, CPoint( x, y ), D3DCOLOR_ARGB( nalpha, 255, 100, 100 ) );
		}

Ps what do you think of this

Remove all DropItems from PropMoverEx.inc
Input all the things you want to drop from mobs inside PropDropEvent?

If have mine set to this atm for testing

DropLegend(II_WEA_SWO_SUHO, 25000, 0, -1, 1, 175); //25000

DropNormal(II_GEN_FOO_INS_LOLLIPOP, 700000000, 0, -1, 1, 4); //70%

as you can see i have made an new entrance DropLegend now i can set the legendary drop rate true Eventfunc.lua

So all Mobs can drop an legendary item.
But bosses can drop at an higher rate. That will still be inside PropMoverEx.inc.

I know it has nothing to do with the above. But its an idea.

Atm i am working on Array for the Motions.
Cause all Mobs/Npc's are using almost the same motions so i will make an standard array that will hold the commonly used motions so i can remove them also from MdlDyna.inc thus further shrinking down the file.
 
Last edited:
One word! Im Fawkin Pro!
Member
Joined
Jul 1, 2010
Messages
1,254
Reaction score
359
Here is an better version of the icons of the inventory

Code:
if( bRander == 0 )
		{
			ItemProp* pItemProp = pItemElem->GetProp();
			CString strIcon = pItemProp->szIcon;
			switch (pItemProp->dwItemKind3)
			{
			case IK3_HELMET:
			case IK3_SUIT:
			case IK3_GAUNTLET:
			case IK3_BOOTS:
				switch (g_pPlayer->GetSex())
				{
				case SEX_MALE:
					m_pTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, strIcon), 0xffff00ff);
					m_pTexture->Render(p2DRender, CPoint(x, y), nalpha);
					break;
				case SEX_FEMALE:
					strIcon.Replace("Itm_m", "Itm_f");
					m_pTexture = CWndBase::m_textureMng.AddTexture(g_Neuz.m_pd3dDevice, MakePath(DIR_ITEM, strIcon), 0xffff00ff);
					m_pTexture->Render(p2DRender, CPoint(x, y), nalpha);
					break;
				}
				break;
			default:
				pItemElem->GetTexture()->Render(p2DRender, CPoint(x, y), nalpha);
				break;
			}
		}
		else
		if( bRander == 1 )	// »ç¿ëÇÒ¼ö ¾ø´Â°Í
		{
			pItemElem->GetTexture()->Render2( p2DRender, CPoint( x, y ), D3DCOLOR_ARGB( nalpha, 255, 100, 100 ) );
		}

Ps what do you think of this

Remove all DropItems from PropMoverEx.inc
Input all the things you want to drop from mobs inside PropDropEvent?

If have mine set to this atm for testing

DropLegend(II_WEA_SWO_SUHO, 25000, 0, -1, 1, 175); //25000

DropNormal(II_GEN_FOO_INS_LOLLIPOP, 700000000, 0, -1, 1, 4); //70%

as you can see i have made an new entrance DropLegend now i can set the legendary drop rate true Eventfunc.lua

So all Mobs can drop an legendary item.
But bosses can drop at an higher rate. That will still be inside PropMoverEx.inc.

I know it has nothing to do with the above. But its an idea.

Atm i am working on Array for the Motions.
Cause all Mobs/Npc's are using almost the same motions so i will make an standard array that will hold the commonly used motions so i can remove them also from MdlDyna.inc thus further shrinking down the file.



yeah that is actually a great idea.. less complicated to edit drops
Great idea with the animation thought I would suggest you read Hesito's comment again, he has a point.
 
Owner
Member
Joined
May 13, 2011
Messages
1,497
Reaction score
157
yeah that is actually a great idea.. less complicated to edit drops
Great idea with the animation thought I would suggest you read Hesito's comment again, he has a point.

Yeah indeed he has an point. I will see what i can do with binary file editing etc. My Knowledge is not that great but i am an fast learner so i will check it out.
 
One word! Im Fawkin Pro!
Member
Joined
Jul 1, 2010
Messages
1,254
Reaction score
359
The "strIcon.Replace("Itm_m", "Itm_f");" Does not change the name at all.. Trying to find a better way of doing this

nevermind, found out the problem..


This is very case sensetive.

Keep in mind that dragging an item that this effects will show the real icon

edit:

add; "strIcon.MakeLower();"
after each sex case to remove the case sensitivity :)
 
Last edited:
Status
Not open for further replies.
Back
Top