Sprites?

Questions and answers about the how and why of making maps.
Post Reply
Yrogirg
Private First Class
Private First Class
Posts: 154
Joined: Sat Oct 27, 2007 7:24 pm

Sprites?

Post by Yrogirg » Mon Feb 07, 2011 5:34 pm

Is there a way to add sprites in a map? Just thought they are faster rendered than textured meshes.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5173
Joined: Fri Dec 13, 2002 4:11 am
Location: https://discord.gg/NN9uAvx
Contact:

Re: Sprites?

Post by JeffM » Mon Feb 07, 2011 8:38 pm

The term you are looking for is "billboards", as in a 2d image that is drawn at a 3d location always facing the camera.

There is not a billboard object in V2. There may be something you can do in V3 using the lua scripting interface.

You can define a mesh that is a rectangle that is "standing up" that has your image on it but it will look like a line when viewed from it's edge.

User avatar
Cobra_Fast
Dev Monkey
Dev Monkey
Posts: 321
Joined: Sat Oct 07, 2006 11:51 am
Location: Germany
Contact:

Re: Sprites?

Post by Cobra_Fast » Mon Feb 07, 2011 11:00 pm

In case you are indeed referring to sprites, they are possible with the "texsize" option and using texturematrices.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5173
Joined: Fri Dec 13, 2002 4:11 am
Location: https://discord.gg/NN9uAvx
Contact:

Re: Sprites?

Post by JeffM » Mon Feb 07, 2011 11:11 pm

sprites are a 2d screen aligned image. The texture size matrix will simply allow you to scale a texture on a object. It will not make it always face the screen, and the object will still exist in 3d space.

User avatar
Cobra_Fast
Dev Monkey
Dev Monkey
Posts: 321
Joined: Sat Oct 07, 2006 11:51 am
Location: Germany
Contact:

Re: Sprites?

Post by Cobra_Fast » Mon Feb 07, 2011 11:31 pm

In my understanding a sprite is a texture thats got multiple textures on it. Like four 500x500 textures on one 1000x1000 image or similar. Like the missile.png or explode1.png or explode2.png from BZFlag's data folder.

User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5173
Joined: Fri Dec 13, 2002 4:11 am
Location: https://discord.gg/NN9uAvx
Contact:

Re: Sprites?

Post by JeffM » Mon Feb 07, 2011 11:52 pm

That is not a traditional definition of a sprite. Technically the shots are animated billboards, they always face the screen. The fact that we shove more then one frame of animation into the same image is simply an optimization.

In order to benefit in the way the poster suggested, using images instead of geometry, you would need a screen aligned image. For example as it would be simple to use a billboard (2d image) of a ball instead of a round ball shaped mesh. The billboard would draw using 2 triangles and the geometric ball would draw using many many more. For simple shapes this can be a huge savings in drawing speed.

Traditionally a sprite is defined as a bitmaped graphic used as part of a scene. It is a valid request to ask if the bzflag engine supports them.
http://en.wikipedia.org/wiki/Sprite_%28 ... raphics%29

User avatar
optic delusion
Special Forces
Special Forces
Posts: 990
Joined: Sat Sep 25, 2004 2:29 pm
Location: Planet MoFo
Contact:

Re: Sprites?

Post by optic delusion » Wed Feb 09, 2011 3:32 am

Maybe use the drawinfo animation technique I have used? Apply the multiple images to a plane, and use a set of dyncols to modulate the transparency.
It's pretty easy to do, once you know how. Contact me via PM.
Take a look at my Defender game mode concept.

Thinking is not an automatic process. A man can choose to think or to let his mind stagnate, or he can choose actively to turn against his intelligence, to evade his knowledge, to subvert his reason. If he refuses to think, he courts disaster: he cannot with impunity reject his means of perceiving reality.

Post Reply