otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.59k stars 1.06k forks source link

What's the purpose of usage array of std::list of pointers in game class? #4277

Closed comm0 closed 1 year ago

comm0 commented 1 year ago

As in the title. Then it is being filled on random positions.

Why such array of list is used and then filled like that? What are the benefits?

https://github.com/otland/forgottenserver/blob/c274252b4a00be243564d2f1d8d86beed2bc3042/src/game.cpp#L3886

EPuncker commented 1 year ago

to avoid looping all creatures at once, it would take more time and probably lag

comm0 commented 1 year ago

to avoid looping all creatures at once, it would take more time and probably lag

  • nekiro

Isnt TFS single threaded after all? Anyway no matter of container type (or container usage like there?) it will be proceeded one by one. Am I right?

EPuncker commented 1 year ago

to avoid looping all creatures at once, it would take more time and probably lag

  • nekiro

Isnt TFS single threaded after all? Anyway no matter of container type (or container usage like there?) it will be proceeded one by one. Am I right?

yea thats exactly why we dont loop everything at once, to avoid it being too slow and delay the single thread