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).
|
---|