Skip to content

Commit

Permalink
[10683] Revert "[10677] Send to creature/etc Update call real diff fr…
Browse files Browse the repository at this point in the history
…om last update and use it."

This reverts commit 10784a8.

Main reason: impossibility for me as commiter test problem and fix all corner cases problems.
  • Loading branch information
VladimirMangos committed Nov 5, 2010
1 parent d375d7d commit 5ffa34a
Show file tree
Hide file tree
Showing 35 changed files with 149 additions and 162 deletions.
22 changes: 11 additions & 11 deletions src/game/Creature.cpp
Expand Up @@ -406,7 +406,7 @@ uint32 Creature::ChooseDisplayId(const CreatureInfo *cinfo, const CreatureData *
return display_id;
}

void Creature::Update(uint32 update_diff, uint32 tick_diff)
void Creature::Update(uint32 diff)
{
if (m_needNotify)
{
Expand Down Expand Up @@ -467,7 +467,7 @@ void Creature::Update(uint32 update_diff, uint32 tick_diff)
if (m_isDeadByDefault)
break;

if (m_corpseDecayTimer <= update_diff)
if (m_corpseDecayTimer <= diff)
{
// since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless
uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
Expand All @@ -482,11 +482,11 @@ void Creature::Update(uint32 update_diff, uint32 tick_diff)
}
else
{
m_corpseDecayTimer -= update_diff;
m_corpseDecayTimer -= diff;
if (m_groupLootId)
{
if(update_diff < m_groupLootTimer)
m_groupLootTimer -= update_diff;
if(diff < m_groupLootTimer)
m_groupLootTimer -= diff;
else
StopGroupLoot();
}
Expand All @@ -498,7 +498,7 @@ void Creature::Update(uint32 update_diff, uint32 tick_diff)
{
if (m_isDeadByDefault)
{
if (m_corpseDecayTimer <= update_diff)
if (m_corpseDecayTimer <= diff)
{
// since pool system can fail to roll unspawned object, this one can remain spawned, so must set respawn nevertheless
uint16 poolid = GetDBTableGUIDLow() ? sPoolMgr.IsPartOfAPool<Creature>(GetDBTableGUIDLow()) : 0;
Expand All @@ -516,11 +516,11 @@ void Creature::Update(uint32 update_diff, uint32 tick_diff)
}
else
{
m_corpseDecayTimer -= update_diff;
m_corpseDecayTimer -= diff;
}
}

Unit::Update(update_diff, tick_diff);
Unit::Update( diff );

// creature can be dead after Unit::Update call
// CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly)
Expand All @@ -531,7 +531,7 @@ void Creature::Update(uint32 update_diff, uint32 tick_diff)
{
// do not allow the AI to be changed during update
m_AI_locked = true;
i_AI->UpdateAI(tick_diff); // AI not react good at real update delays (while freeze in non-active part of map)
i_AI->UpdateAI(diff);
m_AI_locked = false;
}

Expand All @@ -541,10 +541,10 @@ void Creature::Update(uint32 update_diff, uint32 tick_diff)
break;
if(m_regenTimer > 0)
{
if(update_diff >= m_regenTimer)
if(diff >= m_regenTimer)
m_regenTimer = 0;
else
m_regenTimer -= update_diff;
m_regenTimer -= diff;
}
if (m_regenTimer != 0)
break;
Expand Down
2 changes: 1 addition & 1 deletion src/game/Creature.h
Expand Up @@ -402,6 +402,7 @@ class MANGOS_DLL_SPEC Creature : public Unit
uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
char const* GetSubName() const { return GetCreatureInfo()->SubName; }

void Update(uint32 time); // overwrite Unit::Update
void GetRespawnCoord(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
uint32 GetEquipmentId() const { return m_equipmentId; }

Expand Down Expand Up @@ -638,7 +639,6 @@ class MANGOS_DLL_SPEC Creature : public Unit
void SendAreaSpiritHealerQueryOpcode(Player *pl);

protected:
void Update(uint32 update_diff, uint32 tick_diff); // overwrite Unit::Update
bool CreateFromProto(uint32 guidlow,uint32 Entry,uint32 team, const CreatureData *data = NULL);
bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL);
void RelocationNotify();
Expand Down
6 changes: 3 additions & 3 deletions src/game/DynamicObject.cpp
Expand Up @@ -106,7 +106,7 @@ Unit* DynamicObject::GetCaster() const
return ObjectAccessor::GetUnit(*this, GetCasterGUID());
}

void DynamicObject::Update(uint32 update_diff, uint32 /*tick_diff*/)
void DynamicObject::Update(uint32 p_time)
{
// caster can be not in world at time dynamic object update, but dynamic object not yet deleted in Unit destructor
Unit* caster = GetCaster();
Expand All @@ -118,8 +118,8 @@ void DynamicObject::Update(uint32 update_diff, uint32 /*tick_diff*/)

bool deleteThis = false;

if(m_aliveDuration > int32(update_diff))
m_aliveDuration -= update_diff;
if(m_aliveDuration > int32(p_time))
m_aliveDuration -= p_time;
else
deleteThis = true;

Expand Down
3 changes: 1 addition & 2 deletions src/game/DynamicObject.h
Expand Up @@ -35,6 +35,7 @@ class DynamicObject : public WorldObject
void RemoveFromWorld();

bool Create(uint32 guidlow, Unit *caster, uint32 spellId, SpellEffectIndex effIndex, float x, float y, float z, int32 duration, float radius);
void Update(uint32 p_time);
void Delete();
uint32 GetSpellId() const { return m_spellId; }
SpellEffectIndex GetEffIndex() const { return m_effIndex; }
Expand Down Expand Up @@ -66,8 +67,6 @@ class DynamicObject : public WorldObject
GridReference<DynamicObject> &GetGridRef() { return m_gridRef; }

protected:
void Update(uint32 update_diff, uint32 tick_diff); // overwrite WorldObject::Update

uint32 m_spellId;
SpellEffectIndex m_effIndex;
int32 m_aliveDuration;
Expand Down
2 changes: 1 addition & 1 deletion src/game/GameObject.cpp
Expand Up @@ -159,7 +159,7 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa
return true;
}

void GameObject::Update(uint32 /*update_diff*/, uint32 /*tick_diff*/)
void GameObject::Update(uint32 /*p_time*/)
{
if (GetObjectGuid().IsMOTransport())
{
Expand Down
3 changes: 1 addition & 2 deletions src/game/GameObject.h
Expand Up @@ -588,6 +588,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
void RemoveFromWorld();

bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint8 animprogress, GOState go_state);
void Update(uint32 p_time);
GameObjectInfo const* GetGOInfo() const;

bool IsTransport() const;
Expand Down Expand Up @@ -710,8 +711,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject

uint64 GetRotation() const { return m_rotation; }
protected:
void Update(uint32 update_diff, uint32 tick_diff); // overwrite WorldObject::Update

uint32 m_spellId;
time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
Expand Down
4 changes: 3 additions & 1 deletion src/game/GridNotifiers.cpp
Expand Up @@ -187,7 +187,9 @@ template<class T> void
ObjectUpdater::Visit(GridRefManager<T> &m)
{
for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
iter->getSource()->UpdateCall(i_time, i_diff);
{
iter->getSource()->Update(i_timeDiff);
}
}

bool CannibalizeObjectCheck::operator()(Corpse* u)
Expand Down
10 changes: 4 additions & 6 deletions src/game/GridNotifiers.h
Expand Up @@ -61,14 +61,13 @@ namespace MaNGOS
struct MANGOS_DLL_DECL GridUpdater
{
GridType &i_grid;
uint32 i_time;
uint32 i_timeDiff;
GridUpdater(GridType &grid, uint32 time_, uint32 diff) : i_grid(grid), i_time(time_), i_timeDiff(diff) {}
GridUpdater(GridType &grid, uint32 diff) : i_grid(grid), i_timeDiff(diff) {}

template<class T> void updateObjects(GridRefManager<T> &m)
{
for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
iter->getSource()->UpdateCall(i_time, i_timeDiff);
iter->getSource()->Update(i_timeDiff);
}

void Visit(PlayerMapType &m) { updateObjects<Player>(m); }
Expand Down Expand Up @@ -137,9 +136,8 @@ namespace MaNGOS

struct MANGOS_DLL_DECL ObjectUpdater
{
uint32 i_time; // current tick time in msecs
uint32 i_diff; // current tick time diff in msecs
explicit ObjectUpdater(uint32 time_, uint32 diff) : i_time(time_), i_diff(diff) {}
uint32 i_timeDiff;
explicit ObjectUpdater(const uint32 &diff) : i_timeDiff(diff) {}
template<class T> void Visit(GridRefManager<T> &m);
void Visit(PlayerMapType &) {}
void Visit(CorpseMapType &) {}
Expand Down
2 changes: 1 addition & 1 deletion src/game/GridNotifiersImpl.h
Expand Up @@ -41,7 +41,7 @@ inline void MaNGOS::VisibleNotifier::Visit(GridRefManager<T> &m)
inline void MaNGOS::ObjectUpdater::Visit(CreatureMapType &m)
{
for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
iter->getSource()->UpdateCall(i_time, i_diff);
iter->getSource()->Update(i_timeDiff);
}

inline void PlayerCreatureRelocationWorker(Player* pl, WorldObject const* viewPoint, Creature* c)
Expand Down
24 changes: 13 additions & 11 deletions src/game/Map.cpp
Expand Up @@ -510,18 +510,20 @@ bool Map::loaded(const GridPair &p) const
return ( getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord) );
}

void Map::Update(uint32 time_, uint32 diff)
void Map::Update(const uint32 &t_diff)
{
/// update players at tick
for(m_mapRefIter = m_mapRefManager.begin(); m_mapRefIter != m_mapRefManager.end(); ++m_mapRefIter)
if (Player* plr = m_mapRefIter->getSource())
if (plr->IsInWorld())
plr->UpdateCall(time_, diff);
{
Player* plr = m_mapRefIter->getSource();
if(plr && plr->IsInWorld())
plr->Update(t_diff);
}

/// update active cells around players and active objects
resetMarkedCells();

MaNGOS::ObjectUpdater updater(time_, diff);
MaNGOS::ObjectUpdater updater(t_diff);
// for creature
TypeContainerVisitor<MaNGOS::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater);
// for pets
Expand Down Expand Up @@ -630,7 +632,7 @@ void Map::Update(uint32 time_, uint32 diff)
GridInfo *info = i->getSource()->getGridInfoRef();
++i; // The update might delete the map and we need the next map before the iterator gets invalid
MANGOS_ASSERT(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE);
sMapMgr.UpdateGridState(grid->GetGridState(), *this, *grid, *info, grid->getX(), grid->getY(), diff);
sMapMgr.UpdateGridState(grid->GetGridState(), *this, *grid, *info, grid->getX(), grid->getY(), t_diff);
}
}

Expand Down Expand Up @@ -1838,17 +1840,17 @@ bool InstanceMap::Add(Player *player)
return true;
}

void InstanceMap::Update(uint32 time_, uint32 diff)
void InstanceMap::Update(const uint32& t_diff)
{
Map::Update(time_, diff);
Map::Update(t_diff);

if(i_data)
i_data->Update(diff);
i_data->Update(t_diff);
}

void BattleGroundMap::Update(uint32 time_, uint32 diff)
void BattleGroundMap::Update(const uint32& diff)
{
Map::Update(time_, diff);
Map::Update(diff);

GetBG()->Update(diff);
}
Expand Down
6 changes: 3 additions & 3 deletions src/game/Map.h
Expand Up @@ -108,7 +108,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
template<class T> void Add(T *);
template<class T> void Remove(T *, bool);

virtual void Update(uint32 time_, uint32 diff);
virtual void Update(const uint32&);

void MessageBroadcast(Player *, WorldPacket *, bool to_self);
void MessageBroadcast(WorldObject *, WorldPacket *);
Expand Down Expand Up @@ -382,7 +382,7 @@ class MANGOS_DLL_SPEC InstanceMap : public Map
~InstanceMap();
bool Add(Player *);
void Remove(Player *, bool);
void Update(uint32 time_, uint32 diff);
void Update(const uint32&);
void CreateInstanceData(bool load);
bool Reset(uint8 method);
uint32 GetScriptId() { return i_script_id; }
Expand All @@ -407,7 +407,7 @@ class MANGOS_DLL_SPEC BattleGroundMap : public Map
BattleGroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode);
~BattleGroundMap();

