Pygame Particles Tutorial - Over 20K Particles At 60FPS

Sdílet
Vložit
  • čas přidán 21. 04. 2023
  • In this video we will make a particle system in pygame-ce which is capable of handling over 20,000 particles at a smooth framerate. We will then modify the particle system so it acts like rain.
    Code here: github.com/bigwhoopgames/yout...
    Join the discord here:
    / discord
  • Hry

Komentáře • 18

  • @samdavepollard
    @samdavepollard Před měsícem +2

    very nice - thanks for the pygame-ce tip, i wasn't aware of that option
    subbed

  • @promethium147
    @promethium147 Před 6 měsíci +2

    Downloaded the code and now I can't stop experimenting with all the values . These patterns when generating them in the middle of the screen with random direction (and reflection on all sides) are so beautiful. Thanks a lot for providing the code.

  • @lioninaboxgames
    @lioninaboxgames Před 8 měsíci +2

    Awesome tutorial, and glad to hear you use pygame ce!

    • @bigwhoopgames
      @bigwhoopgames  Před 8 měsíci +1

      Glad you like it!

    • @lioninaboxgames
      @lioninaboxgames Před 8 měsíci +1

      @@bigwhoopgames I'm working on a framework/ function collection that makes pygame game dev 10 to 100 times faster. Now I feel inspired by this to add a particle system to it! :)

  • @mokafi7
    @mokafi7 Před rokem +3

    this channel is a gold mine

    • @bigwhoopgames
      @bigwhoopgames  Před rokem

      Thanks, let me know what else you'd like to see.

    • @mokafi7
      @mokafi7 Před rokem +1

      @@bigwhoopgames im looking to learn pygame and stumbled upon your channel, keep up the great work 💪💪

    • @bigwhoopgames
      @bigwhoopgames  Před rokem

      Will do.

  • @Carbusing
    @Carbusing Před rokem +1

    this is pretty crazy

  • @lone_bhoot
    @lone_bhoot Před rokem

    i am confused why have you added the the __len__ function in particle manger as the inbuilt python len do the same job

    • @bigwhoopgames
      @bigwhoopgames  Před rokem

      Adding the __len__ function allows someone to get to call len(particleman) instead of len(particleman.particles) assuming particleman is a ParticleManager.
      Its not super needed but helps clean up the code a bit.

  • @overratedprogrammer
    @overratedprogrammer Před rokem

    I thought everything f_ was just for floats? Any specific reason why it's faster?

    • @bigwhoopgames
      @bigwhoopgames  Před rokem +1

      I assume you are referring to the fblits function which is short for 'fast blits' as opposed to an frect which is a rect but with floats.
      From the docs: "Note This method only accepts a sequence of (source, dest) pairs and a single special_flags value that's applied to all surfaces drawn. This allows faster iteration over the sequence and better performance over blits(). Further optimizations are applied if blit_sequence is a list or a tuple (using one of them is recommended)."
      Basically they simplified the internals of the function to streamline its execution.

  • @rubenrcs
    @rubenrcs Před měsícem +1

    i get this running the downloaded code """AttributeError: 'pygame.surface.Surface' object has no attribute 'fblits'. Did you mean: 'blits'?""" but if i change line 68 fblits to just blits it does ....? why ? btw it is so awesome thanks

    • @bigwhoopgames
      @bigwhoopgames  Před měsícem

      Are you using pygame-ce? pygame-ce is an updated version of pygame that is more modern and has more features.
      Run:
      pip uninstall pygame
      pip install pygame-ce
      then try.