xranzei 1
xranzei
zendor2 1
zendor2
Bvural41 1
Bvural41
noisiv 1
noisiv
Manwe Work 1
Manwe Work
Almira2 1
Almira2
romegames 1
romegames
D 1
delimuratt
melankolıa18 1
melankolıa18
shrpnl 1
shrpnl
Fethi Polat 1
Fethi Polat
kralhakan2009 1
kralhakan2009
Hikaye Ekle
Reklam vermek için turkmmo@gmail.com

Server Paket Optimizasyonu ComputePoint Deneysel

  • Konuyu başlatan Konuyu başlatan [C]Martin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 102
  • Görüntüleme Görüntüleme 19K
5.00 yıldız(lar) 4 Değerlendirme Değerlendirenler

ROHAN2 WORLD 1-120 TR TİPİ OFFICIAL YOHARA, BALATHOR VE AMON! 80. GÜNÜNDE! +10.000 ONLİNE! HİLE VE BOT %100 ENGELLİ HEMEN TIKLA!

evet ama birkaç yeri daha düzenledim diye hatırlıyorum. uzun zaman önce yaptığım birşeydi. bir önceki yorumumdaki deneyi yaparsan görürsün.
ha şöyle birşey var evet server 2000+(teorik sayı daha fazla ama beynim milyon hesaplayamayacağım) mob karakteri kaldırabiliyor rahatça ama bu sefer client patlıyor :) oyunun diğer bölgelerinde problem yok ama 2000+ mobun/characterin yanında olunca client çöküyor :) Muhtemelen çok fazla paket alışverişi yaptığı için tabi bunlar çok ekstrem durumlar.

neden sürekli mob/character diyorum çünkü source tabanında ikisi aynı şey. ikiside character clasından oluşuyor.

Bunu yapacaksan eğer ileride başına ağrıtacak bir kaç şey var örneğin mysql tablolarda vnum alanları int örneğin item tablosunda ki id sütunun max int değerine daha çabuk yaklaşabilir.
yok yapmayacağım sadece sordum clientteki kasmada TextTail den
 
teşekkürler elinize sağlık
 
Update Final paket boyutu tamamen düşürüldü maksimum 100 baytın üstüne çıkmıyor artık :

