Jump to content
Sign in to follow this  
Speachless

Search dev for - Screen Freezing while loading players

Recommended Posts

Search fix for - Screen Freezing while loading players

A developer who is able to solve this problem can contact me in a private message. The problem is almost on any server so I think you already know. When you see a player, the screen freezes for 1 second. The more players load, the more you get screen freeze. This is not happening for mobs.

If the players have items on them and buffs the load will be slower. If they are empty chars freeze won't happen.

paid work.

  • Love 1

Share this post


Link to post

Nice

I think the function to see is:

bool CInstanceBase::Create(const SCreateData& c_rkCreateData)

 

if (IsPC())

    LAG

Share this post


Link to post
Acum 10 minute, WeedHex a spus:

bool CInstanceBase::Create(const SCreateData& c_rkCreateData)

I made a lot of changes there, but 0 visible effects.

I will look again.

  • Sad 1

Share this post


Link to post

I was working on this problem and actually found what caused it. The problem is that players have like 200+ motions. Whenever a new player appear the client has to load these motions very quickly, which causes small freezes. The problem is, that when there are no characters around you for some time, the unused files are getting deleted by the resource manager. Therefore when someone suddenly appears near to you, the client has to load those 200+ files from the hard disc which takes some time on low end PCs. (Because of the decrypting and decompressing.)

A possible solution for this (or at least what I did was) to create a cache for the motions, and load at least the motions for the playable characters at loadingscreen. (Won't release it nor sell it, but this is a good lead so you may find someone who are capable to do this.)

  • Love 4

Share this post


Link to post

Brilliand ideea. God bless you :)

fixed

In ResourceManager.cpp we have at the beginning of the file after includes statements about how long  the cache should stay valid. The value is in miliseconds, 3600000 = 1 hour. This fill fix a lot, let me tell you how:

You will teleport in map1 safezone center where are most players. Motions will load. Then you can go another map farm, and when you come back in map1, the players will load with 0 freeze, smooth without frame drops because cache motions are still saved.

  • Love 2

Share this post


Link to post

Question: why would we even want motions to be deleted? What kind of benefits do we get with that?

Just asking myself why would they make it work like that

Share this post


Link to post
18 minutes ago, Sonitex said:

Question: why would we even want motions to be deleted? What kind of benefits do we get with that?

Just asking myself why would they make it work like that

Performance ofc ! Keep in mind that the game was developed back in 2004 - 5 and hardwares were kinda slow compared to average pc nowadays. 

  • Love 1

Share this post


Link to post
12 hours ago, Sonitex said:

Question: why would we even want motions to be deleted? What kind of benefits do we get with that?

Just asking myself why would they make it work like that

Thats not that simple. There is a big black questionmark called resource manager. Its job is to load files from the hard disk to the memory when requested. It has some features, one of them is this reference stuff. It works like: okay, introLogin.py says that it needs a.jpg. The a.jpg is not loaded yet, so resource manager will load it. After that a.jpg's reference count will be 1. Okay, we close the intrologin.py, because we logged in to the character select. (Lets assume here that the intrologin.py has been made by someone competent and it doesn't have memory leaks, so it destroys itself correctly after closing it... I'm planning to write a huge topic about python windows because its very disappointing that there are like almost 0 devs who can write non leaking correct python window code, and not sure if anyone ever noticed this mentioned problem before... but thats for another day so lets stick to our current topic).

So now the reference count of a.jpg will be 0, so nothing uses it right now. Our resource manager is smart and 200 iq and probably made by someone who can see sharp, so it has garbage collector like stuff, so after about 30 seconds it will say: well, fck this, nobody is interested in this shitty jpg, lets delete it. Then we suddenly realize, that we need our other account, (yeah now it took us 30 seconds to realize because accidentally our cat came into the room and we had to pet him) so we log out to the intrologin again. You can guess what will happen... it will need a.jpg, then the resource manager will see that yeah a.jpg is not loaded, it will load a.jpg, and raise its reference count to 1.

Same goes to all files, for example our font's reference count will be probably the highest, around 200 or more depending how much textline instances we have. Resource manager have other secrets ofc, for example there was a try to make it multi threaded, or at least they tried to make it run on a different thread, but originally its disabled, not sure why (maybe because of old PCs, maybe because it was broken, idk, I tried it out everything was fine for me, but didn't noticed any difference, maybe it could use some more investigation).

This whole thing should be reviewed and refactored if needed. I would maybe do something like: load everything we would probably need on the current map, and keep it. Then if we meet something thats not loaded load it and keep it too, because its likely that we will meet with it again. Then just delete everything if we quit from the gamephase (so we warp/change character/account).

Yeah so to answer your question: probably to save memory, but even so I don't think this worths all the trouble, especially nowadays.

  • Love 2

Share this post


Link to post

Thanks for the answers, I guess it did make sense back in 2004.

Share this post


Link to post

Search

PyObject * chrmgrRegisterMotionData(PyObject* poSelf, PyObject* poArgs)

Under

CGraphicThing* pkMotionThing = pRaceData->RegisterMotionData(iMode, iMotion, c_szFullFileName, iWeight);

Add

	if (pkMotionThing)
	{
		CResourceManager::Instance().LoadStaticCache(pkMotionThing->GetFileName());
		//TraceError(pkMotionThing->GetFileName());
	}

What it will load:

https://i.gyazo.com/08d6e5508e264e92935a0293071b46a5.mp4

This will make players to load faster from the first login into game. Way less fps drops, the game works much better.

I opened a topic on guides 

where we can improve this fix. 

  • Love 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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.