Explore Courses Blog Tutorials Interview Questions
0 votes
in AI and Deep Learning by (50.2k points)

Here's the background... in my free time I'm designing an artillery warfare game called Staker (inspired by the old BASIC games Tank Wars and Scorched Earth) and I'm programming it in MATLAB. Your first thought might be "Why MATLAB? There are plenty of other languages/software packages that are better for game design." And you would be right. However, I'm a dork and I'm interested in learning the nuts and bolts of how you would design a game from the ground up, so I don't necessarily want to use anything with prefab modules. Also, I've used MATLAB for years and I like the challenge of doing things with it that others haven't really tried to do.

Now to the problem at hand: I want to incorporate AI so that the player can go up against the computer. I've only just started thinking about how to design the algorithm to choose an azimuth angle, elevation angle, and projectile velocity to hit a target, and then adjust them each turn. I feel like maybe I've been overthinking the problem and trying to make the AI too complex at the outset, so I thought I'd pause and ask the community here for ideas about how they would design an algorithm.

Some specific questions:

  1. Are there specific references for AI design that you would suggest I check out?

  2. Would you design the AI players to vary in difficulty in a continuous manner (a difficulty of 0 (easy) to 1 (hard), all still using the same general algorithm) or would you design specific algorithms for a discrete number of AI players (like an easy enemy that fires in random directions or a hard enemy that is able to account for the effects of wind)?

  3. What sorts of mathematical algorithms (pseudocode description) would you start with?

Some additional info: the model I use to simulate projectile motion incorporates fluid drag and the effect of wind. The "fluid" can be air or water. In the air, the air density (and thus effect of drag) varies with height above the ground-based on some simple atmospheric models. In water, the drag is so great that the projectile usually requires additional thrust. In other words, the projectile can be affected by forces other than just gravity.

1 Answer

0 votes
by (108k points)

Loren's brute force can be your solution to your problem as it would allow easy "Intelligence adjustments" by adding more iterations. In a real situation all these factors would be handled either with formulas or simply brute-force simulation: 

  • Fire an electronic shell. 

  • Apply all the relevant forces and see where it lands.

  • Adjust it and try again until the electronic shell hits the target. 

  • Now you have your numbers to send to the gun.

A difference between artillery games and real artillery situations is that all sides have 100% information and that there are typically more than 2 opponents.

As a result, your evaluation function should consider which opponent it would be more urgent to try and eliminate. For example, if I have an easy kill at 90%, but a 50% chance on someone who's trying to kill me and just missed two shots near me, it's more important to deal with that chance.

I think you would need some way of evaluating the risk everyone poses to you in terms of ammunition, location, activity, past history, etc.

For more information you can refer the following link:


For the best of career growth, check out Artificial Intelligence Online Course and get certified!

Browse Categories