Billboards, Bodies, and Projectiles

Mayan Obsidian

10-02-2008 04:29:04

Hello there,

I'm currently attempting to make a game that is of the "bullet hell" genre. In other words it's a shoot-em-up game that takes place in space where the player is dodging (and shooting) tons of bullets at the same time. I fully expect to have at least 50-100 projectiles on the screen at any point in time.

Because my bullets are little spheres of energy, I decided to use animated billboards for the graphical representation. For things that actually have an orientation, I use a mesh instead.

However I encountered a bit of a problem when implementing the billboarded projectiles. With a mesh, I can just attach the newton body to the node with the mesh entity and be on my way. However, I really don't want to create a SceneNode for every projectile.

So there's 3 ways I thought about solving this problem.

  1. 1. Create a scenenode, Create a body and attach it to the scenenode, and every update manually move my billboard to the position of the scenenode every update. Let Newton take care of the positioning and orientation of the body, and then use material callbacks for collision detection.[/list:u]

    It's not the creation and deletion of bodies that I'm worried about with this idea. It is the fact that I will be creating a SceneNode for every single projectile - which I think is overkill and beats the point of having a BillboardSet :)

    1. 2. Forget about making Scenenodes. Just make a newton body, and move it around manually(setPositionOrientation) based on direction and velocity during an update. Use material callbacks for collision. [/list:u]

      This method doesn't seem quite right to me. Plus, I don't think that the material callbacks would work very well .. . I wouldn't be able to get the speed of the collision, tangents, etc, I think.

      1. 3. Create a collision volume, manually move my billboard around according to direction and velocity every update. And then use NewtonWorldForEachBodyInAABBDo to find collisions between the projectiles and the other bodies in the world.[/list:u]

        However, for every N projectiles, Newton would be checking against M bodies. So that would be NM "checks" at X times a second. It sorta adds up. At the same time though, I wouldn't be making so many SceneNodes.

        So basically, I want to have the functionality of material callbacks, without using SceneNodes because I'm using billboards. I was wondering if anyone else had this problem or could provide me with suggestions on what to do, I would greatly appreciate it.

nullsquared

10-02-2008 09:18:44

Whats wrong with scene nodes? They have very little data associated with them, its not like you're loading a new mesh on every scene node :|. It's your best options.

(Also, manually moving bodies won't generate material callbacks, since no "movement" is generated)

walaber

11-02-2008 21:31:45

i would suggest using Newton for the movement and colision detection, and instead of attaching a SceneNode for each particle, create a custom TransformCallback, that sets the position of a billboard to the position of the Body from Newton.

the TarnsformCallback is useful for things like this.

let us know if you need more help getting it working.