Jump to content

Ikarus_

Developer
  • Posts

    399
  • Joined

  • Last visited

  • Days Won

    20
  • Feedback

    0%

Everything posted by Ikarus_

  1. Well, it would be better to adapt it rather than to remove it, since now u got again the bug about stealth skill
  2. Exclusive for Martysama's Supporters Hello Everyone! The IkarusShop V2 will have a Christmas Discount Weeks period from Dicember 21th to January 6th! The First, Second, and Third purchase of ULTIMATE version will get an extra Discount! Hurry Up! More Details here: https://martysama0134.com/Source_addons/Ikarus_Offlineshop
  3. An exclusive discount is taking place right now! All details here!
  4. It looks the map instance is collecting dangling pointers, pointers which points to deleted memory. I guess the system is destroying some character (monster i guess) without removing it from its sectree. Can't know more atm i m not at home.
  5. It's crashing while printing a string in syslog or syserr. Search this string and post the code immediately before and immediately above. "PRIVAE_MAP: removing character %s",
  6. Pre-order discount weeks officially open. if you are interested in buying contact me on discord.
  7. Post updated with important news! Pre-order discount weeks will start soon! 27 September - 10 October Pre-order prices: LITE ~~349€~~ 269€ PRO ~~549€~~ 449€ ULTIMATE ~~899€~~ 769€ The first 5 purchases of ULTIMATE will be further discounted to €699. The discounts will end on October 10th. Soon an open beta server will be active which give you way try the system before purchasing it. For each purchase it will be necessary to register an invoice, therefore the data necessary for this purpose will be requested. All installations will be carried out first for those who bought the ULTIMATE version in pre-order, then all others in order of purchase starting at 11 October. Payment methods are: - Papayl P&S - Revolut - LITE version only can be paid using Amazon.it giftcards.
  8. UPDATED THE POST WITH THE OFFICIAL OVERVIEW VIDEO OF IKASHOP V2! https://youtu.be/FxeQiEKb2f0
  9. Store the values into a set, change the for limit to 1milion and call .size on the set at the end. Surprise! The size is around 32k, so it is repeating 1milion of times the same 32k of values. So in short the problem i tried to explain in the previous answer consists in the fact the values are discrete. Are only 32k (RAND_MAX) of values, distributed in the range 0-2kkk I said 65k of values in the previous post because I thought RAND_MAX was 65k, since it is 32k the numbers are more discrete than how i thought xd
  10. Again no xd. It is still not uniform at all. Using the same test (1 milion numbers) you will see that only 65k of numbers are possible to be picked... And 0 will never be picked xd The possible numbers are the ones that comes out using this formula : n = 1 + x * 32K where x can be one random number from 0 to RAND_MAX (65k~) in short, theres a number every 32k of numbers which can be picked, in the range from 1 to 2147483647, which is very far from being a uniform distribution in a range. I guess u know that it cant be tested on onlinegdb since this issue comes out only on Windows (onlinegdb uses linux)
  11. That way u do isn't a uniform distribution. If u want see it with ur eyes try to store 1milion numbers returned by ur functions and print them sorting by count of times they were picked. Larger numbers are more frequently picked than smaller ones.
  12. please make them into a zip or, if you really want to use tag code please extract only the changes you made and the code around them.
  13. You installed it wrong, 100% xd Or you have other changes conflicting with it. It's tested, by many guys and by me, for a long time. Anyway if you wish, you can post here the changes you made and i could take a look
  14. No it is not possible. Since I didn't have time to give my best support, I preferred to close the sales and pause my service. If it happens that I have more time then I will reopen sales with new systems (the old ones will now remain closed forever)
  15. No, Once you typed bt full the last line says: Type <RET> for more, [....] So if you type <RET> it shows more
  16. A crash happening on checkpoint usually means execution fall in an infinite loop or a signal received by the kernel caused by an exception. The call inside boost make me think you got corrupted stack or heap, making execution looping in that element ordering routine or trying overwrite unaccessible memory addresses. I can't deduce more just by reading that trace. In the case you are using an old boost release, it would be a good idea to update it. EDIT --- You should type <RET> while reading the .core in order to get more trace.
  17. I guess that GetMaxHP returned 0 for some reason, and that is why it crashed. You can solve it by simply checking that GetMaxHP is different from 0 in that if. Test this fix and report if it helped you: // replace this if (GetMaxHP() >= 0) iTmpPercent = (GetHP() * 100) / GetMaxHP(); //with this if (GetMaxHP() > 0) iTmpPercent = (GetHP() * 100) / GetMaxHP();
  18. It would be helpful to post char_battle.cpp or at least what it contains at line 2530 and around.
  19. Don't forget that static variables aren't thread safe (m2 server is a single-threaded application so it is still safe). The `std::uniform_real_distribution<>` can be static only if min and max used to declare it are constant (as it is in the code i posted). Anyway moving to static storage only the two others (std::random_device, std::mt19937) still give most of the advantage in terms of execution time.
  20. I ve also found a really slow piece of code which execute a syscall on every call that can be avoided just by declaring the variables as statics. Here is the piece of code i m talking about: // Generate random probability for spawning something. std::random_device RandomDevice; std::mt19937 Generate(RandomDevice()); std::uniform_real_distribution<> Distribute(ShipDefense::MIN_PROB, ShipDefense::MAX_PROB); And here the fix i would recommend: // Generate random probability for spawning something. static std::random_device RandomDevice; static std::mt19937 Generate(RandomDevice()); static std::uniform_real_distribution<> Distribute(ShipDefense::MIN_PROB, ShipDefense::MAX_PROB); Here is a small benchmark i made to better clarify what we are talking about. As you can see, we are talking about an improvement that reduces execution time by about 100,000 times, not a small amount I would say. [Hidden Content] EDIT ----- I ve noticed right now that you got a failed check which should prevent numerical overflow but that actually it doesn't. //THIS EXPRESION RESULT TO BE ALWAYS FALSE DUE TO NUMERICAL OVERFLOW // Prevent second counter from overflowing. if (pSpawnEventInfo->uiCountSec > UINT_MAX) return 0; //CORRECT WAY OF PREVENTING NUMERICAL OVERFLOW // Prevent second counter from overflowing. if (static_cast<uint64_t>(pSpawnEventInfo->uiCountSec) + 1 > UINT_MAX) return 0;
  21. I leave here a few tips that could improve code readability, performance and safety. I also report you a serious issue that generates memory leaks. Clearly, even though there are things that I consider outdated (which I am sure you have seen in the ymir code written in the early 2000s), I still appreciate that you have released all this work for free. The Functor (struct with operator()) is a trick used in the past to work with temporary functions that can store data, in short, a very outdated "lambda". Since C++11, we can use lambdas to definitely replace Functors, which are clearer and more readable and probably much optimizable by the compiler. The serious issue I noticed is how you insert and remove data inside m_mapShipDefense. (ps. emplace is always preferable than insert) The raw use of new and delete is to be considered outdated, and really unsafe. Proof of this is the leak I am about to show. Looking on CShipDefenseManager::Remove method: void CShipDefenseManager::Remove(const DWORD c_dwLeaderPID) { ShipDefenseMap::iterator it = m_mapShipDefense.find(c_dwLeaderPID); if (it != m_mapShipDefense.end()) m_mapShipDefense.erase(it); //erased but not deleted? } and again looking on CShipDefenseManager::Destroy() method: void CShipDefenseManager::Destroy() { ShipDefenseMap::iterator it = m_mapShipDefense.begin(); for (; it != m_mapShipDefense.end(); ++it) { CShipDefense* pShipDefense = it->second; if (pShipDefense) { pShipDefense->Destroy(); //is this use safe if you check its value immediately below? if (pShipDefense) delete pShipDefense; } } m_mapShipDefense.clear(); } A good way to solve your issue would be the use of smart pointers which are much safer and do the dirty work for you. PS: Since C++98 you can use struct without encapsulating it in a typedef declaration. typedef struct SBroadcastAllianceHP { } TBroadcastAllianceHP; // can be changed to struct TBroadcastAllianceHP { }; I've only checked ShipDefense.cpp so far. If I get time, I'll check the rest ---- EDIT I think you have misunderstood the meaning of the return value of the c lua functions. You should return the number of pushed elements in the stack. Many of the functions I have seen in the code you shared have a wrong return. int ship_defense_mgr_land(lua_State* L) { const LPCHARACTER c_lpChar = CQuestManager::instance().GetCurrentCharacterPtr(); if (c_lpChar == nullptr) return 0; CShipDefenseManager& rkShipDefenseMgr = CShipDefenseManager::Instance(); rkShipDefenseMgr.Land(c_lpChar); return 1; // WRONG - NO PUSHED ELEMENTS SO WHY 1? } int ship_defense_mgr_is_created(lua_State* L) { const LPCHARACTER c_lpChar = CQuestManager::instance().GetCurrentCharacterPtr(); if (c_lpChar == nullptr) return 0; CShipDefenseManager& rkShipDefenseMgr = CShipDefenseManager::Instance(); lua_pushboolean(L, rkShipDefenseMgr.IsCreated(c_lpChar)); return 1; // CORRECT, YOU PUSHED 1 ELEMENT } ----- EDIT2 I would recommend to add some small check here to make the function skip all monsters dead outside the dungeon. This method CShipDefenseManager::OnKill get called 2 times (first inside CHARACTER::Dead, second inside CHARACTER_MANAGER::DestroyCharacter) anytime a monster die, anytime a monster die in the whole core.Not a good idea keep it loops throught `std::map` (which is really slow to get iterated) and perform the whole CShipDefense::DeadCharacter on each dungeon instance (which it again has a while loop iterating a `std::map`) method anytime a player kill a monster anywhere. All of this is preventable with a small check making the function skips 99.9% of the monsters killed/purged. bool CShipDefenseManager::OnKill(LPCHARACTER lpDeadChar, LPCHARACTER lpKillerChar) { if (lpDeadChar == nullptr) return false; if (m_mapShipDefense.empty()) return false; //TODO : Add here a check to skip 99.99% of the monsters which are not relevant in this method
×
×
  • 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.