Hodo33 Posted September 12, 2018 Share Posted September 12, 2018 I am trying to hide from my bots and peek around a corner to see them. If I use SetAimObject they will shoot me if one inch is exposed using the los test.I tried getobjectBox and then getworldboxcenter and calculate a percent of exposure which does not seem to effective. Does anyone have a simple way to see how much I am exposed to bot line of sight tests? Quote Link to comment Share on other sites More sharing options...
Duion Posted September 12, 2018 Share Posted September 12, 2018 How did you even manage to get the bots to be that good? I thought the bots aim for the center of the target, which should make them not shoot you if you just peek.Otherwise I would just solve it with some getRandom value, like a roleplaying game, so you have a probability the bot can see you and shoot you, probably no human player will detect that your "algorithm" for that is just a random value. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted September 12, 2018 Author Share Posted September 12, 2018 %bot.setAimObject(%player)%res = %bot.checkLosToObject(%player); if(%res) { %bot.fire(true); }They shoot me through windows, door, at the edge of a buildingright now to check los to object I use the boteye to playereye, if I change that to boteye to player worldboxcenter then I can stand in plain sight as long as half of my body is obscured which is also not realistic hence the question... thanks for the reply Quote Link to comment Share on other sites More sharing options...
Duion Posted September 12, 2018 Share Posted September 12, 2018 I don't even know what I use, all I know is they work fine. As an indie dev you have to learn how to be pragmatic, if it works good enough, don't bother with the details. You have to consider that if you change it, you may run into other problems, where the bot will not shoot a player even though for a human he is obviously visible, like you said with using worldboxcenter.I would try to go with a simple workaround, like having a delay until the bot fires, like getRandom from 100ms to 2000ms , that way you do not notice when the bot sees you, since there is a random delay, or go the role play game route, where your visibility generates a percentage you get spottet, so if you are 20% visible, there is only a 20% change you get spotted, or some kind of algorithm, well really depends on the type of game. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted September 12, 2018 Author Share Posted September 12, 2018 Thanks for the suggestions, I like the getRandom idea, allows me to look and hide a bit better.The game is a RPG shooter. I want the player to be more tactical and have to consider their actions rather than run and gun. I set their seek field of view narrow until I shoot one or just get right in front of him, then set off a base alert and make them aware of me. I time out the alert and they revert to just hanging around. Quote Link to comment Share on other sites More sharing options...
Duion Posted September 12, 2018 Share Posted September 12, 2018 Then the RPG system would be ideal probably, the elder scrolls series originally had a skill system that would go from 0 to 100, which would be the percentage an action would succeed, where of course there were other factors taken into account as well, as well as a little bit random to spice up the gameplay.I think there is a function in Torque3D which checks how much of an object is visible, since I knew I had to bother with it for a postFX to determine how much of the sun is visible, maybe you can use that to determine how much a player is visible and then apply some kind of 0-100% detection rate based on that. Quote Link to comment Share on other sites More sharing options...
Razer Posted December 6, 2018 Share Posted December 6, 2018 %bot.setAimObject(%player)%res = %bot.checkLosToObject(%player); if(%res) { %bot.fire(true); }They shoot me through windows, door, at the edge of a buildingright now to check los to object I use the boteye to playereye, if I change that to boteye to player worldboxcenter then I can stand in plain sight as long as half of my body is obscured which is also not realistic hence the question... thanks for the reply Add a check for each shoulder visibility, this will become some more accurate. Quote Link to comment Share on other sites More sharing options...
JeffR Posted December 6, 2018 Share Posted December 6, 2018 Expanding on Razer's idea, depending on how accurate you need the AI vision to be(obviously this is design dependent) one technique I've seen that better simulates sight/detection would be to randomly pick a point on the player's bounding box and fire a ray at it, instead of just their center.If it hits, you add a small value to a detection bar(which degrades over time). This way you have the possibility of them spotting your foot or arm or whatnot, but it doesn't immediately make them go 'oh dang that's an enemy'If you get a certain value on the 'detection' then they go into attack mode or whatnot, but because the value degrades, if they only get a glancing spot of you like your foot, they don't immediately attack.This would be more relevent to something like a stealth game than a high-octane shooter.If you need something simpler/more action oriented, then Duion's suggestion of random response delays or random detection chance would be pretty sufficient. Quote Link to comment Share on other sites More sharing options...
Steve_Yorkshire Posted December 9, 2018 Share Posted December 9, 2018 In Airship Dragoon I had a triple check for target visibility (getEyeNode, getWorldBoxCenter, getPosition), modified with range, which not only affected chance of being spotted but also decreased accuracy the less that was visible. Quote Link to comment Share on other sites More sharing options...
Bloodknight Posted December 10, 2018 Share Posted December 10, 2018 i wonder if there's a way of detecting how much of the body is visible, tie that in with a line of sight angle modifier, so you get something like-1% detection per degree of angle from the forward facing vector and then the modifier for % visible past the wall/cover Quote Link to comment Share on other sites More sharing options...
Razer Posted December 10, 2018 Share Posted December 10, 2018 I don't know if Torque 3D supports ragdoll and bones bouding box collisions, but you could go further and check each bones volume box visibility. Quote Link to comment Share on other sites More sharing options...
Duion Posted December 10, 2018 Share Posted December 10, 2018 Torque3D does not support that, but there are resources that do, maybe that motivates someone to integrate the resources so we have ragdolls and bones bounding boxes etc. Quote Link to comment Share on other sites More sharing options...
Caleb Posted December 11, 2018 Share Posted December 11, 2018 I would suggest expanding the engine slightly as to allow you to easily get the transformed positions of nodes in the player mesh. I did this to approximate bullet collisions on players' limbs with really good success. In this way you can do ray casts to specific points on the animated skeleton (hand, elbow, knees, etc) to see if they're poking out of cover. I'm several engine iterations out of date now so I doubt my old code would be much use, but I'm sure you could poke around at how mount points are used as a jump start. Quote Link to comment Share on other sites More sharing options...
JeffR Posted December 11, 2018 Share Posted December 11, 2018 Honestly, I'd say toss the code up in the resources section. Never hurts to have ideas/examples. Quote Link to comment Share on other sites More sharing options...
Jason Campbell Posted December 13, 2018 Share Posted December 13, 2018 I would suggest expanding the engine slightly as to allow you to easily get the transformed positions of nodes in the player mesh. I did this to approximate bullet collisions on players' limbs with really good success. In this way you can do ray casts to specific points on the animated skeleton (hand, elbow, knees, etc) to see if they're poking out of cover. I'm several engine iterations out of date now so I doubt my old code would be much use, but I'm sure you could poke around at how mount points are used as a jump start. I think Steve posted a resource for getting the player node positions and transform, not long ago. Maybe it was in c++ subforum. Quote Link to comment Share on other sites More sharing options...
Razer Posted December 14, 2018 Share Posted December 14, 2018 Can Torque 3D do ragdoll ? ragdoll capsule physics could be automatically generated on model import ? This collision capsules can also be used to get better precision when the player use a weapon with projectiles or raycast. Quote Link to comment Share on other sites More sharing options...
Duion Posted December 14, 2018 Share Posted December 14, 2018 Someone already ported ragdolls over to Torque: https://forums.torque3d.org/viewtopic.php?f=36&t=886 Quote Link to comment Share on other sites More sharing options...
Razer Posted December 14, 2018 Share Posted December 14, 2018 Someone already ported ragdolls over to Torque: https://forums.torque3d.org/viewtopic.php?f=36&t=886 It's an old post, i don't know if it is compatible with the new entity system and 4.0 or would this be included in 4.0 ? Quote Link to comment Share on other sites More sharing options...
Duion Posted December 14, 2018 Share Posted December 14, 2018 Why should it not work anymore? If you want you can use it, I just don't know what the official source is with the latest updates, but it will not help with the aiPlayer peek value, it is just ragdolls. However it is part of the GMK kit, which meant game mechanics kit, which adds a lot of game mechanics you need for making a game, like cutscenes, scripted events and some ai features.So before you bother creating any new feature, you should search through all the resources, since in many cases someone already programmed such a feature. Quote Link to comment Share on other sites More sharing options...
Hodo33 Posted December 31, 2018 Author Share Posted December 31, 2018 The collision box edge vs the bot los hit point was what I was thinking. I know the width of the box, if I knew where on the box the ray hit me then I could calculate. So 1 unit wide, ray hit at 0.75 units I wind up with 25% in view Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.