Jump to content

Recommended Posts

  • Honorable Member

Hello everyone,

I was optimizing the loading of maps for my server and I decided to share it with the public. With this modifications, only the objects and effects around the character will be loaded and it will handle their load and unload as you move around. Also effect updatings are optimized a way that closer effects are updated more frequently.

Okay, so let's start the work ?

This is the hidden content, please

 

Good luck! ?

Edited by Distraught
  • Metin2 Dev 359
  • Eyes 9
  • Dislove 2
  • Not Good 1
  • Sad 1
  • Cry 1
  • Scream 4
  • Good 65
  • Love 14
  • Love 164

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/
Share on other sites

  • Honorable Member

Thank you guys ❤️

  

31 minutes ago, Ulthar said:

Thanks! ^^
Do we need to create the python part for ourselves? ?

@ ASIKOO #honorablefordistraught

Yes, that's not included, it will use the clipping distance by default. You can play with the distance in CArea::GetMaxLoadingDistanceSqr.

Edited by Distraught

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-151041
Share on other sites

  • Premium
1 hour ago, Distraught said:

Yes, that's not included, it will use the clipping distance by default. You can play with the distance in CArea::GetMaxLoadingDistanceSqr.

Thanks for answer! ^^

  • Love 1

Ulthar

Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-151045
Share on other sites

in CArea::__UpdateLoadedObjectInstances u have new func "emplace" and here it is not used value_type

				if ((*it)->dwType == prt::PROPERTY_TYPE_BUILDING)
					m_GraphicThingInstanceCRCMap.emplace(TGraphicThingInstanceCRCMap::value_type((*it)->pThingInstance, c_pObjectData->dwCRC));

 

like this:

				if ((*it)->dwType == prt::PROPERTY_TYPE_BUILDING)
					m_GraphicThingInstanceCRCMap.emplace((*it)->pThingInstance, c_pObjectData->dwCRC);
Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-151164
Share on other sites

  • 3 weeks later...

Hello,i have this error when i compile, any ideas?
BUG

Edited by Metin2 Dev
Core X - External 2 Internal

“𝓐𝓵𝓵 𝔀𝓮 𝓱𝓪𝓿𝓮 𝓽𝓸 𝓭𝓮𝓬𝓲𝓭𝓮 𝓲𝓼 𝔀𝓱𝓪𝓽 𝓽𝓸 𝓭𝓸 𝔀𝓲𝓽𝓱 𝓽𝓱𝓮 𝓽𝓲𝓶𝓮 𝓽𝓱𝓪𝓽 𝓲𝓼 𝓰𝓲𝓿𝓮𝓷 𝓾𝓼.” ~ 𝓖𝓪𝓷𝓭𝓪𝓵𝓯 𝓽𝓱𝓮 𝓖𝓻𝓮𝔂

Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-151555
Share on other sites

  • Premium
53 minutes ago, Jimmermania said:

Hello,i have this error when i compile, any ideas?
BUG

#include "StdAfx.h"

Be sure you didn't broke something in the #includes + in the Template declaration.

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-151556
Share on other sites

16 hours ago, WeedHex said:
#include "StdAfx.h"

Be sure you didn't broke something in the #includes + in the Template declaration.

These are my includes in file Area.cpp:
 

#include "../eterLib/ResourceManager.h"
#include "../eterLib/StateManager.h"
#include "../effectLib/EffectManager.h"
#include "../SpeedTreeLib/SpeedTreeForestDirectX8.h"
#include "../eterBase/Timer.h"


#include "Area.h"
#include "PropertyManager.h"
#include "Property.h"

#include <boost/algorithm/string.hpp>
#ifdef CAREA_OPTIMIZATION
#include "StdAfx.h"
#include "../effectLib/EffectInstance.h"
#include "../UserInterface/PythonApplication.h"
#include "../UserInterface/StdAfx.h"
#include "../UserInterface/PythonCharacterManager.h"
#include "../UserInterface/PythonBackground.h"
#endif

 

“𝓐𝓵𝓵 𝔀𝓮 𝓱𝓪𝓿𝓮 𝓽𝓸 𝓭𝓮𝓬𝓲𝓭𝓮 𝓲𝓼 𝔀𝓱𝓪𝓽 𝓽𝓸 𝓭𝓸 𝔀𝓲𝓽𝓱 𝓽𝓱𝓮 𝓽𝓲𝓶𝓮 𝓽𝓱𝓪𝓽 𝓲𝓼 𝓰𝓲𝓿𝓮𝓷 𝓾𝓼.” ~ 𝓖𝓪𝓷𝓭𝓪𝓵𝓯 𝓽𝓱𝓮 𝓖𝓻𝓮𝔂

Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-151572
Share on other sites

  • 1 month later...
  • Active Member
On 8/4/2022 at 6:17 PM, Ulthar said:

Thanks! ^^
Do we need to create the python part for ourselves? ?

@ ASIKOO #honorablefordistraught

As far as I understand, to change the download area, you need to change the fFar value from the file PythonApplication.cpp (it is necessary to implement the possibility of changing this value from the settings inside the game)
This can be done by following the example of fNear (MIN_FOG)

  • Good 1
Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-152513
Share on other sites

  • Honorable Member

