PDA

View Full Version : Having AI problems - lets debug!



juanitudev1
08-16-2011, 09:15 PM
Alright, lets just get straight into it:


1). Audio issue - I have my bot Pawns calling PlaySound in certain state's that they enter to in their AiController class. Some sounds sometimes get played over each other though. Is there any way to know if the caller of PlaySound is currently playing a sound to avoid playing another sound over it?

2). Bot Aiming - I read through UTBot to see how they aim and found a function that returns an aim error and another function that gets an AdjustedAim. The function that gets an aim for the bot returns a rotation and sets its Pawn to have that rotation. I tried using these function in my custom bots, but the bot only aims forward. The bullets are aimed correctly at my character, but the visual representation isn't there. How does UTBot get its aiming to work? UTBot in itself is a very confusing class to look at haha.


Thanks, guys!

Blade[UG]
08-16-2011, 09:26 PM
One way you can avoid playing sounds on top of each other, is to create an AudioComponent for your sounds, and use that single AudioComponent to play sounds rather than using the PlaySound() which creates a new audiocomponent for each run. Then, you can check AudioComponent.IsPlaying() to see if it's already doing something.

The bots rotate to face their target before firing, I think.

juanitudev1
08-16-2011, 10:29 PM
I will look into AudioComponent and see what I can do with it. I imagine it will be in the Actor class.

Yes, Bots rotate towards you before firing. But what makes them aim exactly? With the pitch of their Pawn?


Thanks, Blade!

McTavish
08-16-2011, 11:50 PM
Do you mean for them to look up and down ?

skwisdemon666
08-17-2011, 12:28 AM
Gotta ask, do you have an aimnode set up correctly?

juanitudev1
08-17-2011, 10:37 AM
Yea, for the Bots looking up and down.

The aimnode is set up correctly on them. They have the default animTree set.


-Thanks!

juanitudev1
08-20-2011, 10:43 PM
Any ideas, guys? Making a custom Bot aim correctly.

juanitudev1
09-30-2011, 03:54 PM
Alright so I solved the issue of my bots not aiming their gun in the direction of where they are shooting:

If you extend your AI class from UDKBot.uc, the bots will aim in the direction they are attacking in. It is done natively through C++ in the cppt text box. I was extending from GameAiController.uc before, so if anyone else is having that issue, make sure to switch classes.


For my Audio issue, I created an AudioComponent through a variable and my bots are playing a sound through there. I want to extend the AudioComponent class so I can get a notification of when the soundCue that is playing, finishes.
The issue is that the function CreateAudioComponent in the Actor class, requires it to return an AudioComponent and I am trying to use an EXTENDED class of AC. Is there any way I could use my extended AC class with the CreateAudioComponent function? Or should I spawn an AC and attach it to my actor?
What are my options here?


Thanks!