Forum

Birds Eye Camera & Rotating Camera & In Game Securit

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Birds Eye Camera & Rotating Camera & In Game Securit

Postby Team Xlink » Mon Feb 01, 2010 2:34 am

Hello.

I have three questions today.

How would I go about creating a birds eye view type camera via engine code?

We can move the chasecam view in all directions. Has anyone made one that rotates around and above/below the player on all axis's.


This last question is something I think isn't going to be very likely.

I want to do this:

I want to have in game security camera type "things".

Where you would have the "camera" be it an entity or what not and then whatever that sees you see on a "screen" somewhere else in the map.
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby Downsider » Mon Feb 01, 2010 5:18 am

For the security camera thing, look at the reflection code for an example as to how something like that would work. You would also look at the functions for rendering to a texture on whatever API you're working with.

As far as a bird's eye view goes, it's just some simple math and collisiony stuff to move the camera to the correct position; it's not complicated.. An algorithm to find the angle between two points in 3d space seems like all you would need. Then just chuck the chase camera at any position and face it toward the point of interest.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Re: Birds Eye Camera & Rotating Camera & In Game Sec

Postby Baker » Mon Feb 01, 2010 12:01 pm

Team Xlink wrote:Hello.

I have three questions today.

How would I go about creating a birds eye view type camera via engine code?


Frag Machine's chasecam engine tutorial would be a good start:

viewtopic.php?t=1158

Although what you want sounds more the QuakeC department.


We can move the chasecam view in all directions. Has anyone made one that rotates around and above/below the player on all axis's.


Probably a DarkPlaces mod has done this. But it would likely require one of the veteran QuakeC modders to identify an example mod.

This last question is something I think isn't going to be very likely.

I want to do this:

I want to have in game security camera type "things".

Where you would have the "camera" be it an entity or what not and then whatever that sees you see on a "screen" somewhere else in the map.


That feature exists in RQP (RuneQuake Plus) as far as I know. I can't remember the name of the rune but you could press a key to look from the point of view of the trap.

Zerstorer also had cut scenes.

Here are the source codes, respectively:

http://www.quake-1.com/quakec-gallery/RQP_0.5.4.zip

http://www.gamers.org/pub/idgames2/part ... erstoerer/

Edit: Didn't the that "security screen thing". Hmmm. Well, I guess you could make a 2nd R_RenderView pass and then play around like Downsider suggested with some sort of render to texture function. Really that would be cool as hell to pull off.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Birds Eye Camera & Rotating Camera & In Game Sec

Postby Teiman » Mon Feb 01, 2010 1:59 pm

Team Xlink wrote:Hello.

I have three questions today.

How would I go about creating a birds eye view type camera via engine code?


Look of the svc_ to change the camera pos from QC. then do it, but from C.


We can move the chasecam view in all directions. Has anyone made one that rotates around and above/below the player on all axis's.


I think I did this with Telejano. But maybe on a half-assed way, I don't remenbet.

This last question is something I think isn't going to be very likely.

I want to do this:

I want to have in game security camera type "things".

Where you would have the "camera" be it an entity or what not and then whatever that sees you see on a "screen" somewhere else in the map.


Theres a console commnad for that in Telejano (chase_on 3 ?). But is very doable in QC with simple code.
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am

Postby Spike » Mon Feb 01, 2010 2:25 pm

if you want a usable birds eye view, you need to retain the player's angles.
Create an entity, make its position follow behind the player, its angles don't matter. It needs to be floating with some kind of angle behind.
use svc_setview(byte:5, entity:newviewpoint) to change their viewpoint to be from the new camera.
force the client's m_pitch cvar to 0. This will stop them from pivoting with the mouse. force +mlook otherwise their client will attempt to center their view.
use fixangles and enforce a downwards angle should it ever leave the accepted range (remember angles have a precision of 256 graduations for a full circle, so be leanient).
In prethink and postthink, force the pitch (v_angle_x) 0 and reset it again in postthink. Update the view entity's position in postthink.
Make sure the old (vertical-only) autoaim builtin works.

After you've done that, you'll end up with a floating camera with a birds eye view. Your player will run around freely using regular player physics, their shots will travel horizontally unless there's something infront in which case the shots will autoaim vertically to hit as needed. They will not be able to change the pitch of the camera at all, but they can freely use the mouse to change their player's angles without accidentily breaking the pitch. This method will work in any (non-broken) NQ engine.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Baker » Tue Feb 02, 2010 2:46 pm

Nehe OpenGL Render To Texture

http://nehe.gamedev.net/data/lessons/le ... ?lesson=36

Although I think a better solution would be a R_RenderView pass but that'd be incredibly complicated. I'm not sure how in OpenGL you could set an angled viewport to align with a brush face somewhere with a special texture name?
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Teiman » Tue Feb 02, 2010 4:35 pm

splitscreen hack.
ftp://ftp.berlios.de/pub/telejano/splitcreenhack2.zip
theres a cvar to rotate the 2th view
:-)

thats was poorly done, because no lights on the 2th screen.

potential problems:
- lighting (dynamic lights off, like on this hack)
- PVS (2th camera outside of the PVS, see no entities)
- map compiled with different aspect ratio (only a problem on this hack)
Teiman
 
Posts: 309
Joined: Sun Jun 03, 2007 9:39 am

Postby Downsider » Tue Feb 02, 2010 10:26 pm

Teiman wrote:splitscreen hack.
ftp://ftp.berlios.de/pub/telejano/splitcreenhack2.zip
theres a cvar to rotate the 2th view
:-)

thats was poorly done, because no lights on the 2th screen.

potential problems:
- lighting (dynamic lights off, like on this hack)
- PVS (2th camera outside of the PVS, see no entities)
- map compiled with different aspect ratio (only a problem on this hack)


Isn't PVS reloaded for reflections? Because what if it reflects down a corridor? If you simply take the reflection code and modify it, it should avoid the PVS problem.
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby Spike » Wed Feb 03, 2010 9:57 am

its the server that filters entities out by pvs. The client generally draws all ents.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest