Python Forum
[PyGame] sound effect delay and program laggy
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] sound effect delay and program laggy
#13
(Sep-28-2019, 12:17 AM)xBlackHeartx Wrote: Is there really anyway I can keep my program from running insanely fast without messing up other things?
If all your code is based off of frames per second, and you change the FPS...everything is going to have to be re-modified to adjust to the change. Its just a part of programming. You made your code wrong basically. And all animation has to be readjusted to the change. You should of started your program at 60 FPS, but instead made all calculations based on it being 7. I will leave that to you since you didnt use classes and are using nested loops for games states which conflicts with my programming structure.

To be honest, your code is quite spaghetti anyways. It wouldn't hurt to rewrite the code a few more times to better understand organization. 250 lines is not that much. Imagine if you wrote a game in spaghetti code at 20,000 lines and had to rewrite it. Thats why I push for people to write good code no matter how short it is. You can write spaghetti code in any language. You can create bottlenecks as well in any language. Learning structure in any language is persistent across all languages. I write my c++ games the same way as i write my python games....i just hate writing code in c++ as it takes too long.

Said functions have documentation. The point of creating those libraries is to not have to re-invent the wheel. That is a lot about Python in general. Why create a new library when one is already created for you for the same purpose? You just have to learn how to use that library. Which is much less time that it would be to create your own. OF course you are free to do that if you want of course. But Python users are prone to use an existing library if one is available.

Like i said for the scipy thing, you are probably going to have to ask them directly. I have never made a sound generator, nor have ever even used scipy module so i know nothing about it.

(Sep-28-2019, 12:17 AM)xBlackHeartx Wrote: It seems python is just too limiting and glitchy.
Python is not glitchy. Python and Pygame can handle a 2D game. It is how you structure your code. A lot of people dis Python for being slow....but most of the time it is because of bad coding. The only time it truly is too slow is if you are creating a graphics driver or something in which you really need to be low level.

(Sep-28-2019, 12:17 AM)xBlackHeartx Wrote: What I want is the source code of the things I'm using
The documentation will explain how to use it better than seeing the source code. But if you insist on seeing the source code of scipy you can look at it. The path defers based on what operating system your on and python version of course. This is linux. The path on Windows would be the same under site-packages for the installed python version of scipy.
metulburr@ubuntu:/usr/local/lib/python3.6/site-packages/scipy$ ls
_build_utils          HACKING.rst.txt  LICENSE.txt  __pycache__  stats
cluster               __init__.py      linalg       setup.py     THANKS.txt
__config__.py         INSTALL.rst.txt  linalg.pxd   signal       version.py
conftest.py           integrate        misc         sparse
constants             interpolate      ndimage      spatial
_distributor_init.py  io               odr          special
fftpack               _lib             optimize     special.pxd
Recommended Tutorials:


Messages In This Thread
RE: sound effect delay and program laggy - by metulburr - Sep-28-2019, 04:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Laggy Game Movement game_slayer_99 12 4,665 Oct-05-2022, 11:34 AM
Last Post: metulburr
Music [PyGame] Chopper wash effect efficiency questions. michael1789 9 4,582 Jan-19-2021, 07:12 PM
Last Post: michael1789
  Appropriately delay this PyGame code kleynah22 2 4,452 Nov-09-2017, 02:00 PM
Last Post: Windspar
  [PyGame] My program is very laggy GamePlanet 6 7,179 Aug-15-2017, 03:00 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020