Deathmap Tutorial

Discussion in 'Tutorials & Resources' started by TheBladeRoden, Apr 23, 2008.

  1. TheBladeRoden

    TheBladeRoden L7: Fancy Member

    Messages:
    491
    Positive Ratings:
    167
    Remember those map overviews Valve released that showed where in the map people died the most? Wish you too had the ability to make those things? Do you want to make cool death maps for strategic analysis like I do? Well now you can! And here's the trick!

    First, you must file a requisition order to your local goods and products distribution officiztat
    Or in other words, ask one of the server admins for a log of your map being played.

    [​IMG]

    While you're waiting for your file, I recommend downloading Notepad++ for the purposes of this tutorial.
    http://notepad-plus.sourceforge.net/uk/site.htm

    Now, if you have your log, use Notepad ++ to open it and it should resemble something like this.

    [​IMG]

    Now what we are looking for is the messages created when one guy kills another. As you can see in the pic, they contain vital information such as the attacker's and victim's respective coordinates.

    [​IMG]

    Now somehow get "victim" without quotes into your clipboard. Go ahead. Select all the text with ctrl+A. Now go TextFX > TextFX Viz > Hide Lines Without (Clipboard) Text. Now select all agaim and return to that same submenu again and click Copy Visible Selection.

    [​IMG]

    Create two new files and paste into each of them. The first file is going to be just for attackers and the other just for victims.

    [​IMG]

    in the attacker file, make sure the cursor is at the start. Press ctrl+r. In the first box put in

    Code:
    L.*attacker_position
    and in the second box put

    Code:
    entity
    {
        "id" "3"
        "classname" "info_target"
        "angles" "0 0 0"
        "spawnflags" "0"
        "targetname" "attackers"
        "origin"
    Make sure that Regular Expr is checked and hit Find. Once the proper selection is highlighted hit Replace Rest.

    [​IMG]

    Now all you attacker coordinates should start looking like entities. Go to the top of the file and delete the stuff before "entity". Press ctrl+r again. In the first box put in

    Code:
    \).*$
    and put in the second box

    Code:
    
        editor
        {
            "color" "220 30 220"
            "visgroupid" "51"
            "visgroupshown" "1"
            "visgroupautoshown" "1"
            "logicalpos" "[0 500]"
        }
    }
    notice the extra line break. Use the Find and Replace Rest Functions again. Yay, now it should resemble a list of entities in the end! The attacker's coordinates have been made into a bunch of info_targets.

    [​IMG]

    Now go into the tab for victims. Once again using the Find/Replace dialog, put in the first box

    Code:
    L.*victim_position
    and in the second box

    Code:
    entity
    {
        "id" "26"
        "classname" "gibshooter"
        "angles" "0 0 0"
        "delay" "0"
        "gibangles" "0 0 0"
        "gibanglevelocity" "0"
        "m_flGibLife" "4"
        "m_flVariance" "0.15"
        "m_flVelocity" "200"
        "m_iGibs" "3"
        "spawnflags" "0"
        "targetname" "victims"
        "origin"
    Do that replacement. Now if you find some lines don't get converted, bring your cursor back to the start and do the find/replace rest function once again. And also delete the junk before the first entity.

    Now for another replacement, in the first box put

    Code:
    \)
    and in the second box put

    Code:
    
        editor
        {
            "color" "220 30 220"
            "visgroupid" "52"
            "visgroupshown" "1"
            "visgroupautoshown" "1"
            "logicalpos" "[0 500]"
        }
    }
    Find and replace until your doc looks like this

    [​IMG]

    Now open your map in Hammer, save a copy named mymapkillersanddeath.vmf with all the extra junk besides basic geometry deleted. Now open that vmf in notepad++.

    In the visgroups section, put in two new visgroups

    Code:
    visgroup
        {
            "name" "attackers"
            "visgroupid" "51"
            "color" "0 255 0"
        }
        visgroup
        {
            "name" "victims"
            "visgroupid" "52"
            "color" "255 0 0"
        }
    [​IMG]

    Scroll down until you get to camera, put a little space above it, and paste in everything from your attackers and victims docs.

    [​IMG]

    Save it and load the map in hammer.

    [​IMG]

    Behold! Now your map is filled with little targets representing killers and little giblits representing killees!

    [​IMG]

    And since these items are in their own visgroups, you could turn the 2D overhead virews into photoshop layers, do a little hues adjustment, overlay that onto your map overview, and boom, you have a death map!

    [​IMG]
     
    • Thanks Thanks x 19
  2. Spike

    Spike L10: Glamorous Member

    Messages:
    716
    Positive Ratings:
    82
    I'm not going to use it but l33t tutorial. You got skills man.
     
  3. ryodoan

    ryodoan Resident Bum

    Messages:
    409
    Positive Ratings:
    59
    Ok, I think I am going to look into writing a program that will automate the text portion, seems simple enough.
     
  4. DJive

    aa DJive Cake or Death?

    Messages:
    1,466
    Positive Ratings:
    736
    If you do that Paul next step could be working it right into the website. IE upload a log and it will produce a downloadable .vmf =p

    Amazing work Roden, i've said this in a different thread before but i was complaining that this would be the single most useful tool for mappers and Valve didn't make it available..

    You just did, VERY impressive.
     
  5. TotalMark

    TotalMark L6: Sharp Member

    Messages:
    331
    Positive Ratings:
    40
    You got some mad skills... :w00t:
     
  6. TheBladeRoden

    TheBladeRoden L7: Fancy Member

    Messages:
    491
    Positive Ratings:
    167
    Roden also humbly requests that you make check boxes for weapon type filters and buildings built.
     
  7. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    That last request looks like a separate program like, for instance, FOoM Logalyzer.
    But should not be too difficult, as everything is in the log.

    Question: are the logs rotated and yes, how? After every map change? In that case, the server could generate death files after every map change...

    ryodoan, give a shout if you really want to build a "death file generator". Would be a shame if we both would program the same stuff separately. Might be better to join forces.

    Will take a quick look to see if I can make my local CVS-repository available to the outside world...
     
  8. dirtyminuth

    dirtyminuth L5: Dapper Member

    Messages:
    221
    Positive Ratings:
    14
    This could emerge as a superior analysis tool. Notable ways to view data:

    * Sort deaths and kills by team.
    * Time-lapse analysis.
    * Sort by class activity.
    * Sort by player activity.
    * View CP / CTF events and possibly extract context of said events.

    And of course, your standard flow / balance issues can be viewed. Now, if there was an automated way to extract a map overview that can be overlayed with non Hammer output, we'd be golden.

    Either Jive or I can handle your log requests. There doesn't appear to be any sensitive data in the logs; the worst I can think of are SteamIDs, but you can 'status' those in game anyways.
     
  9. DJive

    aa DJive Cake or Death?

    Messages:
    1,466
    Positive Ratings:
    736
    Ya after looking into it SteamID's are harmless. the log will mention Rcon but not put up the password which is good =)
     
  10. ryodoan

    ryodoan Resident Bum

    Messages:
    409
    Positive Ratings:
    59
    Woops, I thought we were in a different thread....
     
  11. Thermopyle

    Thermopyle L1: Registered

    Messages:
    10
    Positive Ratings:
    0
    Psychostats 3.1 is going to be doing this (well actually does it already, but it's in alpha stage.)

    I haven't bothered to set up heatmaps on my install of PS 3.1, but here is someone else's on the ctf_turbine_v3.
     
  12. ColdFire

    ColdFire L2: Junior Member

    Messages:
    87
    Positive Ratings:
    15
    Oh, am I famous now? :)
    I did it for most of the maps played or still in the mapcycle of my tf2 server, so feel free if you need informations to contact me
     
  13. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    My CVS-repository can be shared...
     
  14. Thermopyle

    Thermopyle L1: Registered

    Messages:
    10
    Positive Ratings:
    0
    This is now working in Psychostats 3.1

    Here's the heatmap for ctf_mach4 on my server.
     
  15. ryodoan

    ryodoan Resident Bum

    Messages:
    409
    Positive Ratings:
    59
    Yeah, I looked over Psychostats and I think that what would be nice to have is something simple that any mapper can use.

    Psychostats is really cool, but it takes a bit of know-how to get set up and working correctly, not to mention access to a webserver (personal, or otherwise)
     
  16. VeryBad

    VeryBad L1: Registered

    Messages:
    4
    Positive Ratings:
    1
    As someone who is just starting to learn to map, I feel the Heat Maps do not provide all the info needed. All it seems to show is the most chosen place to die. Like ctf_2fort, the main 2 doors are very hot, but I wouldn't say it's a choke point. Also there is no feeling of what killed people. So you cannot infer if say a demoman has some ungodly advantage that could be fixed by making it a bit harder to lob grenades or remotes to the death spot. Or if your map is just a sniper heaven. I think a tool showing attackers and victims with maybe a connecting line describing what method of dispatchment used would provide more valuable data. Also something that comes to mind is the whole issue of engineer buildings and how well they work. Say showing how many kills a Sentry gets before being destroyed, if it was destroyed. Possibly showing how much healing the engineer did to it would be nice too, so you can find those spots where the engineer is ridiculously too safe to repair his toy. The last one is just an idea, not sure it can be deduced from logs. Again these are just some thoughts from someone who is just starting to map.
     
  17. ColdFire

    ColdFire L2: Junior Member

    Messages:
    87
    Positive Ratings:
    15
    Heatmaps by weapons (including sentries) should be available in psychostats later. I know one of the devs is working on many improvements to heatmaps.
    About healing, it doesn't appear in logs so unless someone makes a server plugin which adds this info in the logs, it'll be impossible.
     
  18. ColdFire

    ColdFire L2: Junior Member

    Messages:
    87
    Positive Ratings:
    15
    Did you looked at Psychostats 3.1? There's an installer for the web part, it's really easy. All you have to do is have a mysql database, a database user, and put that info in 2 files before going to http://your_psychostats/install
     
  19. ryodoan

    ryodoan Resident Bum

    Messages:
    409
    Positive Ratings:
    59
    However, I was reading on the install manual that while, yes the main install is relatively easy, if you want the heatmaps you need to install several non-standard perl libraries. However they are outdated perl libraries that are no longer provided (as far as I can tell) in the latest perl download. I searched through the perl package manager and could not find the libraries they were talking about.
     
  20. ColdFire

    ColdFire L2: Junior Member

    Messages:
    87
    Positive Ratings:
    15
    In PS wiki it's explained how to get them. If you use CPAN it's really easy to get those libraries.

    perl -MCPAN -e 'install GD' for example.