Jump to content

[Map/Grid] New Map/Terrain Management System


Recommended Posts

  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

Posted

I looked on to the patch (very quick look) and there are some problems i think. For example

bool getUnloadLock() const { return i_unloadActiveLockCount || i_unloadExplicitLock; }
...
void incUnloadActiveLock() { ++i_unloadActiveLockCount; }

If we want to have this working under multithreaded environment it will need real locking (mutex or other primitive) because this and similar operations are not atomic what can cause problems in real multithreaded environment. Even simple ++ -- operations are not atomic! It is good to keep this in mind. It can be solved by some fast mutex or using atomic operations (special CPU instructions for this purposes).

Posted

If we want to have this working under multithreaded environment it will need real locking (mutex or other primitive) because this and similar operations are not atomic what can cause problems in real multithreaded environment. Even simple ++ -- operations are not atomic! It is good to keep this in mind. It can be solved by some fast mutex or using atomic operations (special CPU instructions for this purposes).

It's not needed. Simply because terrain data no longer locks grids (as it's now detached from the grid system) and because we never wanted grid-level threading to begin with. That's also why I plan to completely remove all the threading-related code in the grid/cell code.

Posted
It's not needed. Simply because terrain data no longer locks grids (as it's now detached from the grid system) and because we never wanted grid-level threading to begin with. That's also why I plan to completely remove all the threading-related code in the grid/cell code.

Quite true you dont need mutex locks in the grid sys.

Posted

XTZGZoReX: I was going to try this patch today, but I ran into a compile error:

../../../src/game/MapManager.cpp: In member function ‘void MapManager::Update(uint32)’:

../../../src/game/MapManager.cpp:417: error: no matching function for call to ‘MapManager::_deleteMap(std::tr1::__detail::_Hashtable_iterator<std::Pair<const unsigned int, Map*>, false, false>, std::tr1::unordered_map<unsigned int, Map*, std::tr1::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::Pair<const unsigned int, Map*> > >&, NULL)’

../../../src/game/MapManager.h:119: note: candidates are: void MapManager::_deleteMap(std::tr1::__detail::_Hashtable_iterator<std::Pair<const unsigned int, Map*>, false, false>&, std::tr1::unordered_map<unsigned int, Map*, std::tr1::hash<unsigned int>, std::equal_to<unsigned int>, std::allocator<std::Pair<const unsigned int, Map*> > >&, ACE_Thread_Mutex*)

make[3]: *** [MapManager.o]

I had to patch World.h (a config option was added) and MiscHandler.cpp (a comment was added) manually.

Posted
It's not needed. Simply because terrain data no longer locks grids (as it's now detached from the grid system) and because we never wanted grid-level threading to begin with. That's also why I plan to completely remove all the threading-related code in the grid/cell code.

Yes but keep in mind that no matter where you put the terrain data load/unload code, it may be called from two maps, hence threads, at the same time since one of the main points of this system is not to have duplicate terrain data for each instance of the maps. So you definitely need a proper locked reference count at load/unload but multiple threads should still be able to read the data without any locking while it's loaded.

×
×
  • Create New...

Important Information

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. Privacy Policy Terms of Use