You just need to modify the return value of CArea::GetMaxLoadingDistanceSqr function, that's why I put this into a seperated function so it's easy to implement a slider.

For example interpolate between pfStart and pfFarClip. Just add a new option to CPythonSystem and a slider in python which sets its value and you can use the value of the sliderbar as it is (0.0-1.0).

float CArea::GetMaxLoadingDistanceSqr() const
{
	int peNum;
	float pfStart, pfEnd, pfFarClip;
	CPythonBackground::instance().GetDistanceSetInfo(&peNum, &pfStart, &pfEnd, &pfFarClip);

	// you need to get your value for exmaple from CPythonSystem or from whenever you want
	float fRatio = CPythonSystem::instance().GetLoadingDistance();

	// use one of the interpolation functions i provided
	return LinearInterpolation(pfStart * pfStart, pfFarClip * pfFarClip, fRatio);
}

 

Edited by Distraught
  • Love 3

992404397646696589.png
Former C++ Developer at Gameloft on DML
Join my Discord: Distraught Labs

Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-152554
Share on other sites

  • 1 month later...
  • 4 months later...
  • 1 month later...
On 4/16/2023 at 7:00 PM, Gurgarath said:

update your sources

i have same problem, but for dump_proto when i try to compile it!

error C2146: syntax error : missing ';' before identifier 'T'
_src\client\gamelib\../eterBase/Utils.h(223): error C2146: syntax error : missing ';' before identifier 'LinearInterpolation'
_src\client\gamelib\../eterBase/Utils.h(223): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
_src\client\gamelib\../eterBase/Utils.h(223): error C2143: syntax error : missing ',' before '&'
_src\client\gamelib\../eterBase/Utils.h(226): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
_src\client\gamelib\../eterBase/Utils.h(229): error C2146: syntax error : missing ';' before identifier 'T'
src\client\gamelib\../eterBase/Utils.h(229): error C2146: syntax error : missing ';' before identifier 'HermiteInterpolation'
_src\client\gamelib\../eterBase/Utils.h(229): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
_src\client\gamelib\../eterBase/Utils.h(229): error C2143: syntax error : missing ',' before '&'
_src\client\gamelib\../eterBase/Utils.h(234): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

 

 

Utils.h

#include "../UserInterface/Locale_inc.h"
#ifdef ENABLE_MAP_OBJECT_OPTIMIZATION
template<typename T>
constexpr T LinearInterpolation(const T& tMin, const T& tMax, float fRatio)
{
    return T((1.0f - fRatio) * tMin + fRatio * tMax);
}

template<typename T>
constexpr T HermiteInterpolation(const T& tMin, const T& tMax, float fRatio)
{
    fRatio = MINMAX(0.0f, fRatio, 1.0f);
    fRatio = fRatio * fRatio * (3.0f - 2.0f * fRatio);
    return LinearInterpolation(tMin, tMax, fRatio);
}
#endif

Edited by Hornet
Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-157782
Share on other sites

  • Forum Moderator
21 hours ago, Hornet said:

i have same problem, but for dump_proto when i try to compile it!

error C2146: syntax error : missing ';' before identifier 'T'
_src\client\gamelib\../eterBase/Utils.h(223): error C2146: syntax error : missing ';' before identifier 'LinearInterpolation'
_src\client\gamelib\../eterBase/Utils.h(223): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
_src\client\gamelib\../eterBase/Utils.h(223): error C2143: syntax error : missing ',' before '&'
_src\client\gamelib\../eterBase/Utils.h(226): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
_src\client\gamelib\../eterBase/Utils.h(229): error C2146: syntax error : missing ';' before identifier 'T'
src\client\gamelib\../eterBase/Utils.h(229): error C2146: syntax error : missing ';' before identifier 'HermiteInterpolation'
_src\client\gamelib\../eterBase/Utils.h(229): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
_src\client\gamelib\../eterBase/Utils.h(229): error C2143: syntax error : missing ',' before '&'
_src\client\gamelib\../eterBase/Utils.h(234): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

 

 

Utils.h

#include "../UserInterface/Locale_inc.h"
#ifdef ENABLE_MAP_OBJECT_OPTIMIZATION
template<typename T>
constexpr T LinearInterpolation(const T& tMin, const T& tMax, float fRatio)
{
    return T((1.0f - fRatio) * tMin + fRatio * tMax);
}

template<typename T>
constexpr T HermiteInterpolation(const T& tMin, const T& tMax, float fRatio)
{
    fRatio = MINMAX(0.0f, fRatio, 1.0f);
    fRatio = fRatio * fRatio * (3.0f - 2.0f * fRatio);
    return LinearInterpolation(tMin, tMax, fRatio);
}
#endif

You quoted the solution to tell me the problem. Update your sources, simple as, use C++14/17>

Gurgarath
coming soon
My Services

Link to comment
https://metin2.dev/topic/29399-carea-loading-optimization/#findComment-157801
Share on other sites

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.