Changes between Initial Version and Version 4 of Ticket #2618


Ignore:
Timestamp:
Nov 23, 2022, 4:28:34 PM (17 months ago)
Author:
phosit
Comment:

Can this ticket be closed as won't fix? simulation2/components/CCmpAIManager.cpp:

Line 
60 * The original idea was to run CAIWorker in a separate thread to prevent
61 * slow AIs from impacting framerate. However, copying the game-state every turn
62 * proved difficult and rather slow itself (and isn't threadable, obviously).
63 * For these reasons, the design was changed to a single-thread, same-compartment, different-realm design.
64 * The AI can therefore directly use the simulation data via the 'Sim' & 'SimEngine' globals.
65 * As a result, a lof of the code is still designed to be "thread-ready", but this no longer matters.
66 *
67 * TODO: despite the above, it would still be useful to allow the AI to run tasks asynchronously (and off-thread).
68 * This could be implemented by having a separate JS runtime in a different thread,
69 * that runs tasks and returns after a distinct # of simulation turns (to maintain determinism).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #2618

    • Property Priority Must HaveShould Have
    • Property Type defectenhancement
    • Property Summary AI bugs destroy UI responsivenessRun AI logic in a separate thread
  • Ticket #2618 – Description

    initial v4  
    11Funny thing happened. AI tried to build Civic Center on top of little hill, but there is no way uphill. A few workers got stuck under the clif and game dropped to slideshow with 100% CPU usage.
    2 
    32Problem is, that stupid behavior like this, can make game completely unplayable. AI planning should be performed in its own thread with no option to destroy responsiveness of user interface. I don't mind if AI is burning one of my CPUs, but I really don't like to watch unresponsive slideshow.
    4 
    53AI bugs causing this problems should be fixed, but first, AI invocation should be moved away from rendering and user interface.
    6 
    74I see in top, that there are multiple threads and only one of them is working very hard. So in case that AI is already separated from UI, there is probably bug in communication between these two.