Jump to content

Distraught

Honorable Member
  • Posts

    194
  • Joined

  • Last visited

  • Days Won

    23
  • Feedback

    0%

Everything posted by Distraught

  1. In that case this would be the smallest problem. But just for the code design we can fairly afford to skip updating the effects in that frame. I edited the code.
  2. Our mapper made a map with really-really a lot of effects on it. Some of our testers mentioned that the game started to lag for them on that map so much. I checked it in debug mode and actually the FPS dropped to actually 0. I started to profile the game what could be the bottleneck and so that I found the effects. When the game is dealing with effects for maps most of the time went in CMapOutdoor::RenderEffect. In this function it calls RenderEffects for each Area around you (that is 9 normally if you're not on some edge area). In the Area's render effect somewhy they did the effect update (but why?) and that took the most of time. We didn't wanna make the map less beautiful so I fixed it in the code. Now the game only updates and renders effects that are around your character and are not in the fog zone. With this we brought back our FPS to normal and we can have maps with a lot of effects too. First, open EffectLib/EffectInstance.h and add this to CEffectInstance class: const D3DXMATRIX& GetGlobalMatrix() const { return m_matGlobal; }; Now go to GameLib/Area.cpp and add these to the includes #include "../UserInterface/StdAfx.h" #include "../UserInterface/PythonCharacterManager.h" #include "../UserInterface/PythonBackground.h" Now modify CArea::__UpdateEffectList function to look like this void CArea::__UpdateEffectList() { int peNum; float pfStart, pfEnd, pfFarClip; D3DXVECTOR3 chrPos; CPythonBackground::instance().GetDistanceSetInfo(&peNum, &pfStart, &pfEnd, &pfFarClip); CInstanceBase* pInst = CPythonCharacterManager::instance().GetMainInstancePtr(); if (!pInst) return; chrPos = pInst->GetGraphicThingInstanceRef().GetPosition(); CEffectManager& rkEftMgr=CEffectManager::Instance(); TEffectInstanceIterator i; for (i = m_EffectInstanceMap.begin(); i != m_EffectInstanceMap.end();) { CEffectInstance * pEffectInstance = i->second; const D3DMATRIX& gMatrix = pEffectInstance->GetGlobalMatrix(); if (pfStart < GetPixelPositionDistance(chrPos, TPixelPosition(gMatrix._41, gMatrix._42, gMatrix._43))) { pEffectInstance->Hide(); ++i; continue; } pEffectInstance->Show(); pEffectInstance->Update(); if (!pEffectInstance->isAlive()) { i = m_EffectInstanceMap.erase(i); rkEftMgr.DestroyUnsafeEffectInstance(pEffectInstance); } else { ++i; } } } Hope you guys like it and will be useful!
  3. CPythonCharacterManager has functions like CharacterInstanceBegin and CharacterInstanceEnd so you can iterate over the characters nearby like: TPixelPosition myPos; CPythonPlayer::instance().NEW_GetMainActorPosition(&myPos); CPythonCharacterManager& chrMgr = CPythonCharacterManager::instance(); for (auto it = chrMgr.CharacterInstanceBegin(); it != chrMgr.CharacterInstanceEnd(); ++it) { if (CInstanceBase* ch = *it) { TPixelPosition otherPos; ch->NEW_GetPixelPosition(&otherPos); if(GetPixelPositionDistance(myPos, otherPos) <= SOME DISTANCE && some other thing to identify your npc) { CPythonNetworkStream::Instance().SendOnClickPacket(ch->GetVirtualID()); } } }
  4. Compile your game with -g flag for debug smybols and with -O0 flag for disabling optimizations so that you can properly debug your core dump. We can only help after that.
  5. Maybe self.hpGaugeBoard is not initialized with the object so it's 0? Try to make it like if 0 != self.hpGaugeBoard: if TRUE == self.hpGaugeBoard.IsIn(): self.RefreshStatus() self.tooltipHP.Show() else: self.tooltipHP.Hide()
  6. There's a bug in the game if you have like an NPC and you set its opacity to less then 1.0 and attach effects to it and the effects are inside the model. The effect will not be rendered because the effect rendering is after character rendering so when it's stenciling it, it won't know what should be seen behind the model. To fix this we just have to pre-render the effects in this case. To achieve this add this code to the beginning of CActorInstance::OnRender if (GetAlphaValue() < 1.0f) { for (auto it = m_AttachingEffectList.begin(); it != m_AttachingEffectList.end(); ++it) { CEffectManager::Instance().SelectEffectInstance(it->dwEffectIndex); CEffectManager::Instance().RenderEffect(); } } and add a new method to CEffectManager in EffectLib/EffectManager.h: void RenderEffect(); and for sure define it in EffectManager.cpp void CEffectManager::RenderEffect() { if (!m_pSelectedEffectInstance) return; m_pSelectedEffectInstance->Render(); } Now you can create eg. mounts with effects like this: Hope you like it and will be useful!
  7. @LastSamurai23 help me a lot and recreated the model for me. Here's the result of our work The idea is from this video:
  8. Hey guys, Someone knows any contact to Keyto? I would like to buy from his webshop but cannot reach on the contacts specified on the site.
  9. Because it was so long ago I recreated this program for using at my server but I share it here too. It has some more options that I looked up from the server sources, you can zoom in or out and it distinguishes different mobs/groups/etc with different colors + you can load existing regen files and edit them too. Link and image updated in the original post.
  10. Fixed reload function and std::async launch policy. It was using std::launch::async before but to let the operating system use thread pooling (msvc implementation) it had to be std::launch::async | std::launch::deferred.
  11. I posted a solution there. Just have to add the partid of the sashes where you see switch (i) { case CRaceData::PART_WEAPON: case CRaceData::PART_WEAPON_LEFT: break; default: SetMotionPointer(m_LODControllerVector[i]); break; } and the first code snippet to where you attach the sashes.
  12. if (CGrannyLODController* pLODController = m_LODControllerVector[dwPartIndex]) { if (CGrannyModelInstance* pWeaponModelInstance = pLODController->GetModelInstance()) { CGraphicThing* pItemGraphicThing = pItemData->GetModelThing(); if (CGrannyMotion* pItemMotion = pItemGraphicThing->GetMotionPointer(0)) { pWeaponModelInstance->SetMotionPointer(pItemMotion); } } } Add the code above to the end of void CActorInstance::AttachWeapon(DWORD dwParentPartIndex, DWORD dwPartIndex, CItemData * pItemData) function in ActorInstanceAttach.cpp and ThingInstance.cpp in the function bool CGraphicThingInstance::SetMotion(DWORD dwMotionKey, float blendTime, int loopCount, float speedRatio) modify std::for_each(m_LODControllerVector.begin(), m_LODControllerVector.end(), SetMotionPointer); to for (int i = 0; i < m_LODControllerVector.size(); ++i) { switch (i) { case CRaceData::PART_WEAPON: case CRaceData::PART_WEAPON_LEFT: break; default: SetMotionPointer(m_LODControllerVector[i]); break; } } and add these to the includes #include "../GameLib/GameType.h" #include "../GameLib/RaceData.h" to make it work when the weapon is equipped.
  13. M2 Download Center Download Here ( Internal ) If you wanna bring some serialization to the networking, send floating point numbers safely between the server and the client or just don't want to define packet structures for everything this will be useful for you. We will use rapidjson library for parsing and creating json strings but don't worry I created some helper functions to make it easier. So let's start first on the server side! Add JsonPacket.cpp and h to your game project and put the content of the include folder to you include directory. Open up input.h and add the following to CInputProcessor base class: int RecvJsonPacket(LPDESC desc, const char* data, size_t uiBytes); Now go to input.cpp and add the definition: int CInputProcessor::RecvJsonPacket(LPDESC desc, const char* data, size_t uiBytes) { if (nullptr == desc || uiBytes < sizeof(TPacketJson)) { return -1; } const TPacketJson* packet = (const TPacketJson*)data; if (uiBytes < sizeof(TPacketJson) + packet->length || uiBytes > (1 << 12)) { return -1; } Json::Document json; json.Parse<rapidjson::kParseStopWhenDoneFlag>(data + sizeof(TPacketJson)); switch (json.GetParseError()) { case rapidjson::kParseErrorNone: case rapidjson::kParseErrorDocumentEmpty: break; default: sys_err("Json Parse Error (code %d)", (int)json.GetParseError()); return -1; } if (!JsonPacket::Recv(desc, (JsonPacket::Type)packet->type, json)) { return -1; } return packet->length; } Don't forget to include JsonPacket.h and json.h! Now go to input_main.cpp and find the function CInputMain::Analyze. Add this case: case HEADER_CG_JSON: if ((iExtraLen = RecvJsonPacket(d, c_pData, m_iBufferLeft)) < 0) { return -1; } break; Go to packet.h and add this structure: struct TPacketJson { uint8_t header; int32_t type; uint32_t length; }; Add them to the packet header enumerations: HEADER_CG_JSON = 170, HEADER_GC_JSON = 170, Go to packet_info.cpp and add by the others add the following in constructor of CPatcketInfoCG. Set(HEADER_CG_JSON, sizeof(TPacketJson), "Json Packet", true); Finally add JsonPacket.cpp to you Makefile too. Now let's get to the client side! Add JsonPacket.cpp and h to your UserInterface project and the content of the include folder to your include directory. Go to PythonNetworkStream.h and add the following to CPythonNetworkStream class: bool RecvJsonPacket(); Now to go to PythonNetworkStream.cpp and add the definition: bool CPythonNetworkStream::RecvJsonPacket() { TPacketJson packet; if (!Recv(sizeof(TPacketJson), &packet)) { return false; } std::vector<char> buffer(packet.length); if (!Recv(packet.length, buffer.data())) { return false; } Json::Document json; json.ParseInsitu<rapidjson::kParseStopWhenDoneFlag>(buffer.data()); switch (json.GetParseError()) { case rapidjson::kParseErrorNone: case rapidjson::kParseErrorDocumentEmpty: break; default: return false; } return JsonPacket::Recv((JsonPacket::Type)packet.type, json); } Don't forget to include JsonPacket.h and json.h! Go to PythonNetworkStreamPhaseGame.cpp and add the following case in the CPythonNetworkStream::GamePhase function: case HEADER_GC_JSON: ret = RecvJsonPacket(); return; Go to Packet.h and add the struct: struct TPacketJson { uint8_t header; int32_t type; uint32_t length; }; Add these to the packet header enumerations: HEADER_CG_JSON = 170, HEADER_GC_JSON = 170, Go to PythonNetworkStream.cpp again and add this to the CMainPacketHeaderMap constructor: Set(HEADER_GC_JSON, CNetworkPacketHeaderMap::TPacketType(sizeof(TPacketJson), DYNAMIC_SIZE_PACKET)); If you would like to send a packet, just add a new packet type to the enum and here's a sample code, it works the exact same way on server and client side: #include "JsonPacket.h" void SomeFunction() { Json::Document testPacket = Json::CreateJsonObject(); Json::SetValue(testPacket, "fieldName1", "string value"); Json::SetValue(testPacket, "fieldName2", 123); Json::SetValue(testPacket, "fieldName3", true); JsonPacket::Send(JsonPacket::Type::PACKET_TYPE_TEST, testPacket); } And here's the download link for the files: [Hidden Content] Hope you like it! Good luck!
  14. Actually I still use mysql5.7 because it has better performance than mysql8 but less security. Normally the mysql server is not reachable from the outside so security is not really the thing.
  15. For those who need it I uploaded some (I think) unmodified basic sources for client binary that will definitely work with the server binary on the vdi: [Hidden Content] You will need to have boost somewhere on your PC and adjust the path of that in Properties (img below to help). I compiled it with VS2019 (msvc142) so you should have no problem if you do so. (I made this screenshot after deleting the project and opening one of my current projects so you won't find the Tracking there)
  16. A question was deleted: someone had problems with compiling the game because he didn't compile the libs before. For that simply run gmake in /usr/src.
  17. M2 Download Center Download Here ( Internal ) Heys guys, I just realized that so many of you still using that vdi from 2014 with an old bsd and an old gcc that was not even c++11 compatible. So that I just created a new image with a fresh FreeBSD (12.1) having gcc 9 and without an Extern directory (all externals are installed from pkg repo). I put on some (I think) unmodified sources that can be compiled on it but you can upload your own files there. I hope it will make many of yours life easier! Download: [Hidden Content]
  18. Hey guys, Have anyone ever seen something like this? Alas I can't debug it because it's really random and happened just about a few times but after like a character select it goes back to normal. Any idea?
  19. As the posts of the updates were lost, now I put them in this reply. UPDATE V1.2 fixed fbx conversion in case of several meshes added option to specify flags as arguments Download: [Hidden Content] UPDATE V1.3 fixed material texture binding changed Y-up to Z-up Download: [Hidden Content]
×
×
  • 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.