Calculating a Peek value for aiPlayer

There are no stupid questions, just stupid answers.
6 posts Page 1 of 1
Hodo33
Posts: 39
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Wed Sep 12, 2018 2:36 am
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?
Duion
Posts: 1082
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Wed Sep 12, 2018 1:23 pm
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.
Hodo33
Posts: 39
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Wed Sep 12, 2018 5:50 pm
%bot.setAimObject(%player)
%res = %bot.checkLosToObject(%player);
if(%res)
{
%bot.fire(true);
}

They shoot me through windows, door, at the edge of a building

right 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
Duion
Posts: 1082
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Wed Sep 12, 2018 6:41 pm
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.
Hodo33
Posts: 39
Joined: Fri Dec 29, 2017 4:34 pm
by Hodo33 » Wed Sep 12, 2018 6:50 pm
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.
Duion
Posts: 1082
Joined: Sun Feb 08, 2015 1:51 am
 
by Duion » Wed Sep 12, 2018 7:14 pm
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.
6 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests