Using ProtocolLib to make client display particle effect over area

Discussion in 'Spigot Plugin Development' started by Bolt, May 10, 2015.

  1. I was wondering if there was a way to use ProtocolLib to send packets to the client to display particles over a particular area. I want this to be a client-side thing and not a server thing as I don't want the server to lag since I intend to use a lot of particles. Is there a way to do this with ProtocolLib or some other way?
     
    • Winner Winner x 1
  2. World#spigot().playEffect(...)
     
  3. konsolas

    Supporter

    He asked for "with ProtocolLib" because he doesn't want the server to process said particles.
     
  4. Ok thanks! I'll try it out
     
  5. Look at the source for that method. All it does is send a particle packet to the client which defeats the purpose of a middle man.
     
  6. Won't it display a particle effect client-side since it sends a particle packet?
     
  7. It will show a particle effect only to all clients. If you want to show it to a specific player, use Player#spigot()#playEffect(). Either one should be doing exactly that what you intend to do.
     
  8. If I do Player.spigot().playEffect(), won't it still be processed server-side? Or will the effect be completely client-side?
     
  9. By calling Spigot.playEffect(), server will:
    1. Recognize your playEffect() for ONCE, no matter how many particles you write.
    2. Sending the client with particle ONCE, with how many particle you desire.
     
  10. What do you mean recognize it for ONCE?
     
  11. I would like to have something like this.

    Basicly just that I can set particles to play in a specific area.
    I would like to have it inside a plugin and ingame commands so I can change setting fast.
     
  12. Oh you mean you want me to develop a plugin for this?
     
  13. Oh, nonono XD
    I don't know how to do this ;3
     
  14. I really don't know where your problem is. If you want the particle effects to stay, you have to call Player.spigot()#playEffect again in a scheduled repeating task.
    Particles are processed like this (I don't know what you mean exactly by server-side):
    1. Trigger:
    • Server recognizes where should be a particle effect, or
    • Bukkit Plugin calls a particle method
    2. Sending:
    • Either the server looks which players are in the radius of the particle effect, or
    • if by Bukkit & only for one player: Just sending effect to the specified player
    3. Server-Side done, the rest of the animation is client side
     
  15. @Janmm14 What I really wanted was to make a client-side render of the particles so that it wouldn't lag the server but since you said that the server actually just tells the client where to render and the client processes everything after that, does that mean that spawning a lot of particles won't lag the client?
     
  16. Yes, sending a huge amount of packets will cause low FPS (depending on the specs, obviously). There is nothing you can do about that (aside not spamming them with packets).
     
  17. Is there a less performance-heavy alternative to particle effects that can be used to visually display geometric / 3d figures?
     
  18. There should be API for this...