void Update(uint32 time_, uint32 diff);
void Update(const uint32&);
bool Add(Player *);
void Remove(Player *, bool);
bool CanEnter(Player* player);
Expand Down
8 changes: 4 additions & 4 deletions src/game/MapInstanced.cpp
Expand Up @@ -43,24 +43,24 @@ void MapInstanced::InitVisibilityDistance()
}
}

void MapInstanced::Update(uint32 time_, uint32 diff)
void MapInstanced::Update(const uint32& t)
{
// take care of loaded GridMaps (when unused, unload it!)
Map::Update(time_, diff);
Map::Update(t);

// update the instanced maps
InstancedMaps::iterator i = m_InstancedMaps.begin();

while (i != m_InstancedMaps.end())
{
if(i->second->CanUnload(diff))
if(i->second->CanUnload(t))
{
DestroyInstance(i); // iterator incremented
}
else
{
// update only here, because it may schedule some bad things before delete
i->second->Update(time_, diff);
i->second->Update(t);
++i;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/MapInstanced.h
Expand Up @@ -34,7 +34,7 @@ class MANGOS_DLL_DECL MapInstanced : public Map
~MapInstanced() {}

// functions overwrite Map versions
void Update(uint32 time_, uint32 diff);
void Update(const uint32&);
void RemoveAllObjectsInRemoveList();
void UnloadAll(bool pForce);

Expand Down
6 changes: 3 additions & 3 deletions src/game/MapManager.cpp
Expand Up @@ -239,17 +239,17 @@ void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId)
}

void
MapManager::Update(const uint32 time_, const uint32 diff)
MapManager::Update(uint32 diff)
{
i_timer.Update(diff);
if( !i_timer.Passed() )
return;

for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
iter->second->Update(time_, (uint32)i_timer.GetCurrent());
iter->second->Update((uint32)i_timer.GetCurrent());

for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
(*iter)->UpdateCall(time_, (uint32)i_timer.GetCurrent());
(*iter)->Update((uint32)i_timer.GetCurrent());

i_timer.SetCurrent(0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/MapManager.h
Expand Up @@ -67,7 +67,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
}

void Initialize(void);
void Update(const uint32 time, const uint32 diff);
void Update(uint32);

void SetGridCleanUpDelay(uint32 t)
{
Expand Down
14 changes: 2 additions & 12 deletions src/game/Object.cpp
Expand Up @@ -103,16 +103,6 @@ void Object::_Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
m_PackGUID.Set(guid);
}

void WorldObject::UpdateCall(uint32 newtime, uint32 diff)
{
// use real time diff from last object update call
// this can have big diff from tick diff time for object returning to active zone)
uint32 realDiff = getMSTimeDiff(m_lastUpdateTime, newtime);
m_lastUpdateTime = newtime;

Update(realDiff, diff);
}

void Object::SetObjectScale(float newScale)
{
SetFloatValue(OBJECT_FIELD_SCALE_X, newScale);
Expand Down Expand Up @@ -1131,7 +1121,7 @@ void Object::BuildUpdateData( UpdateDataMapType& /*update_players */)

WorldObject::WorldObject()
: m_isActiveObject(false), m_currMap(NULL), m_mapId(0), m_InstanceId(0), m_phaseMask(PHASEMASK_NORMAL),
m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f), m_lastUpdateTime(getMSTime())
m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f)
{
}

Expand Down Expand Up @@ -2094,4 +2084,4 @@ bool WorldObject::IsControlledByPlayer() const
default:
return false;
}
}
}

