Hello everyone, I recently encountered a problem in my project and would like to discuss it with you.
Reproduction Method:
Press the Z key to generate an object with simple animations and a small number of state machines (simple object).
Press the X key to generate an object with complex animations and multiple state machines (complex animation and state machine object).
Press the C key to generate an object with simple animations but multiple state machines (simple animation and multiple state machine object).
Test Run:
Through comparative testing, it was found that the object with multiple animations and multiple state machines generated by pressing the X key has the greatest impact on the game. When generating, the screen will freeze and even teleport. The object generated by pressing the C key has a relatively small impact, and the lag is not obvious.
Summary:
The number of animations and the number of state machines have a correlated impact on the game flow. When there are many state machines and animations, the impact on the game’s smoothness is the greatest.
Guess:
Regarding animations, it may be related to the number of frames of image cutting or the size of the image itself. When generating state machines, it may cause a certain impact because all state machines are loaded at one time.
In addition, there are operations such as calling the database and frequently changing variables and conditions in many state machines within the project, and these also cause a stutter and frame skip of nearly 1 second when generating objects.
Current Personal Solution:
Create more new objects and split the main objects into multiple parts for processing.
Could this be related to the performance loss when using the bullet settings?
When you create the typical side-scrolling shooter setup of firing bursts of three shots, the game loses a lot of performance, even stuttering due to the FPS drops. In PGM, I did this same thing along with multiple screen scrolls and it worked perfectly, but in AGM, with a project with nothing but a character and some test tiles, it works terribly from the moment you start shooting.
I submitted a project a while ago so you could check what I’m saying.
I’m not using the bullet firing node — I only use object spawning. In AGM, it’s currently confirmed that stuttering occurs when spawning objects, and the root causes are identified as follows:
The number of animations (likely related to either the number of sprite frames or the size of the images themselves)
An excessive number of state machines (including an overload of connection conditions and variable calls within actions)
I hope the official team can optimize this issue in future updates.
I haven’t set up the bullet firing node to fire 3 shots without intervals. The minimum interval is usually 0.06 seconds (which was suitable for the original PGM). Alternatively, since my bullet objects have relatively few state machines and small image sizes, their impact is not significant
There is a similar issue with bullet generation. However, the problem discussed in this post seems to refer to “even when generating just one object,” the time consumed is significantly affected by the number of states and animations of that object. Moreover, this impact appears to be excessively significant.