C++:
typedef struct character_point_instant
{
    long            points[POINT_MAX_NUM];
    long            points_computepoint[POINT_MAX_NUM];//Fixed_[C]Martin_001

//--------------------------------------------------------


void CHARACTER::ComputePoints()
{
    compute_point_status = true;//Fixed_[C]Martin_001
    memcpy(m_pointsInstant.points_computepoint, m_pointsInstant.points, sizeof(m_pointsInstant.points));//Fixed_[C]Martin_001

    long comp_hp = GetHP();//Fixed_[C]Martin_001
    long comp_max_hp = GetMaxHP();//Fixed_[C]Martin_001
    long comp_sp = GetSP();//Fixed_[C]Martin_001
    long comp_max_sp = GetMaxSP();//Fixed_[C]Martin_001
    long comp_stamina = GetStamina();//Fixed_[C]Martin_001
    long comp_max_stamina = GetMaxStamina();//Fixed_[C]Martin_001

    long lStat = GetPoint(POINT_STAT);
    long lStatResetCount = GetPoint(POINT_STAT_RESET_COUNT);
    long lSkillActive = GetPoint(POINT_SKILL);
    long lSkillSub = GetPoint(POINT_SUB_SKILL);
    long lSkillHorse = GetPoint(POINT_HORSE_SKILL);
    long lLevelStep = GetPoint(POINT_LEVEL_STEP);

    long lAttackerBonus = GetPoint(POINT_PARTY_ATTACKER_BONUS);
    long lTankerBonus = GetPoint(POINT_PARTY_TANKER_BONUS);
    long lBufferBonus = GetPoint(POINT_PARTY_BUFFER_BONUS);
    long lSkillMasterBonus = GetPoint(POINT_PARTY_SKILL_MASTER_BONUS);
    long lHasteBonus = GetPoint(POINT_PARTY_HASTE_BONUS);
    long lDefenderBonus = GetPoint(POINT_PARTY_DEFENDER_BONUS);

    long lHPRecovery = GetPoint(POINT_HP_RECOVERY);
    long lSPRecovery = GetPoint(POINT_SP_RECOVERY);

    memset(m_pointsInstant.points, 0, sizeof(m_pointsInstant.points));
    BuffOnAttr_ClearAll();
    m_SkillDamageBonus.clear();

    SetPoint(POINT_STAT, lStat);
    SetPoint(POINT_SKILL, lSkillActive);
    SetPoint(POINT_SUB_SKILL, lSkillSub);
    SetPoint(POINT_HORSE_SKILL, lSkillHorse);
    SetPoint(POINT_LEVEL_STEP, lLevelStep);
    SetPoint(POINT_STAT_RESET_COUNT, lStatResetCount);

    SetPoint(POINT_ST, GetRealPoint(POINT_ST));
    SetPoint(POINT_HT, GetRealPoint(POINT_HT));
    SetPoint(POINT_DX, GetRealPoint(POINT_DX));
    SetPoint(POINT_IQ, GetRealPoint(POINT_IQ));

    SetPart(PART_MAIN, GetOriginalPart(PART_MAIN));
    SetPart(PART_WEAPON, GetOriginalPart(PART_WEAPON));
    SetPart(PART_HEAD, GetOriginalPart(PART_HEAD));
    SetPart(PART_HAIR, GetOriginalPart(PART_HAIR));

#ifdef ENABLE_ACCE_SYSTEM
    SetPart(PART_ACCE, GetOriginalPart(PART_ACCE));
#endif

    SetPoint(POINT_PARTY_ATTACKER_BONUS, lAttackerBonus);
    SetPoint(POINT_PARTY_TANKER_BONUS, lTankerBonus);
    SetPoint(POINT_PARTY_BUFFER_BONUS, lBufferBonus);
    SetPoint(POINT_PARTY_SKILL_MASTER_BONUS, lSkillMasterBonus);
    SetPoint(POINT_PARTY_HASTE_BONUS, lHasteBonus);
    SetPoint(POINT_PARTY_DEFENDER_BONUS, lDefenderBonus);

    SetPoint(POINT_HP_RECOVERY, lHPRecovery);
    SetPoint(POINT_SP_RECOVERY, lSPRecovery);

    // PC_BANG_ITEM_ADD
    SetPoint(POINT_PC_BANG_EXP_BONUS, 0);
    SetPoint(POINT_PC_BANG_DROP_BONUS, 0);
    // END_PC_BANG_ITEM_ADD

    int iMaxHP, iMaxSP;
    int iMaxStamina;

    if (IsPC())
    {
        iMaxHP = JobInitialPoints[GetJob()].max_hp + m_points.iRandomHP + GetPoint(POINT_HT) * JobInitialPoints[GetJob()].hp_per_ht;
        iMaxSP = JobInitialPoints[GetJob()].max_sp + m_points.iRandomSP + GetPoint(POINT_IQ) * JobInitialPoints[GetJob()].sp_per_iq;
        iMaxStamina = JobInitialPoints[GetJob()].max_stamina + GetPoint(POINT_HT) * JobInitialPoints[GetJob()].stamina_per_con;

        {
            CSkillProto* pkSk = CSkillManager::instance().Get(SKILL_ADD_HP);

            if (NULL != pkSk)
            {
                pkSk->SetPointVar("k", 1.0f * GetSkillPower(SKILL_ADD_HP) / 100.0f);

                iMaxHP += static_cast<int>(pkSk->kPointPoly.Eval());
            }
        }

        SetPoint(POINT_MOV_SPEED,    100);
        SetPoint(POINT_ATT_SPEED,    100);
        PointChange(POINT_ATT_SPEED, GetPoint(POINT_PARTY_HASTE_BONUS), false, false, compute_point_status);//Fixed_[C]Martin_001
        SetPoint(POINT_CASTING_SPEED,    100);
    }
    else
    {
        iMaxHP = m_pkMobData->m_table.dwMaxHP;
        iMaxSP = 0;
        iMaxStamina = 0;

        SetPoint(POINT_ATT_SPEED, m_pkMobData->m_table.sAttackSpeed);
        SetPoint(POINT_MOV_SPEED, m_pkMobData->m_table.sMovingSpeed);
        SetPoint(POINT_CASTING_SPEED, m_pkMobData->m_table.sAttackSpeed);
    }

    if (IsPC())
    {
        if (GetMountVnum())
        {
            if (GetHorseST() > GetPoint(POINT_ST))
                PointChange(POINT_ST, GetHorseST() - GetPoint(POINT_ST), false, false, compute_point_status);//Fixed_[C]Martin_001

            if (GetHorseDX() > GetPoint(POINT_DX))
                PointChange(POINT_DX, GetHorseDX() - GetPoint(POINT_DX), false, false, compute_point_status);//Fixed_[C]Martin_001

            if (GetHorseHT() > GetPoint(POINT_HT))
                PointChange(POINT_HT, GetHorseHT() - GetPoint(POINT_HT), false, false, compute_point_status);//Fixed_[C]Martin_001

            if (GetHorseIQ() > GetPoint(POINT_IQ))
                PointChange(POINT_IQ, GetHorseIQ() - GetPoint(POINT_IQ), false, false, compute_point_status);//Fixed_[C]Martin_001
        }

    }

    ComputeBattlePoints(compute_point_status);//Fixed_[C]Martin_001

    if (iMaxHP != GetMaxHP())
    {
        SetRealPoint(POINT_MAX_HP, iMaxHP);
    }

    PointChange(POINT_MAX_HP, 0, false, false, compute_point_status);//Fixed_[C]Martin_001

    if (iMaxSP != GetMaxSP())
    {
        SetRealPoint(POINT_MAX_SP, iMaxSP);
    }

    PointChange(POINT_MAX_SP, 0, false, false, compute_point_status);//Fixed_[C]Martin_001

    SetMaxStamina(iMaxStamina);
    // @fixme118 part1
    int iCurHP = this->GetHP();
    int iCurSP = this->GetSP();

    m_pointsInstant.dwImmuneFlag = 0;

    for (int i = 0 ; i < WEAR_MAX_NUM; i++)
    {
        LPITEM pItem = GetWear(i);
        if (pItem)
        {
            pItem->ModifyPoints(true, compute_point_status);//Fixed_[C]Martin_001
            SET_BIT(m_pointsInstant.dwImmuneFlag, GetWear(i)->GetImmuneFlag());
        }
    }

    if (DragonSoul_IsDeckActivated())
    {
        for (int i = WEAR_MAX_NUM + DS_SLOT_MAX * DragonSoul_GetActiveDeck();
            i < WEAR_MAX_NUM + DS_SLOT_MAX * (DragonSoul_GetActiveDeck() + 1); i++)
        {
            LPITEM pItem = GetWear(i);
            if (pItem)
            {
                if (DSManager::instance().IsTimeLeftDragonSoul(pItem))
                    pItem->ModifyPoints(true,compute_point_status);//Fixed_[C]Martin_001
            }
        }
    }

    if (GetHP() > GetMaxHP())
        PointChange(POINT_HP, GetMaxHP() - GetHP(), false, false, compute_point_status);//Fixed_[C]Martin_001

    if (GetSP() > GetMaxSP())
        PointChange(POINT_SP, GetMaxSP() - GetSP(), false, false, compute_point_status);//Fixed_[C]Martin_001

    ComputeSkillPoints();

    RefreshAffect(compute_point_status);//Fixed_[C]Martin_001

    CPetSystem * pPetSystem = GetPetSystem();
    if (NULL != pPetSystem)
        pPetSystem->RefreshBuff(compute_point_status);//Fixed_[C]Martin_001

    // @fixme118 part2 (after petsystem stuff)
    if (IsPC())
    {
        if (this->GetHP() != iCurHP)
            this->PointChange(POINT_HP, iCurHP-this->GetHP(), false, false, compute_point_status);//Fixed_[C]Martin_001
        if (this->GetSP() != iCurSP)
            this->PointChange(POINT_SP, iCurSP-this->GetSP(), false, false, compute_point_status);//Fixed_[C]Martin_001
    }

    compute_point_status = false;//Fixed_[C]Martin_001

    if (GetDesc())//Fixed_[C]Martin_001
    {
        BYTE send_count = 0;
        auto it = compute_point_list.begin();
        for (; it != compute_point_list.end(); it++)
        {
            if (m_pointsInstant.points_computepoint[it->type] == m_pointsInstant.points[it->type] && m_pointsInstant.points[it->type] == it->val)
                continue;

            if (it->type == POINT_MAX_HP && comp_max_hp == it->val
                || it->type == POINT_HP && comp_hp == it->val
                )
            {
                continue;
            }

            if (it->type == POINT_MAX_SP && comp_max_sp == it->val
                || it->type == POINT_SP && comp_sp == it->val
                )
            {
                continue;
            }

            if (it->type == POINT_MAX_STAMINA && comp_max_stamina == it->val
                || it->type == POINT_STAMINA && comp_stamina == it->val
                )
            {
                continue;
            }
            send_count++;
        }

        if (send_count == 1)
        {
            auto it = compute_point_list.begin();
            for (; it != compute_point_list.end(); it++)
            {
                if (m_pointsInstant.points_computepoint[it->type] == m_pointsInstant.points[it->type] && m_pointsInstant.points[it->type] == it->val)
                    continue;

                if (it->type == POINT_MAX_HP && comp_max_hp == it->val
                    || it->type == POINT_HP && comp_hp == it->val
                    )
                {
                    continue;
                }

                if (it->type == POINT_MAX_SP && comp_max_sp == it->val
                    || it->type == POINT_SP && comp_sp == it->val
                    )
                {
                    continue;
                }

                if (it->type == POINT_MAX_STAMINA && comp_max_stamina == it->val
                    || it->type == POINT_STAMINA && comp_stamina == it->val
                    )
                {
                    continue;
                }

                struct packet_point_change pack;

                pack.header = HEADER_GC_CHARACTER_POINT_CHANGE;
                pack.dwVID = m_vid;
                pack.type = it->type;
                pack.value = it->val;

                pack.amount = it->amount;

                GetDesc()->Packet(&pack, sizeof(struct packet_point_change));
            }
        }
        else
        {
            if (send_count > 1)
            {
                TPacketGCPointChangeDynamic pack;

                pack.header = HEADER_GC_CHARACTER_POINT_CHANGE_DYNAMIC;
                pack.dwVID = m_vid;
                pack.count = send_count;

                TEMP_BUFFER buf;
                buf.write(&pack, sizeof(TPacketGCPointChangeDynamic));

                auto it = compute_point_list.begin();
                for (; it != compute_point_list.end(); it++)
                {
                    if (m_pointsInstant.points_computepoint[it->type] == m_pointsInstant.points[it->type] && m_pointsInstant.points[it->type] == it->val)
                        continue;

                    if (it->type == POINT_MAX_HP && comp_max_hp == it->val
                        || it->type == POINT_HP && comp_hp == it->val
                        )
                    {
                        continue;
                    }

                    if (it->type == POINT_MAX_SP && comp_max_sp == it->val
                        || it->type == POINT_SP && comp_sp == it->val
                        )
                    {
                        continue;
                    }

                    if (it->type == POINT_MAX_STAMINA && comp_max_stamina == it->val
                        || it->type == POINT_STAMINA && comp_stamina == it->val
                        )
                    {
                        continue;
                    }

                    TPacketGCPointChangeDynamicVal pack_val;
                    pack_val.type = it->type;
                    pack_val.value = it->val;

                    pack_val.amount = it->amount;

                    buf.write(&pack_val, sizeof(TPacketGCPointChangeDynamicVal));
                }

                GetDesc()->Packet(buf.read_peek(), buf.size());
            }
        }
    }//Fixed_[C]Martin_001

    compute_point_list.clear();//Fixed_[C]Martin_001
    compute_point_list.shrink_to_fit();//Fixed_[C]Martin_001

    UpdatePacket();

    memset(m_pointsInstant.points_computepoint, 0, sizeof(m_pointsInstant.points_computepoint));//Fixed_[C]Martin_001
}
 
Teşekkürler, Şu büyülü silah sura büyü çözme attığında oluşan lag için bir çözüm var mı, Forumda bir kaç konu mevcut ancak buglu çözümler.
 
Teşekkürler, Şu büyülü silah sura büyü çözme attığında oluşan lag için bir çözüm var mı, Forumda bir kaç konu mevcut ancak buglu çözümler.
o sorunda bu tarz bir çözümle düzeliyor cliente gönderilen paketlerin optimize edilmesiyle forumdakilere biraz düzenleme gerekebiliyor
 

Şu an konuyu görüntüleyenler (Toplam : 0, Üye: 0, Misafir: 0)

Geri
Üst