Cracking the code of TF2 Boss A.I.

Discussion in 'Mapping Questions & Discussion' started by Piezo_, Sep 23, 2016.

  1. Piezo_

    Piezo_ L2: Junior Member

    Messages:
    51
    Positive Ratings:
    2
    So, I've done enough research (stumbling around on the internet when I should have been working on homework) to know that TF2 A.I. (A.K.A. NextBot) is written in the scripting language lua.

    Now, here's my question:
    Where are the .lua files that contain the A.I. for the Halloween bosses, and what programs would I need in order to be able to open/read them?

    The reason I ask is the same reason one might decompile a valve map: I want to see what functions and classes are used in the creation of a TF2 NPC, so that we don't have to go through YET ANOTHER newbossless halloween.
     
  2. henke37

    aa henke37

    Messages:
    1,912
    Positive Ratings:
    446
    This is the first I hear about Valve using LUA for their AI. Where did you hear this?
     
  3. The Letter Before A

    The Letter Before A Cool Idiot

    Messages:
    300
    Positive Ratings:
    119
    Are you sure you don't just have to type in "nav_generate" after compiling? Valve is lazy, and if the manually scripted bosses, they would probably act less mindless.
     
    • Respectfully Disagree Respectfully Disagree x 1
  4. Blinx

    Blinx L69: Deviant Member

    Messages:
    69
    Positive Ratings:
    39
    I don't know how Valve programs their AI but from what I can guess you're trying to accomplish, it doesn't seem feasible. To my knowledge you can't pack AI into a map, that's part of the engine, your best bet is using Sourcemod to create a server side plugin and then combine it with your map.
     
    • Thanks Thanks x 1
    • Agree Agree x 1
  5. Piezo_

    Piezo_ L2: Junior Member

    Messages:
    51
    Positive Ratings:
    2
    That's what I was planning on doing.
    Valve could incorporate the mod into the actual gamefiles if they thought the map was worth it.

    However, my question about where the A.I. files for the already existing bosses are has not been answered...
     
  6. Blinx

    Blinx L69: Deviant Member

    Messages:
    69
    Positive Ratings:
    39
    • Thanks Thanks x 1
  7. Piezo_

    Piezo_ L2: Junior Member

    Messages:
    51
    Positive Ratings:
    2
    This is helpful, and I'll definitely bookmark this, but from what I've read there are two kinds of NPCs:
    • HL2 npcs, that use nodegraphs, whose AI is written in C++.
    • NextBot npcs that use navmeshes, whose AI is written in lua. All official TF2 bots use NextBot AI.
    This article mostly covers HL2 npcs.
    I don't even know if the code for nodegraphs is in the version of the source engine that TF2 uses...
     
  8. Dr. Orange

    Dr. Orange L6: Sharp Member

    Messages:
    368
    Positive Ratings:
    278
    The TF2 bosses AI are programmed into the game code, they do not use external lua scripts. So, sadly, you can't program your own AI for bosses.
     
  9. Idolon

    aa Idolon the worst admin

    Messages:
    1,550
    Positive Ratings:
    4,443
    Can you provide a link for where you read that TF2 NPCs run on Lua? Everything I find about NextBot seems to indicate that it's an AI implementation for Garrysmod (which mostly runs on Lua for mods).

    EDIT: Found a VDC article about it. I'm not familiar with any actual way to implement scripts into a (TF2) map, but I'll do some digging.

    EDIT 2: I looked in tf2_misc_dir.vpk and wasn't able to find anything that looked like Lua. It wouldn't surprise me if the scripts are hidden away specifically to prevent people from making their own NPCs, but I honestly don't know.
     
    • Thanks Thanks x 1
    Last edited: Sep 23, 2016
  10. Piezo_

    Piezo_ L2: Junior Member

    Messages:
    51
    Positive Ratings:
    2
    Last edited: Sep 23, 2016
  11. MaccyF

    aa MaccyF Notoriously Unreliable

    Messages:
    908
    Positive Ratings:
    1,468
    NextBot is proprietary code, you'd need to be a full source developer to have access to the files i'd imagine.
     
  12. Piezo_

    Piezo_ L2: Junior Member

    Messages:
    51
    Positive Ratings:
    2
    Then I could either
    • Make the NPC as a gmod addon, let valve go through the hassle of porting it to tf2...
    • Make the NPC as a source mod, and... uh... I don't know. Gonna have to read up on that.
     
    Last edited: Sep 27, 2016