Contributor Amun 2150 Posted October 17, 2022 Contributor Share Posted October 17, 2022 (edited) The client is freezing for a while(anywhere from a few ms to multiple seconds for slower PCs) when meeting a new NPC/enemy for the first time because that's when it registers, creates and loads the entity. Note: This is only a partial fix. Why is it partial? Because it only loads the static mobs and NPCs available in the map(npc, regen, boss, group and group_group), so it won't fix the problem for dynamic entities, like pets and mounts. It can be extended to load those as well, of course, but you'll have to take care of that on your own. Variant: A way of completely fixing this would be to create the instances and load their files after registering the path(in root->playerSettingModule->LoadGameNPC), BUT that would slow down the initial loading quite a bit, since it'll load ALL mobs/npcs/pets/mounts, even if most of them will never be used. There's advantages and drawbacks to both methods. Choose for yourself. Here's the link: [or] This is the hidden content, please Sign In or Sign Up [or] This is the hidden content, please Sign In or Sign Up Good luck! - Amun Edit: Spoiler PS: Fuck off - NO SUPPORT. PSS: Another reason why the client is freezing is because of granular loading of maps. Implement the first step of @ masodikbela experimental full terrain render and you'll get rid of that as well. Here's the link(Show some love while you're there): UPDATE 08/12/2022: 1. Refactored to use unordered_set from the beginning instead of creating a vector, then filtering unique entities by creating a set, and then moving them back to a vector. 2. Extended to load the full spectrum of entities(both static and dynamic), except for PC(which are loaded in loading phase), WARP, GOTO, and DOOR. They can be included by altering this block in char_manager.cpp: #ifdef ENABLE_ENTITY_PRELOADING //@Amun: or be specific, like if(ch->ispet, mount, whatever) if (!ch->IsPC() && !ch->IsGoto() && !ch->IsWarp() && !ch->IsDoor()) SECTREE_MANAGER::Instance().ExtendPreloadedEntitiesMap(lMapIndex, pkMob->m_table.dwVnum); #endif Edited December 8, 2022 by Amun Updated the code/amended some details. 245 1 3 2 5 2 57 4 120 Link to comment Share on other sites More sharing options...
Artvr3 19 Posted October 18, 2022 Share Posted October 18, 2022 Thank you @ Amun for sharing with the community every optimization option is useful 1 Link to comment Share on other sites More sharing options...
Active Member Helia01 2404 Posted October 18, 2022 Active Member Share Posted October 18, 2022 ty 1 Link to comment Share on other sites More sharing options...
Honorable Member Tatsumaru 5727 Posted October 18, 2022 Honorable Member Share Posted October 18, 2022 (edited) Edited October 18, 2022 by Metin2 Dev Core X - External 2 Internal 5 1 2 Link to comment Share on other sites More sharing options...
Contributor Amun 2150 Posted December 8, 2022 Author Contributor Share Posted December 8, 2022 Topic/code updated. Apologies for the bump. 1 Link to comment Share on other sites More sharing options...
Euzebiusz 0 Posted December 8, 2022 Share Posted December 8, 2022 Can you make a recording of what the situation looks like before adding the code and what the situation looks like after adding the code? Link to comment Share on other sites More sharing options...
Contributor Amun 2150 Posted December 8, 2022 Author Contributor Share Posted December 8, 2022 19 minutes ago, Euzebiusz said: Can you make a recording of what the situation looks like before adding the code and what the situation looks like after adding the code? no Link to comment Share on other sites More sharing options...
Forum Moderator Gurgarath 2904 Posted December 8, 2022 Forum Moderator Share Posted December 8, 2022 1 hour ago, Euzebiusz said: Can you make a recording of what the situation looks like before adding the code and what the situation looks like after adding the code? Before: Consistent stuttering upon meeting an unloaded entity or walking through the map After: Minimal to no stuttering upon loading a chunk of the map Gurgarath coming soon Link to comment Share on other sites More sharing options...
Premium Dr3Ame3r 33 Posted February 26, 2023 Premium Share Posted February 26, 2023 Tested, it works, but, with a slight little problem, after the loading phase ends (the loadingscreen photos disappear) and it should popup your character, it freezes for about 0.7-1s until it shows entities near you(that happens only 1 time for each client) Link to comment Share on other sites More sharing options...
Contributor Amun 2150 Posted February 27, 2023 Author Contributor Share Posted February 27, 2023 On 2/26/2023 at 10:08 AM, Dr3Ame3r said: Tested, it works, but, with a slight little problem, after the loading phase ends (the loadingscreen photos disappear) and it should popup your character, it freezes for about 0.7-1s until it shows entities near you(that happens only 1 time for each client) Yes, and I said that in the readme. If you want to avoid that, load npclist ahead of time and send the entities before the game world is shown. I didn't bother to make that as well because I wanted to keep it simple, so that everyone(or most people) can understand what's going on. If you consider that to be a big problem and have the knowledge to do what I said earlier, you can do it and post it here, so that everyone can use. Unfortunately, I'm extremely busy at the moment, so I won't be able to work on community stuff for a while. Cheers! - Amun Link to comment Share on other sites More sharing options...
Viello 78 Posted March 11, 2023 Share Posted March 11, 2023 I had some teleport issues, sometimes client crashes, no syserr maybe this code is not perfect for my files, btw thanks for sharing with community. Link to comment Share on other sites More sharing options...
Active Member Vaynz 2119 Posted March 11, 2023 Active Member Share Posted March 11, 2023 1 hour ago, Viello said: I had some teleport issues, sometimes client crashes, no syserr maybe this code is not perfect for my files, btw thanks for sharing with community. I assure you the code is great coded, i tested it over 2 weeks and i dont had any problems with my testers, be sure you didn't messed up something or cause is from another system or bad code. As an advice try to have permanently debugging maybe you will find the problem. Good luck ! 1 Link to comment Share on other sites More sharing options...
gleskpem1 4 Posted May 5, 2023 Share Posted May 5, 2023 (edited) Spoiler 0505 21:47:51889 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:51910 :: Failed to preload race 192 0505 21:47:52341 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:52341 :: Failed to preload race 191 0505 21:47:52489 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:52489 :: Failed to preload race 111 0505 21:47:52646 :: CRaceManager::GetRaceDataPointer: cannot load data by dwRaceIndex 20025 0505 21:47:52646 :: CPythonCharacterManager::CreateInstance VID[20025] Race[20025] 0505 21:47:52646 :: Failed to preload race 20025 0505 21:47:53121 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:53121 :: Failed to preload race 144 0505 21:47:53556 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:53556 :: Failed to preload race 151 0505 21:47:53556 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:53556 :: Failed to preload race 154 0505 21:47:53775 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:53775 :: Failed to preload race 153 0505 21:47:53777 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:53777 :: Failed to preload race 184 0505 21:47:54086 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54086 :: Failed to preload race 152 0505 21:47:54099 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54099 :: Failed to preload race 194 0505 21:47:54134 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54134 :: Failed to preload race 176 0505 21:47:54261 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54261 :: Failed to preload race 182 0505 21:47:54366 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54366 :: Failed to preload race 155 0505 21:47:54435 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54435 :: Failed to preload race 193 0505 21:47:54435 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54435 :: Failed to preload race 142 0505 21:47:54435 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54435 :: Failed to preload race 183 0505 21:47:54702 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54702 :: Failed to preload race 179 0505 21:47:54703 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54703 :: Failed to preload race 180 0505 21:47:54926 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:54926 :: Failed to preload race 110 0505 21:47:55025 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST 0505 21:47:55025 :: Failed to preload race 112 0505 21:47:55025 :: CPythonCharacterManager::CreateInstance: VID[0] - ALREADY EXIST i see this when i move randomly is it a problem or what does it mean? Edited May 5, 2023 by gleskpem1 d Link to comment Share on other sites More sharing options...
Active+ Member Koray 2283 Posted July 12 Active+ Member Share Posted July 12 (edited) I would like to provide feedback based on my experience from a few months ago. On some maps with many entities (like metin farm maps), there is an issue where the screen stays black for 3-4 seconds at the map loading phase. The recorded instances are transferred from the server as race numbers, but the client uses VID within the This is the hidden content, please Sign In or Sign Up . If that VID has been used before or will be used later to save an entity, it throws the error "CPythonCharacterManager::CreateInstance: VID[%d] - ALREADY EXIST," and most of the new entitys becomes invisible on the client. Additionally, on maps with a high number of entities, during the startup phase, there is sometimes an "unknown packet header" error. I haven't fully understood the cause of this, but it is likely that "pack.count = s.size();" just probably returns a value +1 or is not properly cast, causing it to reset when reaching the uint16_t limit. Edited July 12 by Koray 41 4 5 Link to comment Share on other sites More sharing options...
Contributor Amun 2150 Posted July 12 Author Contributor Share Posted July 12 4 minutes ago, Koray said: I would like to provide feedback based on my experience from a few months ago. On some maps with many entities (like metin farm maps), there is an issue where the screen stays black for 3-4 seconds at the map loading phase. The recorded instances are transferred from the server as race numbers, but the client uses VID within the This is the hidden content, please Sign In or Sign Up . If that VID has been used before or will be used later to save an entity, it throws the error "CPythonCharacterManager::CreateInstance: VID[%d] - ALREADY EXIST," and most of the new entitys becomes invisible on the client. Additionally, on maps with a high number of entities, during the startup phase, there is sometimes an "unknown packet header" error. I haven't fully understood the cause of this, but it is likely that "pack.count = s.size();" just probably returns a value +1 or is not properly cast, causing it to reset when reaching the uint16_t limit. Thanks for sharing, but I have a few things to point out on this The black screen: You weren't supposed to load them in the game phase. I've only done it this way to keep it simple and for everyone to know where to find the code and do the initial changes. You were supposed to load them in the loading phase, along with all the other things. VID Already exist: Don't know what to say about this one right now, but I'll have a look at it when I got some free time(which probably won't be very soon..) As for the last problem, it's unlikely that you'll ever hit the upper limit of uint16_t. There's space for 65k races, you wouldn't hit it even if you sent the entire mob list * 20, so I tend to think your problem is coming from some other place. 1 Link to comment Share on other sites More sharing options...
Recommended Posts