inzhu Posted July 18, 2023 Report Share Posted July 18, 2023 This game runs in a single-threaded process. I did a screenshot of system resources monitor when the game was running. This is inefficient. There is much lag in the late game because many computation tasks are in this one thread in a single logical core. Players who use low frequency CPUs will force all other players to be slow for synchronization. Therefore it is important to separate the game processes into many threads and take advantage of all logical cores. It will multiply the available computation power by the total number of logical cores - much faster! Less power will be used by the CPU because a lower frequency is enough to perform the necessary computations. There are many opportunities for multithreading in this game. For example, each thread manages the simulation progress of just one entity, then let all logical cores of the CPU share the pool of threads. Now, if there are 1000 entities on the map, one logical CPU core must compute all 1000 simulation calculations, so it runs slowly. If we do multithreading on a CPU which has 8 logical cores (4 cores 8 threads) then each logical core only needs to do 125 simulation calculations, each physical core needs to do 250 calculations on average. This is at least 4 times faster. The difference is more significant on CPUs with more cores. 2 Quote Link to comment Share on other sites More sharing options...
Gurken Khan Posted July 18, 2023 Report Share Posted July 18, 2023 It's a known issue, but as I understand it, it's not that easy to separate the threads. And we're a bit light on devs. So if you have any expertise jump right on it! 2 Quote Link to comment Share on other sites More sharing options...
inzhu Posted July 19, 2023 Author Report Share Posted July 19, 2023 How can I find the source code of the game? Is there a documentation of any kind? Any description of the file hierarchy of the source codes? 1 Quote Link to comment Share on other sites More sharing options...
Gurken Khan Posted July 19, 2023 Report Share Posted July 19, 2023 https://trac.wildfiregames.com/wiki/WikiStart#Fordevelopersandthoseinterestedinthelatestprogress https://trac.wildfiregames.com/wiki/GettingStarted HTH 1 Quote Link to comment Share on other sites More sharing options...
phosit Posted July 19, 2023 Report Share Posted July 19, 2023 Some tasks are done off of the main thread. (There is an overview.) The most computation (simulation and rendering) is done on the same thread. Only one thread can work on a spidermonkey-context (where the simulation is computed). Copying data from one context to another is performance intensive (compared to not doing it). So splitting the tasks on a per unit level results in much overhead. I think doing the rendering on a different thread has more chances to yeald an improvement. I hope i didn't destroy your motivation. We can always use help. Fell free to join The irc chanel or DM me. 1 Quote Link to comment Share on other sites More sharing options...
andy5995 Posted July 19, 2023 Report Share Posted July 19, 2023 Maybe some potentially useful information in this article on Intel's website?: Identifying the Frame Rate Bottleneck in 0 A.D. @inzhu Related forum thread already exists at 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.