Killcam Help

Discussion in 'Plugin Development' started by xWatermelon, Jun 27, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    xWatermelon

    How can I create a killcam effect? As when a player dies, if they were killed by another player they would be able to see everything that the player who killed them did in the previous 10 seconds, and if they died of other causes, they would see everything they did in the previous 10 seconds? I would like the player to see the perspective of the player who killed them or themselves, if they weren't killed by another player. Anyone know how I can do this? chasechocolate codename_B AngryNerd @AnyOtherKnowledgeableDevs (sorry if you don't want to be tagged, it just seems as if you know what you are doing).
     
  2. Offline

    chasechocolate

    Interesting idea you have there. Off the top of my head, I can think of one way to do it. Have you seen those spectate plugins that allow you to have the perspective of other players (similar to what you are asking)? I believe that is achieved by teleporting the spectator to the player being spectated every tick or so. So what you will need to do (using the way I came up with) would be to log every action (maybe by using a repeating task) and save it in a HashMap<String, List<PlayerAction>>; PlayerAction being a class that stores player actions such as interactions, inventories, health/hunger, movement, etc. Then, in your PlayerDeathEvent method, check if they got killed by another player (player.getKiller() != null), and then show them all of the killer's PlayerActions, otherwise (if they died of other causes), show them all of their actions.
     
    xWatermelon likes this.
  3. Offline

    kreashenz

    Chipmunk9998 Might be able to help you, he's making a 'replay' plugin which records players actions.
     
    xWatermelon likes this.
  4. Offline

    xWatermelon

  5. Offline

    caseif

    Please only tag devs if they've posted on the thread before or the topic of the thread or post directly relates to them (e.g. if you mention one of their plugins). In regards to your question, I can't really think of a way to do this other than by reenacting the player's death with NPCs (@chasechocolate explained how to mimic the players' actions in his post).
     
    xWatermelon likes this.
  6. Offline

    r0306

    xWatermelon
    I've been thinking of ways to do this as well. The only thing I came up with would be as chasechocolate said which is to log every single movement and replay it via NPCs. That being said, it might be a bit resource intensive to log every single action on a server with several players. I did find this plugin which might be a useful reference for a third person POV. http://dev.bukkit.org/bukkit-plugins/cctv-camera/
     
    xWatermelon likes this.
  7. Offline

    Chipmunk9998

    Already working on something like this, just trying to find a way to store the data without using up too much ram or hard drive space. I talked with codename about helping me develop this back in july of 2012 and he said something along the lines of it not being too useful. I can post a video or dev build if you guys want to see how it works.
     
    xWatermelon likes this.
  8. Offline

    chasechocolate

    Chipmunk9998 would you? I am very interested in this concept, and it seems really cool.
     
    xWatermelon likes this.
  9. Offline

    xWatermelon

    Thanks for the informational replies! Does anyone know how I can simulate a player attack (punching)?
     
  10. Offline

    travja

    Packets :p
     
  11. Offline

    xWatermelon

    Uggghhh... Ok :p
     
  12. Offline

    Chipmunk9998

    I'm pretty tired and I have to get back to working on some stuff, so this is the best I could do as a demonstration for now:

     
  13. Offline

    xWatermelon

    Chipmunk9998 cool :D how did you do that? Post code to Github maybe? :p
     
  14. Offline

    skipperguy12

  15. Offline

    chasechocolate

    Chipmunk9998 very nicely done! I am curious to see your approach for this...
     
  16. Offline

    Chipmunk9998

    Sure, I can get a github set up in a bit.
     
  17. Offline

    r0306

    Chipmunk9998
    What NPC library are you using for the plugin may I ask? :p
     
  18. Offline

    Rprrr

    r0306
    Probably TopCat's.
     
  19. Offline

    Jake0oo0

    That is fricken cool!
     
  20. Offline

    Pizza371

    That looks awesome. >.^
     
  21. Offline

    nitrousspark

    would you be able to hide the npc from specific people kind of like player.hidePlayer() works?
     
  22. Offline

    xWatermelon

  23. Offline

    bobert456

    Any update on this I got redirected here and that looks really cool
     
Thread Status:
Not open for further replies.

Share This Page