服务器buff管理

关于buff和玩家自动回血buff
{
    m_StatusTimer.reset(pFT->createTimer());
    m_StatusTimer->setInterval(500);
    m_StatusTimer->regTimer(std::bind(&StatusMgr::RunOnce, this));
    m_StatusTimer->start();

    m_StatusTimer.reset(pFT->createTimer());
    m_StatusTimer->setInterval(1000);
    m_StatusTimer->regTimer(std::bind(&StatusMgr::UpdateRestore, this));
    m_StatusTimer->start();
}
这两种buff都是通过定时器实现的,现在map格子管理器中有所有玩家,每隔多长时间遍历这所有玩家,然后处理每隔玩家的buff,无非是每隔玩家的actorinfoex里面保存tick,根据tick处理相关逻辑
然后是玩家定时减血,减蓝,这个减血减蓝的多少是规定好的,然后发送状态包给客户端,现在走差异更新
对于自动回血更简单
有疑问的时在这么短的时间去遍历所有map效率是不是很低啊,然后现在发送的差异更新包,客户端怎么知道是哪个包呢

 

posted @ 2015-02-05 23:04  zzyoucan  阅读(222)  评论(0编辑  收藏  举报