If i recall correctly, the sound delay was fixed via running this command before pygame.init(). I think i ran into this issue before and that solved it.
Common bottlenecks in code are:
--Do not load resources within the main game loop.
--Always load your images using .convert() or .convert_alpha()
--Reading and writing to disc is the slowest part. Either minimize this, or enhance the parts that are truly required.
--Use existing, well known 3rd party libraries instead of making your own reproductions of them. These libraries are updated and have been tweaked for maximum speed already, so why try to recreate it? One case might be NumPy usage.
If you can create a working example of the lag issue within minimized code it would be much easier to spot. But if not, we would need to pick through the code to find the bottleneck.
pygame.mixer.pre_init(44100, -16, 1, 512)
(Sep-26-2019, 09:36 PM)xBlackHeartx Wrote: Also, in general, I've noticed my programs tend to be really laggy.We would have to see your full code. Most of the time people have some sort of bottleneck in your code that is dragging your program down. You can easily create a bottleneck that would drag a beefy computer to a halt in any language, not just python.
Common bottlenecks in code are:
--Do not load resources within the main game loop.
--Always load your images using .convert() or .convert_alpha()
--Reading and writing to disc is the slowest part. Either minimize this, or enhance the parts that are truly required.
--Use existing, well known 3rd party libraries instead of making your own reproductions of them. These libraries are updated and have been tweaked for maximum speed already, so why try to recreate it? One case might be NumPy usage.
If you can create a working example of the lag issue within minimized code it would be much easier to spot. But if not, we would need to pick through the code to find the bottleneck.
Recommended Tutorials: