Cracking the code of TF2 Boss A.I.

Piezo_

L2: Junior Member
Dec 29, 2015
51
5
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.
 

henke37

aa
Sep 23, 2011
2,075
515
This is the first I hear about Valve using LUA for their AI. Where did you hear this?
 

The Letter Before A

Cool Idiot
Jul 15, 2016
292
196
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.
 

Blinx

L69: Deviant Member
Mar 14, 2016
69
51
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.
 

Piezo_

L2: Junior Member
Dec 29, 2015
51
5
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.
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...
 

Piezo_

L2: Junior Member
Dec 29, 2015
51
5
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...
 

Idolon

they/them
aa
Feb 7, 2008
2,123
6,137
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.
 
Last edited:

Piezo_

L2: Junior Member
Dec 29, 2015
51
5
Last edited:

Piezo_

L2: Junior Member
Dec 29, 2015
51
5
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: