Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low frame rate is back #472

Open
jzy-chitong56 opened this issue Dec 15, 2024 · 8 comments
Open

Low frame rate is back #472

jzy-chitong56 opened this issue Dec 15, 2024 · 8 comments

Comments

@jzy-chitong56
Copy link
Contributor

I'm not sure where it was caused, but the game became increasingly serious after 20 minutes of playing with 23 AI players. It is suspected that it was caused by the cancellation of all ModuloInteger waiting in JOB

Also, I don't understand why MicroUnitsJob and SeedNewTownsForPlayer needs to operate in two separate unit groups, it seems completely unnecessary

@Kingytrewq
Copy link

Isn't it because the game engine is too old? Although I rarely play 24melee maps, during a test of a 24 player AI melee, an error window popped up after exiting the game. Low frame rates are common in later games, usually causing an increase in CPU frequency, and the number of cores is still 4, so this is still related to the game engine, not AI. At least I think so. In 3.4.1, there was no crash that occurred in the game, at least so far

@jzy-chitong56
Copy link
Contributor Author

Isn't it because the game engine is too old?
Not at all

@Kingytrewq
Copy link

Yes, this is the reason for the underlying code, or I found that once the map crashes, I need to reinstall amai. This may be due to the code being damaged in the map or some other reason. What do you think?

@jzy-chitong56
Copy link
Contributor Author

The probability of crashing during the first installation is indeed very low, but it always crashes when running the flagship afterwards. If the map is damaged, it is theoretically impossible to enter the game. If it is a problem with the game itself, you can try other versions, such as 3.5X, which will be much smoother

@Kingytrewq
Copy link

The same problem, in fact, no matter what kind of updates and optimizations are made to Amai, there is always a certain probability of crashing. I found that this depends on the FPS of the game. In the recently updated PTR version, I got FPS below 200, which is obviously the underlying reason for the crash

@SMUnlimited
Copy link
Owner

SMUnlimited commented Dec 17, 2024

The same problem, in fact, no matter what kind of updates and optimizations are made to Amai, there is always a certain probability of crashing. I found that this depends on the FPS of the game. In the recently updated PTR version, I got FPS below 200, which is obviously the underlying reason for the crash

If too many script calls run within a single game frame, the game can crash, this is known. So a faster graphics rendering will reduce this chance as less scripts can run within a single game frame naturally. With 24 players the risk increases as it becomes 24*5 scripts potentially running at the same time, we attempt to stagger the sleeps so scripts don't all run at exactly the same time to reduce this happening but it is alot harder to prevent.

In terms of lag that is related but different. An infinite loop or very long loop within a single thread will cause this as game artificially lags to protect itself from effectively the above crash but only within its own thread. Adding an actual sleep protects against this lag.

@Kingytrewq
Copy link

I can understand that adding sleep can prevent crashes from occurring, but it cannot completely solve them, so crashes still have a certain probability of occurring, but it is not related to the code of the game itself, but rather a probability issue

@jzy-chitong56
Copy link
Contributor Author

call TQAddJob(4 + 1 * sleep_multiplier, TOWN_TRACK, 0)
call TQAddJob(1, ARMY_TRACK, 0)

ARMY_TRACK runs two complete loops almost every 15 seconds, and the disabling of other TQSLEEP may be the reason for the PPT getting stuck

SMUnlimited added a commit that referenced this issue Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants