eezstreet Posted May 14, 2016 Share Posted May 14, 2016 The AI Workshop The AI Workshop is a feature that will be in the first version of the JK2 Enhanced mod (and may soon find its way into the JKA version of the mod). Basically, it gives you a completely unparalleled AI debugging and scripting tool. I developed this primarily as a debugging tool while I was tweaking the R2D2/R5D2 AI, but you might find it useful for video making, or even just a fun thing to screw around with. The UIWhen the AI Workshop is toggled on, you will be presented with a great amount of useful information. Each AI in the game (living or dead) will have a bounding box drawn around it, in the color of the alignment. Red is for enemies, blue is for neutral NPCs, green is for allies, and yellow for an AI that you have selected (with the workshop_select command). In this picture: A dead stormtrooper (marked in red), an R5D2 (marked in blue) and a probe droid (marked in yellow, because i have it selected) You will also be shown a ton of useful information about both an AI that you have under your crosshair and the one that you have selected, including currently active timers, whether or not the AI is using the scripted combat move, and the current scriptFlags of an NPC. If you have an NPC selected, you will also see a grey bounding box around whatever their current goalEntity is (which could be a navgoal, item, or something else). In this picture: A rebel that I have selected is engaging some stormtroopers, including one that my crosshair is on. Manipulating the AINot only does the AI workshop let you see information on the AI, but it also allows you to manipulate it as well. In the current version of this code there are only a few things that you can do with it:Change the NPC's scriptFlagsChange the NPC's behaviorState (to like, BS_CINEMATIC or BS_DEFAULT for instance)Inject timersChange the NPC's weaponChange the NPC's goalEntity I have changed this stormtrooper to use a DEMP2, and put him in BS_SLEEP so he doesn't shoot me. I have altered his scriptflags to make him always crouching and shoot in alt fire. I have also made him impervious to force powers, with the appropriate scriptFlag. Demonstration of the stormtrooper using an alt-fire demp shot. They don't really charge them, in case you are wondering. Teancum, Archangel35757, Maksman and 6 others like this Link to comment
ensiform Posted May 14, 2016 Share Posted May 14, 2016 Why do your screenshots always get corrupted at the top of the screen Link to comment
eezstreet Posted May 14, 2016 Author Share Posted May 14, 2016 Why do your screenshots always get corrupted at the top of the screen It's from having the game at windowed mode at native resolution. I'd do it at 800x600 like my others but that would lose detail D: Link to comment
Archangel35757 Posted May 14, 2016 Share Posted May 14, 2016 So this is some sort of on-the-fly in-game AI modification tool? It would be really nice to have something like this (a visual AI tool) in a version of the GTKRadiant editor. Link to comment
eezstreet Posted May 14, 2016 Author Share Posted May 14, 2016 So this is some sort of on-the-fly in-game AI modification tool? It would be really nice to have something like this (a visual AI tool) in a version of the GTKRadiant editor.Yep. Sort of. AI modification and information gathering. It lets you see what the AI is doing in depth without having to set lots of breakpoints. In the future I plan on adding more features to this, like maybe setting navgoals or something. I was also thinking about adding a system of secondary waypoints which could be created in this tool, and loaded up when a map loads, like lugormod ents. Archangel35757 likes this Link to comment
eezstreet Posted May 14, 2016 Author Share Posted May 14, 2016 You can now change both the playerTeam and enemyTeam of an AI. In this screenshot, the stormtrooper was changed to the player's side. Anyone else have any feature requests for this? Bek and Archangel35757 like this Link to comment
Bek Posted May 14, 2016 Share Posted May 14, 2016 @@eezstreet Could you possibly add a setting that'll give the npcs higher or lower accuracy. Link to comment
eezstreet Posted May 14, 2016 Author Share Posted May 14, 2016 @@eezstreet Could you possibly add a setting that'll give the npcs higher or lower accuracy.This is actually not really possible because the accuracy is not something that is stored on the AI itself, to my knowledge. Rather it's just hardcoded. I could alter it though at a later point. ... You can now alter the rank and class of an AI, and setting their weapon to lightsaber now works correctly. In JK2, giving an AI a lightsaber is enough to make them use the Jedi AI, apparently. Stoiss, Bek, Maksman and 1 other like this Link to comment
eezstreet Posted May 14, 2016 Author Share Posted May 14, 2016 Artoo is not fucking having it with this imperial. Omicron, Stoiss and Maksman like this Link to comment
eezstreet Posted May 14, 2016 Author Share Posted May 14, 2016 What have I done....I gave an R2 unit lightside powers, and an R5 unit darkside powers, and tasked them with fighting. The R5 unit won, because it used lightning.So I spawned some rebels to maybe deal with it. Nope. Gripped them all to death.Finally I spawned in another R2 and they have been fighting for a while now. afi, Maksman, Stoiss and 2 others like this Link to comment
eezstreet Posted May 15, 2016 Author Share Posted May 15, 2016 Okay, one last thing: I've added some new features to the old 'nav' debug command that's in JK2. I thought it was a pretty nifty tool, but it lacked everything that I needed. You're now able to view the properties of a nearby waypoint (including the radius, id, flags, and all of the information about the edges that connect to it) and also select it.Most importantly though, you're able to inject new waypoints and create new links ingame. In these screenshots, I have added two new waypoints, created a link between the two, and spawned an NPC at one. I then spawned a weapon (just a dummy entity really) and assigned it using waypoint_set_goalent. The NPC successfully walked from one waypoint to another. An amazing success! Pictured: A stormtrooper at a waypoint. I've given him a goalEnt so he doesn't wander off trying to investigate my footstep noises. I could've set SCF_IGNORE_ALERTS on him now that I think about it.Pictured: The same stormtrooper moving to a gun, which is near another waypoint. Maksman and Omicron like this Link to comment
Silverfang Posted May 15, 2016 Share Posted May 15, 2016 Does Radiant have any way to load the .ent files (OpenJK) or even those .nav files that I assume this system uses? Would be interesting to be able to recompile maps using the custom entities that are supported in .ent files and the .nav stuff from this in-game editor. If not, I wouldn't see any reason why we couldn't compile some custom versions of radiant with some method to load those files (basically the same thing as a prefab, but a different format right?) Link to comment
ensiform Posted May 15, 2016 Share Posted May 15, 2016 Well if you select all files it might work when choosing a .ent file but it won't replace any only import if you select File->Import Link to comment
eezstreet Posted May 15, 2016 Author Share Posted May 15, 2016 Nope, Radiant doesn't use .nav files. Those files are actually binary. In theory you could make a tool to convert those to .ent files or .map files, but waypoint_navgoals aren't actually part of the navigation -- they get converted to blank ref_tags. So basically the only information you'd be able to pull is the classname, origin, radius, spawnflags, and whatever connections the way points have. Link to comment
Archangel35757 Posted May 15, 2016 Share Posted May 15, 2016 what we need are better AI team/squad tactics... like true soldiers would do-- act as a team/squad and not all individuals... i.e. They should use better tactics to achieve an objective (flank, provide cover fire, use objects as cover, fire&return to cover, etc.) The best AI I've played in this regard was Rebellion's WWII Sniper Elite game. Link to comment
Silverfang Posted May 15, 2016 Share Posted May 15, 2016 Halo 3 had pretty neat AI where the leader would say to throw grenades and every single enemy capable threw grenades at you (this happened to me a couple times playing on legendary, nearly screamed when suddenly my crate I was using for cover became an airborne threat in addition to the 3 other grenades exploding around me. There's definitely stormtrooper voice lines for it, but I don't know if there's actual "flanking" behavior. I remember it felt like there was sometimes playing on early Kejim missions. Link to comment
eezstreet Posted May 15, 2016 Author Share Posted May 15, 2016 A new day, a new batch of features. You can now view the script_targetname of an NPC in the overlay.You can now view (and set) any assigned scripts for different behaviorSets (angerscripts, spawnscripts, etc)You can now view (and set) any parms for an NPCYou can make an NPC play dialogueYou can force an NPC to activate a behaviorSet (such as BSET_ANGER) Maksman, therfiles, Lancelot and 1 other like this Link to comment
therfiles Posted May 15, 2016 Share Posted May 15, 2016 Great work, @@eezstreet! This is really fantastic and powerful. I feel like this is a much more powerful and compelling version than my (grotesquely unfinished) NpcSP v2. Really excited to see where this goes. Out of curiosity, how complex is the user interface with this? Or is it all console commands? Link to comment
eezstreet Posted May 15, 2016 Author Share Posted May 15, 2016 You can also view squad information as well: Great work, @@eezstreet! This is really fantastic and powerful. I feel like this is a much more powerful and compelling version than my (grotesquely unfinished) NpcSP v2. Really excited to see where this goes. Out of curiosity, how complex is the user interface with this? Or is it all console commands?All console commands. If you want to make a UI for it, i'd be happy to include a console command to open it up. EDIT: Here's a list of all the commands that are available: https://github.com/eezstreet/OpenJK/blob/jk2hd/codeJK2/game/jke_aiworkshop.cpp#L822-L856 Lancelot, Archangel35757 and Maksman like this Link to comment
afi Posted May 15, 2016 Share Posted May 15, 2016 Would it be possible to save that in an external file like you can save bot waypoints? That way you could edit existing sp maps without having to decompile them and/or without icarus scripting.Sorry if this has been answered before Archangel35757 likes this Link to comment
eezstreet Posted May 15, 2016 Author Share Posted May 15, 2016 Would it be possible to save that in an external file like you can save bot waypoints? That way you could edit existing sp maps without having to decompile them and/or without icarus scripting.Sorry if this has been answered beforeThere is a save command, yes. It uses the .nav files that the game makes anyway. EDIT: I'm assuming you meant the waypoints and not the NPCs. You can't really save the NPCs at any current time, unless you use a savegame. Link to comment
Bek Posted May 16, 2016 Share Posted May 16, 2016 @@eezstreet would it be possible to direct the friendly npcs to a certain direction or area? Link to comment
eezstreet Posted May 16, 2016 Author Share Posted May 16, 2016 @@eezstreet would it be possible to direct the friendly npcs to a certain direction or area?Yeah, if you set them to BS_WAIT they will sit there and do nothing. If you set their leader to be some random object in the world, they will go and stand around it and protect it. Kinda nifty. Archangel35757 and Bek like this Link to comment
Archangel35757 Posted May 16, 2016 Share Posted May 16, 2016 is there a Flank behavior? If not, is it possible to create new behaviors? Link to comment
eezstreet Posted May 16, 2016 Author Share Posted May 16, 2016 is there a Flank behavior? If not, is it possible to create new behaviors?There is no flank behavior that I can see. It should be possible to create new BS_ states. I have been doing some experiments on the AI and it's actually quite strong. Archangel35757 likes this Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now