Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently researching how to model/simulate radar for my naval simulation. Since the emphasis is on modelling ASW or submarines in general, I need only a basic radar model - at least for the beginning.

So, does anybody know a resource for such a simple model?

The model should take signal strength of the sensor, the size of the target and the terrain (height/ground clutter) into account.

Edit: This question is not about displaying a radar screen but to simulate the underlying physics of radar. The model would need to work for ships/aircraft/missiles.


share|improve this question
When your goal is to make it as realistically as possible, you should consult textbooks about radar and sonar technology. But remember that enjoyable gameplay is always more important than realism. – Philipp Dec 1 '12 at 11:42
@Philipp: I'm developing a nuclear sub simulation, so realism is a priority. For sonar I'll consult textbooks because this needs to have a high fidelity due to the nature of the game. Modelling the same sophistication of the radar is not the first priority for now but I need a basic model also there. – Hawk66 Dec 1 '12 at 21:51
up vote 1 down vote accepted

I assume you've already read the Wikipedia article on radar. Here's another site I found ( which might be useful.

If you really want to implement realistic radar (or sonar), you'll probably want to use ray tracing. The basic principle is just the same as in the usual light ray tracing used for 3D rendering, so you can use any of the usual implementation techniques.

One difference is that, for distance/time-of-flight estimation, you'll want to keep track of the total length of the ray. Also, you'll typically have only one "light source", which is located at the same position as the "camera", which might allow some extra optimizations. (However, if you add the possibility of radar jamming into the mix, this is no longer always the case.)

The tricky part will be in coming up with realistic values for the radar reflectances of various surfaces, as well as modelling any relevant atmospheric effects as well as reflections from the sea surface. Also, at longer wavelengths, diffraction effects (which cannot be fully modeled by ray tracing) start to become more significant; however, I think the typical wavelengths used for modern marine radar should be short enough for these to be mostly negligible.

In any case, most of the basic code should be the same for both radar and sonar, so if you're going for a realistic implementation of one, you might as well start with that and then reuse the framework for the other.

share|improve this answer
the radartutorial page is really helpful, thx! – Hawk66 Dec 2 '12 at 10:33

I'm assuming you're talking about something like the sonar screens seen in movies, with a line sweeping about in a circle. If so...

Address the basic model first (with no parameters), using a 2D circular line sweep. There are a couple of ways you can do this:

Continuous linear collision detection

  1. Set up a class representing a line (not rays -- the difference being that lines have endpoints). Ensure that the class supports check intersection of one line against another line eg. Line.intersect(Line a, Line b). Also make sure it internally encapsulates the trig for rotating the line. Countless vector, ray and line classes exist online for easy reference. Test your line class and be sure it works.
  2. Each nearby vessel will need to have their silhouettes constructed as individual lines, or alternatively they may be represented as a circle or set of circles. Circles may be a little cheaper to calculate collisions against.
  3. Now test your sweeping line against every line, or circle, constituting every vessel in detection range, to see if there are any hits. If so, register the hit on your display.

Quantised grid collision detection

  1. Set up a regional grid representing the larger area in which naval action is taking place.
  2. Set up a local grid representing the area currently surrounding the player vessel. This area will essentially a subset of the region's cells, at some (x, y) offset dependant on player vessel position.
  3. Set up your surrounding vessels by marking each grid cell they occupy, a bit like Battleships. How you discern occupation of cells is up to you -- some vessels may be rotated, for instance, making this a little more tricky.
  4. Set up your angle of your sonar line (per update).
  5. Using trig, calculate the dx and dy of the line. Now walk those dx, dy steps in the local grid, moving out from the centre (player position) to the edge of the detection circle, and on each step check to see if you've hit a cell where an enemy vessel already exists. This is again reminiscent of Battleships, though instead of plotting single discrete points to check for a hit, you are plotting a line of points until a hit is found (and possibly beyond the first hit, as well, out to the edge of the sonar radius).
share|improve this answer
Thx for your explanations, but no I'm not interested in displaying a radar screen. The question deals with a simulation about radar detection. I've updated my question to make this clearer – Hawk66 Dec 1 '12 at 21:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.