Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I plan on creating my own kill cam system for a sandbox tool set. After thinking about the mechanics of the kill cam itself, however, I'm quite lost. I'm trying to recreate the ones commonly seen in call of duty games that show, from the view of the killer, the actual killing scene.

My Thoughts:

-I can't just keep in memory when people kill others because I wouldn't know when to start the 'recording process'. There is on way for me to accurately determine when somebody is 'about' to kill someone.

-My only real idea so far is to have a complete duplicate of everything loaded off to the side copying all the movement from the original world but with a 10 second delay. That way, all the kill cams would be 10 seconds long and the persons camera would just be moved to the second world of their killer.

My Questions:

Is there already an accepted way to do this? Does anybody have any good ideas for something like this? Thanks if you can!

share|improve this question
add comment

5 Answers

up vote 9 down vote accepted

Store the last few seconds of movement data of relevant dynamic objects.

This data should be complete enough that it can be used to reconstruct a killcam scene if necessary, but incomplete enough that you can afford retrieving and storing at short enough intervals.

Examples of things you may want to track:

  • Which way a visible player is moving/looking
  • Whether killer is zoomed in on gun scope

Things you probably want to optimise out:

  • Data about players whom the killer cannot see
  • Anyone's actual screen output
share|improve this answer
    
There is a big problem in your answer, normally you can't predict anyone's death, and you also can't predict who is going to get the next kill. so with optimizing out data about some players you might end up loosing the ability to replay some kills. –  Ali.S Nov 27 '11 at 22:04
2  
@Gajet I think in this case, he means to cull all relevant objects and only store data for those afterwards. In other words, you'd already want to have some kind of storing/updating mechanism to keep track the positions of everything and their entities, but to a limited time. Say, you just want the last 10 seconds for a kill cam. You'd just need a data structure large enough to store the last 10 seconds and anything older than that gets replaced at the end, such as in a double ended queue. –  ChrisC Nov 27 '11 at 22:46
    
Just confirming that Ricer's answer is what I meant. Indeed: When you can't predict the future, prepare for it instead. :) –  Anko Nov 28 '11 at 16:26
1  
It's important to mention that realtime online games never show players what actually happened; the game is always making guesses about what the truth might be, but due to latencies and other network issues, games won't find out what the "objective truth" was until much later -- if at all. So if you don't have "kill cam" data available to be able to re-create someone else's viewpoint, you totally shouldn't feel bad for making up plausible kill cam data in those situations where you need it. –  Trevor Powell Nov 29 '11 at 9:19
add comment

No idea how this is normally implemented, but you could have each bullet save a clip from the time it is fired, to when it hits a target. If the shooting is done just with a hitscan, you can compute whether or not to generate the kill cam footage in the same cycle when you perform the hitscan.

share|improve this answer
add comment

You can save an object's transform every couple seconds or so. Do this for all applicable dynamic objects. Stagger the saving such that each frame you are only saving a couple matrices. save as far back in time as you like.

During replay, You actually use these transforms in a rendering engine to animate through a scene, interpolating between transforms by time for each frame as necessary.

It is not an exact duplicate but very very close & it allows you to give the player the option of camera control during replay so they can choose where to view the scene from.

share|improve this answer
    
there is one problem with storing only transform matrices, not saving anything else! for example if you only save transform matrices for players, animations may go wrong you won't be able to see how much damage enemy took before killing you and when did he fire his gun. there a long list of details you miss using your method that you can easily think about them. –  Ali.S Nov 27 '11 at 22:15
    
Please re-read, You save transforms for all appropriate dynamic objects, not just matrices for players. It is also easy enough to save health or hit-point data and other items as well too. The point is, saving too much data consumes game time resources, (bad). You save as little as you can get away with and let your rendering engine do as much of the heavy lifting by interpolation during replay as possible. It is a compromise but what isn't? –  Steve H Nov 28 '11 at 2:00
add comment

you can implement some replay feature in your game. using replay function, killcam is just a replay being played from some specific gametime, and from some player's point of veiw. later you can save replays and let others review games after they're finished.

also your idea to run a same game with inputs by 10sec delay is a good approach if your game doesn't consume high computational power.

share|improve this answer
add comment

How about this...

Only record when there is a possibility of killing.

Think about it from an AIM-BOT's perspective. It will only aim/fire when killing is a possibility. So you should only record when an enemy is within killable/visible range.

share|improve this answer
    
What about in situations involving shooting through an object? Ray casting so much will surely be more CPU intensive than some of the other ideas stated. Good idea though, I could consider that as part of a solution. –  Xan Nov 28 '11 at 0:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.