m-byte918 / MultiOgarII

A continued version of the original MultiOgar, an open source Ogar server implementation written with Node.js.
Apache License 2.0
126 stars 131 forks source link

In the Experimental gamemode, viruses stop spawning #1566

Closed joelsgp closed 3 years ago

joelsgp commented 3 years ago

After a while you end up with all mother cells and no viruses.
I suspect this is because they both share the same limit, and mother cells tend to spawn more often. I'll probably read the code properly and make a pr if no one else does it first.

James76931 commented 3 years ago

I am having this same problem on my instance of MultiOgarII.

joelsgp commented 3 years ago

After some more digging it seems like they don't share the same limit, maybe some collission issue stopping viruses from spawning when there are too many red cells? I'm finding it hard to test because when I reduce timeStep to speed up the server it seems to stop red cells from spawning at all.

joelsgp commented 3 years ago

Does this happen in other gamemodes too?

After reading some more and running a server for a few hours with debug prints added, I think the problem might be that in the spawning process, a new entity is instantiated, then collision is checked, and if the check fails, it doesn't spawn. A virus is only spawned when one is eaten (and when the server starts but that's irrelevant), and the chance of a virus spawning is less than 1 due to collision, so eventually there will be no viruses.

The simple fix is to make a loop of checking collision and getting a new random position.

Tombez commented 3 years ago

fixed in #1570