Jump to content
  • Advertisement
Sign in to follow this  
Viperace

Bullet and hitting moving target - best practice?

This topic is 661 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 am creating a game that player place tower to defend a horde of enemies (refuse to use the Tower-Defend keyword, because it really is not).

 

When thinking about the bullet, there are several approach and I wonder which one is the most suitable

Generally, we know that (static) tower fire a bullet to hit a (moving) target.

 

A) Aim dumbly + actual bullet physics - Tower aim at the target position at time t=0 and fire the bullet.

 

Depending on the flight time of the bullet, and the speed of the target, the bullet could miss the moving target. By the time it reach that position, the target has moved

 

B) Aim with lead + actual bullet physics - Same as A, but the AI try to 'guess' the future location of the target

 

If like simple TD genre, the target mostly move in linear fashion, so this could works. What if the target movement is more advance (accelerating, jumping around).

 

C) Homing bullet ! - Bullet that somehow "home" on the target, hence not moving in straight line 

 

This might look really silly

 

D) Mark of death - Once the bullet fly for some distance or reach close enough to the target. The target dies regardless of whether the bullet touch it or not

 

This might also look silly.

 

 

I think of course if we set the bullet speed to be very very high, all above is irrelevant. What are the best practice out there?

 

Appreciate your feedback !

 

 

 

Share this post


Link to post
Share on other sites
Advertisement

This is not programming anymore, it's game design.

 

The best practice here is "do what fits best in your game". If you have a medieval game, a homing bullet breaks the medieval setting. If you have a year 22K game, anything else than bullets that can turn around corners breaks the setting.

 

In a tower defense game, I can see all your ideas as feasible. Just consider the idea of upgrading the towers by improving bullet smartness. In reality, option D is solved by having the bullet send out lots of smaller bullets in all directions, ie exploding shells.

Share this post


Link to post
Share on other sites

These are fairly common in games, actually.  Using Mario Kart and Plants Vs Zombies as two references:

 

 

Straight Fire. MK's green shell. PvZ's Pea Shooter, and most plants.  Fire and they shoot straight.

 

Correcting Aim. MK's red shell.  PvZ's Cattail.  Fire and they try to pick out your target, curving a little.

 

Remote Targeting. MK's blue shell and Bullet. PvZ Homing Thistle and Cob Cannon.  They seek and destroy so you don't have to.

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!