Page 2 of 2

Re: GeoMan - Geometry library

Posted: Mon Nov 21, 2022 10:48 am
by dusoft
Bigfoot71 wrote: Sun Nov 20, 2022 9:58 pm
dusoft wrote: Sun Nov 20, 2022 7:07 pm I am curious about performance intersects detection for multiple polygons at once, e.g. one player body and tens/hundreds of enemies.
Here is a small demo that I just made very quickly. The player himself is represented by a polygon and there is an adjustable number of enemies (also represented by polygons).

I use the isPolyInPoly function for collisions, which can be quite greedy, and no optimization has been done as mentioned by Ivan, at each frame all enemies will test their collision with the player.

I tried up to a hundred and something enemies and was running at 60 FPS on an Intel Pentium J2900.

I would like to specify that the more the number of vertices will be, the more the time required will be high too, demo only contains hexagons, therefore 6 vertices per shape.

Edit: Here is a video where I went up to more than 1000 polygons and I kept the 60 FPS rather well, I myself am pleasantly surprised ! ^^ https://streamable.com/6mm3ud
I have tested it and it seems to be well performing, good job!