# Using high FPS and Anti-Lag

**URL:** <https://discourse.processing.org/t/using-high-fps-and-anti-lag/44860>\
**Category:** Coding Questions\
**Created:** [July 29, 2024, 10:07pm UTC](https://discourse.processing.org/t/using-high-fps-and-anti-lag/44860 "2024-07-29T22:07:15Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [August 5, 2024, 3:51pm UTC](https://discourse.processing.org/t/using-high-fps-and-anti-lag/44860/5 "2024-08-05T15:51:41Z")

</div>

> [@winterchan](#):
>
> that my fps gradually drops from 60 to around 30-25 when the game reaches it entity spawn peak (at the end game), i was told there might be some ways to be able to spawn a lot of entities but somehow get much less lag , i would like to learn more about how to this, thanks in advanced!

An example I have comparing points and circles with different renderers:

```auto
import processing.javafx.*; // You have to add this library!

int dia = 100;
boolean toggle;

void setup()
  {
  size(800, 800);
  //size(800, 800, P2D);
  //size(800, 800, P3D);
  //size(800, 800, FX2D);
  
  background(0);
  }
  
int t0, t1, td;  
String txt;  
  
void draw()
  {
  background(0);
  
  surface.setTitle(str(frameRate));
  
  if (toggle)
    {
    txt = "point";
    t0 = millis();
    strokeWeight(3);
    stroke(255);
    for(int i=0; i<10000; i++)
      {
      //stroke(random(256));
      stroke(128*randomGaussian()+128);
      point(random(width), random(height));
      }
    t1 = millis();  
    }
  else
    {
    txt = "circle";  
    t0 = millis();  
    noStroke();
    fill(255);
    for(int i=0; i<10000; i++)
      {
      fill(128*randomGaussian()+128);  
      circle(random(width), random(height), 3);
      }
    t1 = millis();  
    }
  
  println(txt, t1-t0);
  }
  
void keyPressed() // Select between points and circle
  {
  toggle = !toggle;
  }

```

References:

- [Render Techniques / Processing.org](https://processing.org/tutorials/rendering)
- [size() / Reference / Processing.org](https://processing.org/reference/size_.html)
- [Faster Rendering Techniques in P3D?](https://discourse.processing.org/t/faster-rendering-techniques-in-p3d/31465)

`:)`

---

_[View the full topic](https://discourse.processing.org/t/using-high-fps-and-anti-lag/44860)._
