Speedy radar?

Blitz3D Forums/Blitz3D Programming/Speedy radar?

So what's the general consensus on the best way to do radar?

I'm writing a tank game. I put together a radar routine (about a year ago) that uses line drawing (to a texture) for bullets and pre-rotated images for plotting tanks. There could be up to 50 or more plots within range at any one time. Needless to say, it's too slow.

So how are you all doing it?

I'm considering setting up a separate camera, creating temp meshes to represent tanks/bullets, taking a render and copying the render to a radar mesh. Seems like a lot of mucking around, but if I have a pre-made pool of plot shapes, it could be quite fast. Anyone else doing it this way?

Don't erase the texture, but instead update one or two objects each FPS.


Andy

Use a second camera, with a small viewport ... far away from the scene and have a proxy mesh (cubes ) for each tank & object which is parented to a pivot directly below the camera. Then just render this scene from above & copyrect to your texture.

Each time a tank moves ... move it's proxy by the same and that's about it.

Should be faster than writepixel etc...

Stevie

Andy

Hmm - there'll be a fair number of plots and it's quite crucial that the radar show realtime info... If only B3d was quicker at drawing/copying images etc.. (and a rendertotexture option would be very useful)

StevieG
Yeah - I'll have to go with this approach. It won't be quite as simple as single boxes as I'll also have to display turrets, but same principle.

Thanks for the replies.

How about teeny-tiny quads on a single surface on your HUD - each quad representing one radar "blip"? I would imagine this would be faster than both drawing on textures and doing a second render.

You can do a little 2D superimposed over the corner of your 3D scene. The images can just be simply DrawImage images or Rect command objects (unless you need the little radar map to be alpha-transparent) put on the scene AFTER you do your Renderworld command (slap the 2D stuff on the screen after all the 3D stuff is rendered).

octothorpe

'How about teeny-tiny quads on a single surface on your HUD'

Aye - although a 2nd render cam has the advantage of being unaffected by changes to your main cam (e.g. camerarange, fog, geometry intersecting the view, etc...)

Sir Gak
DrawImage is simply too slow - mixing 2d/3d is never a good idea in terms of maintaining framerate.

This IS Tanks Universal we're talking about isn't it?

It'd be faster to use Octothorpes method.

No reason why you still can't use a second camerarender for the whole hud display which is outwith the play area. Depending on how you do it, it pmay not even be necessary to copyrect to a texturebuffer.

Stevie

Stevie G
'This IS Tank Universal we're talking about isn't it?'


It is indeed.

I'm already using Sswift's GUIcode (I have SpriteCandy but can't stomach the work that'd be required to drop that in) so it makes sense to use that. I just wanted to see what ideas people had re radars.

(By the way, I'm on my way to releasing a 2 level playtest demo in the next few months)