Split Screen HUD
Blitz3D Forums/Blitz3D Beginners Area/Split Screen HUD
| ||
I'm working on a car racing game which has a two player split screen mode. I'm overlaying sprites for the speedometer etc which are parented to each camera. The obvious problem is that when your opponents car comes into view it's speedometer sprite is also visible. Is there a way to hide car(1)'s speedo's when viewed by car(2)? I hoping that someone out there has come across this problem and has an efficient solution?? |
| ||
I created a hud system which uses a method to render a hud that will solve this kind of problem. What you do, is you create a third camera, set it's clsmode to clear the zbuffer but not the color buffer, and place this camera at some distant location in the world. Like at 65536,65536,65536. Set the camera's viewport to overlay the entire screen, and then place your hud elements relative to this third camera. Finally, hide the hud camera, render both of your in-game views, and then hide those cameras, show the hud camera, and renderworld. The hud will draw over everything in your scene. As an added bonus, you can use entityorder to a limited degree to control the order in which the hud elements draw on top of one another. |
| ||
The other alternative method which you could use is to hide the second player's view, hide the second player's hud, renderworld to draw the first player's view, hide the first player's view and hud, show the second player's hud and camera, and renderworld again. However, this will cut your framerate in half unless you use flip false. You might be able to get away with doing flip true on the first camera, and flip false on the second one, and that would render at the normal speed and probably avoid shearing effects. |
| ||
Ah! I'll give this a bash - thanks!! One question though - if I'm having to renderworld twice I take it things shouldn't slow down too much as the second render will be such that only the hud will be rendered - not the entire scene somewhere in the background? I suppose I'll soon find out ........ |
| ||
That is correct. The other objects should be far outside the view frustrum and culled away. It may be a little faster to hide the objects manually though since you know what needs to be hidden. Unless you have hundreds of objects though it probably wouldn't provide a noticeable speedup. |