• NextBot Coding and Discussion Thread
    517 replies, posted
[QUOTE=.\\Shadow};40238523]An NPC that is practically the example works on some maps (such as gm_construct), yet not others (which are older maps). Do these really not use nodes, or is there something else that could prevent it from moving? I spawned them at the player spawnpoints on a certain map, which had about 20% of the NPCs standing still where they spawned, but the rest moved.[/QUOTE] navmeshes [url]https://developer.valvesoftware.com/wiki/Navmesh[/url] To use on any other maps, you have to generate a mesh and tweak it. Use nav_generate to generate a mesh from the spawnpoints. But this will not be 100% accurate due to how dynamic maps can be.
This may come off as a dumb question, but can you give the NPCs weapons and force them to attack entities?
I don't think ENT:OnStuck() it working properly, In a map, there are some props which block the npc, the npc gets stuck in them, and it takes around 10 seconds before ENT:OnStuck() is called (maybe I did something wrong?) [url]http://i.imgur.com/JHyZ2Ri.jpg[/url] [code]local opts = { lookahead = 300, tolerance = 45, draw = true, maxage = 0.1, repath = 0.1 } self:MoveToPos( pos, opts )[/code] Can someone point me to where opts is explained? I found if I set maxage to 0.1, the NPC will follow me well, if I set it to 1, it will walk to the end of it's path, before trying to find my position again...
This is just the way it works internally. A lot of Valve's scripts test the position to see if it's moved in x seconds. If it hasn't then it calls onstuck manually. Maybe the MoveTo function should do that - or maybe I should change the engine code to do it?
[QUOTE=garry;40242426]This is just the way it works internally. A lot of Valve's scripts test the position to see if it's moved in x seconds. If it hasn't then it calls onstuck manually. Maybe the MoveTo function should do that - or maybe I should change the engine code to do it?[/QUOTE] What's the point of an stuck function if it only gets called after 10 seconds of being stuck? It should call it as soon as it thinks it's stuck, and more ideally (if possible) it could return what it thinks is causing it to be stuck, so, if it's stuck in a prop, I could tell the npc to attack said prop :P
Sometimes it does. The logic behind it is a bit fucky. The stuck time is based on its max speed and stuff.
[QUOTE=rebel1324;40237888]is scripted sequence works with Next Bot?[/QUOTE] [lua]self:PlaySequenceAndWait( "sequence_name" )[/lua] [QUOTE=.\\Shadow};40238523]An NPC that is practically the example works on some maps (such as gm_construct), yet not others (which are older maps). Do these really not use nodes, or is there something else that could prevent it from moving? I spawned them at the player spawnpoints on a certain map, which had about 20% of the NPCs standing still where they spawned, but the rest moved.[/QUOTE] What map was it? Only CSS, TF2 and L4D maps use navmeshes as far as I know, and to use the CSS ones I had to extract them from the .gcf
[QUOTE=highvoltage;40243566]What map was it? Only CSS, TF2 and L4D maps use navmeshes as far as I know, and to use the CSS ones I had to extract them from the .gcf[/QUOTE] It would be nice if the Nav files gets mounted too.
One of the problems with the nav files is that loading some of them for cs:s or tf2 will cause crashes - because they use kind of a special format especially for those games.
Would you accept user made nav meshes for official maps if they were good enough?
[QUOTE=highvoltage;40231419] Here is it in action: [vid]http://puu.sh/2x9m0[/vid] [/QUOTE] Where did the animations for the spider mine come from? Are they included with the model or do you have to code for them yourself?
[QUOTE=vexx21322;40245168]Would you accept user made nav meshes for official maps if they were good enough?[/QUOTE] They're kind of massive
[QUOTE=dr.dray_7;40241441]This may come off as a dumb question, but can you give the NPCs weapons and force them to attack entities?[/QUOTE] bumping for interest
[QUOTE=jaooe;40245726]Where did the animations for the spider mine come from? Are they included with the model or do you have to code for them yourself?[/QUOTE] I ported the model to source myself along with animations
ok so I'm gunna go out on a limb here and ask... what the hell is NextBot?
[QUOTE=FrankPetrov;40250398]ok so I'm gunna go out on a limb here and ask... what the hell is NextBot?[/QUOTE] Nextbot is the AI system used in the latest valve games. TF2 bots, l4d2 zombies and bots, etc.
[QUOTE=FrankPetrov;40250398]ok so I'm gunna go out on a limb here and ask... what the hell is NextBot?[/QUOTE] It's a new library that makes creating an NPC easy. I got a weird bug too, where once I use nb:MoveToPos() they reach their destination and just stay there. I didn't have this problem yesterday, and it's not my fault because it does the same thing on garry's test entity as well as highvoltage's. The problem is probably just a setting I have set to 0 but does anyone know how to fix this? Thanks
I have a question. As you can see in highvoltage's video, when spider mine chases the player it stops for a half second. That kinda makes me sick. Is there any way to solve that problem? Updating NPC's destination real time?
[QUOTE=garry;40242426]This is just the way it works internally. A lot of Valve's scripts test the position to see if it's moved in x seconds. If it hasn't then it calls onstuck manually. Maybe the MoveTo function should do that - or maybe I should change the engine code to do it?[/QUOTE] Shouldn't it only call OnStuck if the bot actually has some move orders? I wouldn't want it calling OnStuck when I tell them to stand still, thus potentially messing up what I had scripted. [editline]11th April 2013[/editline] [QUOTE=rebel1324;40250755]I have a question. As you can see in highvoltage's video, when spider mine chases the player it stops for a half second. That kinda makes me sick. Is there any way to solve that problem? Updating NPC's destination real time?[/QUOTE] So dramatic! I don't see a single spot where the spider stops for a half a second. And even so, I'm sure its just the way its coded.
[QUOTE=dr.dray_7;40250699] I got a weird bug too, where once I use nb:MoveToPos() they reach their destination and just stay there. I didn't have this problem yesterday, and it's not my fault because it does the same thing on garry's test entity as well as highvoltage's. The problem is probably just a setting I have set to 0 but does anyone know how to fix this? Thanks[/QUOTE] Anyone know how to fix I spawned my ent and highvoltage's one and both just go to where I'm at when it's spawned. Once it reaches that spot it just stays still. If I move it with the physgun it just runs back to that spot. Any help? I really want to keep working on this, thanks.
[QUOTE=SeveredSkull;40250871]Shouldn't it only call OnStuck if the bot actually has some move orders? I wouldn't want it calling OnStuck when I tell them to stand still, thus potentially messing up what I had scripted. [editline]11th April 2013[/editline] So dramatic! I don't see a single spot where the spider stops for a half a second. And even so, I'm sure its just the way its coded.[/QUOTE] I see it, it could be video lag though...
I found out that the bug only happens when the game is in multiplayer. When I run the game in singleplayer the pathfinding works normal, but it stops working after the first location in multiplayer.
[QUOTE=dr.dray_7;40252223]I found out that the bug only happens when the game is in multiplayer. When I run the game in singleplayer the pathfinding works normal, but it stops working after the first location in multiplayer.[/QUOTE] I can't get any nextbot stuff to work on my MP server, probably because the nav generation doesn't work for me...
[QUOTE=rebel1324;40250755]I have a question. As you can see in highvoltage's video, when spider mine chases the player it stops for a half second. That kinda makes me sick. Is there any way to solve that problem? Updating NPC's destination real time?[/QUOTE] There is [url=http://wiki.garrysmod.com/page/BotPath/Chase]BotPath:Chase[/url] but I haven't figured out how to get it too work yet. Right now my spider mine just finds the position of the player, runs to it then finds the position of the player again.
I've gotten BotChase to work somewhat with this: [lua] function ENT:ChaseTarget(pos, options) local options = options or {} local path = Path("Chase") path:SetMinLookAheadDistance(options.lookahead or 300) path:SetGoalTolerance(options.tolerance or 20) path:Compute(self, pos) while true do path:Draw() path:Chase(self, self:GetEnemy()) coroutine.yield() end return "ok" end [/lua] I have one pretty big problem though. For some reason it will tell the bot to walk to a random spot far away from the target and then calculate a path back to it and i'm not really sure why.
I made a controllable bot [url]http://pastebin.com/LzMTQ4x8[/url] The video should be up soon. There is little bit of delay with the controls but it's fine for what I want to do: [vid]https://dl.dropboxusercontent.com/u/4801646/videos/nextbot_mimic.webm[/vid] I still need to find a way to make a smooth transition between animations when the bot starts and stops moving.
-snip, that was stupid-
Locomotion.FaceTowards isn't instant so I'm ending up with the bot turning maybe 20 degrees towards me and then playing the animation when I do [lua]self.loco:FaceTowards( self.Enemy:GetPos() ); self:PlaySequenceAndWait( "attackA" );[/lua] Anyone have any ideas for a workaround? Also, the player can get stuck in bots a lot. Again, any solutions?
FaceTowards needs to be called every frame. I would make a function that calls it and yields until it reaches its target.
Any word on this Garry? [QUOTE=highvoltage;40235644]Ways to detect if the bot wants to jump up or across a gap, climb, open a door, if a movable/breakable prop is in the way. Functions to get the place name of a navarea, get all the navareas with a certain place name and get all the available place names in the map. Just off the top of my head. [editline]10th April 2013[/editline] Also, how do you properly use BotPath:Chase?[/QUOTE] Or should I make a request thread?
Sorry, you need to Log In to post a reply to this thread.