(This may previously have been answered here; I did search, but may well have missed the appropriate key-words. My apologies if this is so.)
I’m currently working on a small space-like shooter, and have run into a bit of a problem with my weapons.
I originally had each weapons-fire object contain a “from” object, handled (as I recall) by a CollisionHandlerEvent object. This worked well enough, and allowed me to happily collide them with both enemies and my environment, as long as I had only a few shots on-screen at once.
Once I introduced a rapid-fire weapon, however, I found that my frame-rate dropped significantly.
My first solution after investigating through PStats was to rework the system such that weapons-fire objects became “into” objects, with the player and enemies being the “from” objects. While this did indeed improve performance, as I recall, it also introduced another problem: projectiles were now, of course, no longer colliding with the environment.
I had a shot (so to speak ^^; ) at making the environmental colliders “from” objects, but it seems to me that there are potential speed problems there as well (given that that means either many small objects, or one very large object), and I would likely want to use either CollisionTubes (the current representation) or CollisionPolygons, neither of which are valid “from” objects, it seems.
Does anyone have a suggestion for handling numerous projectiles (such as might come from a handful of enemies each bearing rapid-fire weapons) efficiently? Have I perhaps missed some simple solution?
My thanks for any help.
[edit]
From this old thread:
(Emphasis mine)
Is the above-bolded text still true?