Radar
-
- Random Identifier & Project Developer
- Posts: 345
- Joined: Wed Feb 25, 2004 12:54 am
- Location: Northern California, USA
Radar
I know that a radar has been on people's wish lists for a while. I was peaking at viewports a little and was wondering if the simplest way to add a radar would be to create a stationary viewport centered above the grid (looking down) far enough away to show the whole grid. It could be rotated as the player turns. My concern would be with larger arenas... would the cycle walls be too far away to show up... and textured floors might make it hard to see the walls... and I supposed you wouldn't know which trail was yours either... Just a thought. Probably better to write something from scratch...
Re: Radar
I actually went poking around the code looking for a way to do this, and here's what I came up with:k wrote:I know that a radar has been on people's wish lists for a while. I was peaking at viewports a little and was wondering if the simplest way to add a radar would be to create a stationary viewport centered above the grid (looking down) far enough away to show the whole grid. It could be rotated as the player turns. My concern would be with larger arenas... would the cycle walls be too far away to show up... and textured floors might make it hard to see the walls... and I supposed you wouldn't know which trail was yours either... Just a thought. Probably better to write something from scratch...
The viewport sizes are set by weight. I.e. you declare a viewport to be .5 width and .5 height and it gets half the screen. BUT, when you set them uneven, you get uneven results. I set the top viewport as .2 and the bottom as .8, intending to make a rear view mirror out of the top viewport. What I got was the bottom half of the screen and the top quarter of the screen being the bottom viewport, so I had something like this:
----------------------------------------- TOP OF SCREEN
Player 2 viewport
-----------------------------------------
Player 1 viewport
----------------------------------------- MIDDLE OF SCREEN
Player 2 viewport
-----------------------------------------
Player 2's view, in this case, was rendered split between his two parts of the screen. Weird, I know.
The second thing I encountered was that viewports are assigned in a backwards fashion. They are done by assigning a viewport to a player, which means each player can only have one and only one viewport. If instead you assign a player to a viewport, you can have a player take more than one viewport. Couple that with fixing the rendering code to support viewports of arbitrary sizes, toss in already existing camera views, and you've got radar, rear-view, in-cam, and so forth all at once.
I ran out of time before I found where the viewports are actually rendered to make this work, but I can probably dig up specific lines of code I played with if you want them. The tViewPort class needs to almost rewritten, but the existing interface to it should be able to stay the same as it is, possibly with a few additions. Then somewhere in the rendering engine you have to make it support arbitrary-sized viewports, and then a few changes to the config file and it's done. Someone who's already well-familiar with the code might be able to do this pretty quickly and easily. I'm not that someone, but I'll be taking a poke at it again sometime if no one beats me to it.
(Minor nitpick, there was also no HUD, but I figured that would be an easy matter to track down, and a minor issue in the whole thing)