even more bad news:
it will not get better soon
with: canvas 800*800 and 5000 of your ?items? ( i not read your code… )
MOD test code
ArrayList<Female> females = new ArrayList<Female>();
boolean diagp=false; //true;
int many = 5000;
void setup() {
size(800,800);
frameRate(120);
for (int i = 0; i < many; i++) {
PVector location = new PVector(height/2, width/2);
int[] colours = {floor(random(255)), floor(random(255)), floor(random(255))};
Female newFem = new Female(location, "female", 1, colours, 16, 10, 10, 10, 10, 50);
for (int x = 0; x < newFem.moves.length; x++) {
newFem.moves[x] = new PVector(random(-0.5, 0.5), random(-0.5, 0.5));
}
females.add(newFem);
}
noStroke();
}
void draw() {
background(255);
for (int i = 0; i < females.size()-1; i++) {
females.get(i).move();
females.get(i).display();
}
if ( frameCount%100 == 0 ) println("fps: "+ frameRate );
}
//Breeder entity object
class Ent {
////Abstract properties
int id;
int age;
//'male' or 'female'
String gender;
//PVectors
PVector location;
PVector velocity = new PVector();
//n pixels per frame
float speed;
////Physical properties
//0-255
int[] colour;
//4, 8, 16
int size;
////Combat properties
float hp;
float damage;
float b_velocity;
float f_rate;
////Hunger
boolean hungry = false;
int hunger = 0;
int hungermax;
Ent(PVector location_, String gender_, float speed_, int[] colour_, int size_, float hp_, float damage_, float b_velocity_, float f_rate_) {
id = floor(random(10000000, 99999999));
location = location_;
gender = gender_;
speed = speed_;
colour = colour_;
size = size_;
hp = hp_;
damage = damage_;
b_velocity = b_velocity_;
f_rate = f_rate_;
}
Ent() {
}
//void move(){
// location.add(velocity.x * speed, velocity.y * speed);
//}
//Draw Ent on step
void display() {
fill(colour[0], colour[1], colour[2]);
//Wall wrap
if (location.y > height) {
location.y = 0.00;
if (diagp) println("more than height");
}
if (location.y < 0) {
location.y = height;
if (diagp) println("less than height");
}
if (location.x > width) {
location.x = 0.00;
}
if (location.x < 0) {
location.x = width;
}
rect(location.x, location.y, size, size, 5.00);
}
}
class Female extends Ent {
boolean pregnant = false;
int gestation = 0;
int gestperiod;
PVector[] moves = new PVector[90];
int food;
////Movement
//increment
int stepcount = 0;
//change direction when stepcount is a modulus of stepchange
int stepchange;
//which move is it up to
int movenumber = 0;
Female(PVector location_, String gender_, float speed_, int[] colour_, int size_, float hp_, float damage_, float b_velocity_, float f_rate_, int gestperiod_) {
super(location_, gender_, speed_, colour_, size_, hp_, damage_, b_velocity_, f_rate_);
gestperiod = gestperiod_;
stepchange = floor(random(50, 100));
}
void move() {
if (stepcount % stepchange == 0) {
velocity.set(moves[movenumber]);
if (diagp) println(moves[movenumber].x);
if (diagp) println(velocity);
if (diagp) println(stepchange);
movenumber++;
if (movenumber == 90) {
movenumber = 0;
}
}
location.add(velocity);
stepcount++;
}
}
our usual JAVA 8 Processing 3.5.3
and now i try the JAVA11 version ( possible Processing 4.0.0 beta ) @sampottinger
and same ( or even less ) FPS
and i hoped it might be more ?efficient?
( i not understand why the GPU usage value changed / 12% to 36% / )
so:
processing is cooking on one burner?