Jump to content
  • Advertisement
Sign in to follow this  
Byron

Unity To avoid or not avoid....?

This topic is 4350 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I need some advice... I am writing a game in the vein of Space Harrier, tempest and Unity (I was lucky enough to have the dev build of Unity on my desk while working at Lionhead). Now, in this game things are moving rapidly towards the player and there are also path based aliens flying around. Currently the aliens don't avoid the 'static' obstacles so they just pass through them. Should I worry about this? Do I need to add obstacle avoidance for the aliens - I can put it in but it adds an extra complexity to the code and I am not convinced that the end results will end up looking any better. I could always do a Star Wars and have the Aliens explode on contact with the obstacles.... but I don't really want to do that. Any thoughts? All views welcome. You can see various videos of the game in action in my Gamedev journal: Gamedev Journal

Share this post


Link to post
Share on other sites
Advertisement
I think I am just a little worried that it could result in the alien bouncing all over the place as it attempts to avoid one obstacle just to get in the path of another since the obstacles are moving quite fast.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
But are the obstacles really moving? Sure, they appear to move because you're character is running, but probably they are really not moving. If it were me, and I like to keep things as simple as possible, I would just make it part of level design to make sure enemy paths don't collide with things.

Share this post


Link to post
Share on other sites
What you call obstacle avoidance wouldn't be that difficult in this case I think. You could give the alien a set maneuverability, that would determine at wich range from the static object they could still react, if the range is too small simple let them collide (and explode), it would add a great feeling of pace to the game I think.

Share this post


Link to post
Share on other sites
Kiome - I like that idea. It might give a lot of dynamic to the later levels.

"Anonymous Poster" - One design flaw I have is that the obstacles are on a random positional release so I can't really design a path to avoid them.

Share this post


Link to post
Share on other sites
Just a thought on the actual implementaion of the avoidance - or more correctly the reaction to the avoidance.

All the obstacles effectivley have a velocity of 0,-1,0 (Z is up in this world) so to avoid major problems I am thinking that I should only project along the X axis otherwise the Alien would be seen to be moving incredibly fast along Y as it will be trying to outrun the obstacle (which might be fun :))

Should the direction on X projection be random or should I try and make the Aliens a little more intelligent by looking ahead to see if the new position puts them into danger... mind you just having them avoid might bring out some emergent behaviour.

Share this post


Link to post
Share on other sites
Given that the alien spaceship has a maximum velocity, then for each obstacle, there exists a cone of positions which means certain death (because nothing can move out of that cone fast enough to avoid the obstacle. When moving your spacecraft around on a given iteration, consider these cones to be impassable obstacles (because you don't want to enter them).

To make movement smoother, use weights: the alien wants to go somewhere with a weight A, and wants to avoid obstacles with a weight Bi, where Bi is infinite when trying to move into a danger cone, and diminishes when moving away from the cone (it's zero if not on the path at all).

Share this post


Link to post
Share on other sites
Quote:

To make movement smoother, use weights: the alien wants to go somewhere with a weight A, and wants to avoid obstacles with a weight Bi, where Bi is infinite when trying to move into a danger cone, and diminishes when moving away from the cone (it's zero if not on the path at all).


This sounds interesting, can you expand upon this a bit more with an example? No, seriously - I would like to explore this a bit more.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!