32 comments on commit 5ffa34a

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 5, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?!! Good idea...

@KiriX
Copy link

@KiriX KiriX commented on 5ffa34a Nov 5, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да уж... Сначала подгонял патчи под этот коммит, а теперь обратно...

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 5, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да причем тут подгон... идея-то верная. а мелочи - поправим.

@KiriX
Copy link

@KiriX KiriX commented on 5ffa34a Nov 5, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я смайлик забыл добавить =) Идея, скорее всего, верна, но что-то я не особо понял, что это должно было дать на практике. Да нам в принципе, рса, можно и не брать в расчёт этот коммит - ревертить этот реверт =)))

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i write in commit note reasons.

I at 100% agree that idea good but i can't fix it without testing and reproduce. :(

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 5, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no reason to swing the Frostmourne, the more so because the problems are found and solved.

@Schmoozerd
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the patch is out there, and anybody is free to provide tests and fixes such that this change can be reapplied ;)

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is no reason to swing the Frostmourne, the more so because the problems are found and solved.

where? I get only insider42 test results and my second patch (in gist currently) not help...

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gist for reference: https://gist.github.com/664145 i will not drop it some time.

If someone at linus test it more deep (better with less custom changes as possible) and confrm that at clear code it fix porblems or suggest some additional fixes for resolve still existed problems, i not have anything against reapply revert, gitst patch/alt + fixes. if this all in sum will work and fix in clean way problems.

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 5, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solve (published in original commit) and discussion (also with Insider42)-
https://github.com/rsa/mangos/commit/e8b1a653d07801fdfea81de2e0352594fefea5fd
You searched for the problem in the wrong place.

