What is the best algorthim to create (withdraw) as defence ?

Started by
6 comments, last by asuskobay 7 years, 12 months ago

Hi everyone!

I have just done learning libgdx framework(java) and Box2d Physic Engine. Now I am learning GdxAI(Artificial Intelligence).

I have created two object (enemy and user body). Enemy body is use steering behavior which is arrive. User body is use it own input processor given by end-user. So when enemy body arrive the user body, then collision happens and it seems as shooting. But enemy body shoots continuously user body. I just want to declare a flee algorithm to do defense when gets more damage and again attack when it gets enough distance.

I thought path finder may help me but it not sure. So what do you suggest for my game ? Which path I have to follow ?

Advertisement

You can just use a different steering behavior, such as "separation", to get the effect you describe.

If you want more complex environments with obstacles and such, you will probably want to start exploring pathfinding, but for a simple demo just steering should be OK.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Thank you for answer.

What do you mean by separation steering behavior ?

Actually in the map , it doesnt contain obstacles except around the map.That's why i may not need to use path finder. Image a map which is as play court two object just attacking. World doesn't have gravity.

Is that steering behavior like collision avoidance?

The original paper on steering behaviors (available here: http://www.red3d.com/cwr/steer/) names many types of steering. The one I should have called out is "Evade" rather than "Separation" but the idea is the same.

Have a look over the paper and the different types of behavior, it should be easy to add one to your system that results in target evasion, based on the examples provided in that link.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Thanks for your great idea. I hope it's going to be solution for my desire.

I have applied Evade and Flee steering Behavior. Flee behavior seems too stupid when escaping. But Evade behavior much better than it.

When I passed Enemy(AI) to Evade behavior, Enemy body is colliding with wall around the map. So Shall I apply obstacle avoidance or collision avoidance ?

Which one will be better?

They're basically the same thing with different names :-)

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Thank you :D

This topic is closed to new replies.

Advertisement