This site requires JavaScript, please enable it in your browser!
Greenfoot back
RoverKnight
RoverKnight wrote ...

2021/6/3

How to speed up Greenfoot/let it make use of more processing power?

RoverKnight RoverKnight

2021/6/3

#
Hello, I just finished programming Conways Game of Life and wanted to do some runs with rather large worlds (~100x100 and bigger), but Greenfoot starts slowing down/struggling with worlds about 50x50 squares already, since every square is filled with a "death" actor, on which there may also be other actors. Is there any way to make Greenfoot run faster, or let it use the GPU?
danpost danpost

2021/6/3

#
Here are some things that might help. Eliminate actors altogether. This will eliminate 10000 act calls and save a lot of memory space. Track state of "cells" in two arrays -- alternate the arrays between current and next state. Fill "cells" in background only when their state changes (avoids refilling of unchanged ones).
Super_Hippo Super_Hippo

2021/6/3

#
The more actors you have, the slower your scenario will get, yes. In the case of Game of Life, there should be life in a cell or not. So there shouldn’t be more than one actor in a cell. However, you don’t need to use actors for the cells. Since each actor is only a boolean representation (or 0 and 1) showing with an image, you can also have an array in your world and draw the world background based on the 0’s and 1’s in the array.
You need to login to post a reply.