widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02158
multithreading thoughts
Especially for Sirver
As you mentioned multithreading today and as the performance is indeed a
problem I have this very simple idea on multithreading:
First some background:
The widelands 'core' does own stuff and inbetween calls DefaultAI::think()
for all players one after one.
I believe these DefaultAI::think() can be run in pararel, as they do not
change state (buildings, roads, anything) on the map during the time they
run. (Or am I wrong?)
Once they are all done, widelands core can start doing own stuff, including
executing commands (called functions) given by AI. Now widelands could find
that some orders (like construct a building/road) can not be executed due
to changes on the map, but these functions would only fail quietly. This
happens also now and causes no problem to AI. At the same time all AIs
would be informed on changes on map, mainly changes in buildings (this is
how it is done also now). And then again, all AIs would be called in
pararell.
I understand multithreading is not task of a day now, I just wanted to
share with my ideas :)
Tibor
Follow ups