Jump to content
  • Advertisement
Sign in to follow this  
XXChester

Tank wars sorta game

This topic is 2584 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

Hello everyone, I am finally throwing in the towel and asking for some direction on how to write the AI for my tank wars /scorthed earth sorta clone. I know I need to simulate how the computer sees the map to determine the best angle / power to fire with but I cannot seem to figure out the best way to do this. I was thinking of drawing a sort of porabola for the computer and checking if it collides with the terrain and than adding fuzzy logic but this seems like it would be extremely slow.

Can someone point me in the direction of not an implementation but maybe a further explanation of how this has been done.

Here is a screen shot of my game;
screenshotgll.th.png

I have the AI determining which target is the closest and facing that way, its just the step of figuring out the power / angle without colliding with terrain that I need some direction.
Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You have to look at projectile physics. Pick an angle first. If you know or can guess how long it will be in the air, then you can figure out something like:

tank_x + airTime*(x) = tank_x_2;

Find x. Then you can find your power needed to make it come out with that speed along the x direction.

Or just guess. Take a fixed angle such as 45 degrees. Guess that the power should be something based on the distance to the other tank. Power = distance*(constant)
Shoot it,see if it lands in front of or behind the other tank. Adjust power +/- from there.

Share this post


Link to post
Share on other sites
Thanks for the reply.....I like your first reply...it was along the lines I was thinking but I was thinking of it too visually where as your description is more of mock approach and should be much faster than actually drawing a texture and checking pixel collision.


Thank you I will try that out.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!