Jump to content

[SOLVED] Fast projectile management


photo

Recommended Posts

Hi guys,

 

I want to start that topic, because I'm working on an fast and efficient way to handle a large amount of arrows (200-300) for my RPG-like game. So I decided to create a new class and handle the movement on my own. The Pawn, who have shot the arrow store the enemy in that class. During the movement I interesect the projectile with his enemy to handle a collision on a low level.

The problem is, that I want to check collision with other objects, like walls, buildings, terrain etc. In my opinion it has a huge performance impact, if I interesect the projectile with all Nodes in the world.

My second opinion is to use a simple box shape for my projectiles to handle collision for the whole world. But in that case, I'm a little afraid of the framerate too.

So are their any hints for a fast projectile management?

Link to comment

Why do you want to implement this on your own ? Couldn't you use physics engine for doing all the collision testing by assigning a simple body to your arrows ? 

Link to comment

That was my guess, after I had a look at the documentation. I was afraid, that an extra body for my arrows are a little bit to much overhead for the scene.

Link to comment

The physics engine is highly optimized for that purpose and I would doubt that some script based own solution runs faster (except in some special use-cases were big simplifications are possible)

 

At least I would give it a try first and only think about own solution when performance really is an issue (always a little bit funny that most people try to solve performance issues even before they show up :-)

Link to comment
×
×
  • Create New...