PS server with this (and many-many other) patch have 20 hours uptime, no problems with GO/creatures.

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rsa i not meaning as fix your horiable hack written wihout attempt understand real problem.

My patch in gist fix real porblem with wrong "future" msecs time in object last update field. But not resolve all porblems.

You pointed "fix" just "recorrupt" broken data. signess no meaning in msecs time. And for diff also. Your "negative" values just long diff in result unexpected "future" time in left arg. getMSTimeDiff just not created (as any diff calculation in fact) for cases when next time less that old time.
But in uint32 range not negative values, all values can be correct diff just long.

You talk about like fix of problem as "complete fixed" then for me nothing disscuss with you in this case. Just lol.

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, you have not tried to understand the real problem, to illustrate the location of which (and not for use in your code), I proposed this "horriable hack". Those modifications that are made in your gist, are irrelevant to the problem.
The problem is that it is not in the code, but my head developer patch. All data supplied to the code UpdateCall completely correct. There are no broken or corrupt values. There is no "next time". The fact that the object is created from a single thread (and m_lastUpdateTime initialized from there, see WorldObject constructor), and UpdateCall called from another. And the time in different threads of any multi-tasking (except for real-time) OS has every right to vary within a single system quant in any direction.
The second part of the reason (may appear as a separate and complete with the first one) is that object creation can be completed much later than would be caused by UpdateCall for the entire group of objects, which includes the newly created. But it depends on the compiler.
As a result of these reasons, calculated time difference will be negative.
solutions:

  • Use real-time OS (does not help if there are 2 parts of the reasons);
  • Use the OS without real multitasking (Win);
  • Initialize the start time from the thread, from which it will be used (another "horriable hack" - https://gist.github.com/665285);
  • Make the exception handler (my preview "horriable hack").
    Completely correct solution (if I understand your point of view) should be to implement the initialization m_lastUpdateTime by values, passed thread WorldUpdate the first round objects, including the newly created. However, full implementation of this solution is very difficulty, includes a new thread with the reference time and complex inrerprocess communication.
    And please, do not be nervous. If the discussion does not like - just do not keep it, and everything will be okay.

@teyrnon
Copy link

@teyrnon teyrnon commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw a lot of variants of 'fixes', but one little question: who will test all those variants?
As Vladimir said, he cannot reproduce problem(me too), so its impossible to fix it by self
If you can fix it in correct way - just do it

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which means "correct path" in your understanding? I suggested four correct (in my sense) solutions to the problem and explain its cause. if you think that the problem in another - I'm ready to agree with you, if you get a strong case.
I can configure the system (and compiler) so that the problem manifested itself, and so it did not manifest itself. if you can not replicate the problem, a description which I gave - it's your lack of knowledge rather than objective reality.

@Betaman2k
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf
rsa make good patches + hacks ( works perfect )

@VladimirMangos
your team are very slowly,
why ?
only examples:
BLINK for mages or Mirror ( about 2 years, your team not fixed ) works perfect on RSA
Verhicles not implented about 1 year, works perfect on RSA core
Random BG not implented, 1.5 years, works perfect on RSA
Dungeon Browser not implented 1 year. ( works perfect on trinity core hehe )
u say your core is stable ? haha why u used a buggy ACE 5.8.2 and why runaway alot of devs from u ? ( trinity core now the devs )
u say your code is clean, the code is not clean !

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rsa, how your multi-threads related to clean mangos sources? Object created in same threads that Map::Update run.
If muti-threading will be added to mangos core it will be per-Map mutitreading and then Map::Update still will called in same thread as object creating.
Including any players actions in world in same Map thread context. Maybe i has been wrong revert base at test in broken design custom multi-threaded patches... But hard for me be sure when only single man provide test results for problem that i can't repeat at accessable platform and he use in same time same broken by design multi-thread patch (if you right in own description different threads use for same Map activity.
Ofc, if porblem only in used multi-threads support changes then in this part this is not mangos devs problem and you free fix it in any horriable ways select. I can reapply commit and apply my second fix that fix real problem repeated at clean sources and not related in any way to multi-threads: fix for case when object created in Map::Update call context, so after fixed update time send to objects.

Your negative check in any way wrong independent from how wrong value generated. All 0..0xFFFFFFFF values in msecs is valid values.
getMSTimeDiff strongly expected have in right arg future value in comparison left arg. And i think you not understand that in case msecs timer
0xFFFFF123 can be correctly in past for 0x0000000, because msecs timer overflow is normal functionality and getMStimeDiff specially writed for return proper (past,future) pair diff in like cases.

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Betaman2k, fuck off. You garbage post not related to discussed problem. And you as i think mixing devs and contributers.

@Betaman2k
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rofl
latest core from RSA and about 300 testers about 20 hour uptime, that is good, no crashed with your infos
and why u used bad words, that is a true story

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Object created in same threads that Map::Update run

it's true only for windows. objects in GNU based *x created in another libc/vsyscall thread (if not use special cases). internal mangos multithreading nothing to do with this.
my second "horriable hack" - https://gist.github.com/665285 don't use negative checks, but work also good. based on logic, when i write below.

@teyrnon
Copy link

@teyrnon teyrnon commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rsa, i glad to heard that you can configure your own compiler
and, stop talking about multithreading, clean mangos sources has no MTMaps,

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This version at least make sense. It will redundent applied in 0 timer case when 0 value is corret current timer value bit in any case will no have wrong effects.

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

на win32 проблемма не воспроизводима

yes. win* not have real multitasking.

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vladimir - this version also hack. Need special etalon timer in separate thread, and time value not must be sended in chain of update() calls, but must be getted from this etalon time thread. but this solve is very difficult.

@technoir42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm interested in how internal multithreading on *nix works. rsa, can you give smallest possible example to demonstrate it (I'll test it on Ubuntu 10.04) or give a link to explanation?

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

teyrnon - problem - not from modifications (reproduced on a completely clean core). problem from a misunderstanding of the principle of multi-tasking (which is not surprising for windows-users)

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zergtmn - this discussion is very good example :) example what character do you want?
main{
sprintf(thread_num1)
new _object

}

_object{
sprintf(thread_num2)
}
in win* thread1 == thread2. in GNU *x - depends from compiler keys.

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rsa if some option make new call executed in independent thread then this not compatible with expected way work in mangos code. Just not use this option.
Normal C++ code expect that after return from new call object creation finished. Above i specially point at expected way code work: single thread for Map called code without any addition threads... In fact i not care about problem with your discribed way work. So we can maybe agree both then: this not mangos core problem but your "configure the system (and compiler)" specifics. Different from normal expected code work. And unsupported. We not plan in any future per-Object threads for creatining or any other purpose.

@teyrnon
Copy link

@teyrnon teyrnon commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

em, how multitasking related to mangos..?
mangos have only one process and few threads

@rsa
Copy link
Contributor

@rsa rsa commented on 5ffa34a Nov 6, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's default case in GCC (over 4.0 if I remember correctly. have not watched the changes). if your want to use special cases - need include this in compiler settings.

@technoir42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rsa, what gcc options do you use?

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How this can be default case if lot existed code expect totally different way work.

@technoir42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot reproduce with default compiler options and even with -O3.

Please sign in to comment.