VirusGame
VirusGame copied to clipboard
2 suggestions, 1 issue
- Reset button. There needs to be a reset button to restart the simulator
- Save and load UGOs
- There is an issue when I change the world size, it thows an "ArrayIndexOutOfBounds: (WorldSize)" at line 323 in Cell (
while(chosen == -1 || cells[y+dire[chosen][1]][x+dire[chosen][0]].type != 0){
)
As for the world size problem, the issue is that there are cells directly on the bounds (without a 1 space separation) due to the generation code, and the waste removal code fails because there's no space left for the waste. So only a few values for WORLD_SIZE actually work.
I've successfully tried the values 4, 9, 12 (default), 25, 28 and 36 (some perfect squares or some perfect squares + 3 work). However, the particle number is constant, so cells might die (with WORLD_SIZE = 4, they die in seconds), you should also adjust that, and the frame rate drops for bigger worlds (as is to be expected).
A way to fix this would be by adding a 1-cell wide border of empty cells if there isn't any, another would be to fix the waste removal code to make it wrap around.
In issue #13 there was a coded solution by @c00lum. This way, one can use the other world sizes,