Junkkah / Auto_battler

Python game project for a single-player auto battler
0 stars 0 forks source link

Simulator algorithm not optimized #9

Open Junkkah opened 8 months ago

Junkkah commented 8 months ago

Simulator class is used to create simulated runs of the game, where all choices are random. Data from simulation runs is used to analyze and improve the game. Running N = 5000 simulations on mid-range quad-core processor took roughly 4 hours 30 minutes.

Junkkah commented 3 months ago

Current Status:

The Simulator class is essential for running simulated game sessions with random choices, providing critical data for game analysis and balance adjustments.

Recent Changes:

The simulation runtime has increased significantly, now averaging longer durations due to the majority of simulations progressing through all six adventures. Added functionality to collect additional data points, such as damage dealt by different monster types to players. This has contributed to longer processing times. The data writing process has been adjusted for stability: previously, data was written to the SQLite database after completing all simulations, which risked data loss in case of a crash. Now, data is written after each simulation, ensuring all results are saved even if an interruption occurs. This change has slightly increased the overall runtime.

Challenges:

The increased complexity of simulations and the added data points have contributed to longer execution times, which currently average around one hour for 500 simulations on a mid-range quad-core processor. The simulator's performance is critical for collecting sufficient data to balance gameplay effectively.

Next Steps:

Explore potential optimization techniques for the Simulator class, such as code profiling to identify bottlenecks, parallel processing, or optimizing data handling methods.Consideration of the trade-offs between simulation complexity and execution time, ensuring that all necessary data is collected without overly prolonging the simulation process.

Conclusion:

While the Simulator class has become more robust and capable of collecting detailed data, the increase in runtime presents a challenge. Efforts will continue to optimize the algorithm to ensure timely data collection for game balance analysis.