tldr: This thread is about how to solve a particular programming problem relevant to game dev. I am working in C# / XNA but suggestions in any language would be greatly appreciated.
Consider a top-down view strategy game. Whether it is real time, turn based or a hybrid of the two the situation will arise where the user has selected a unit and needs to instruct it where to move, shoot or perform some other action with a target position. Often there will be obstacles or modifiers (range limits, walls, trees, other units) to contend with.
In my current project I want to make it a bit easier to make these decisions by drawing a line from the currently selected unit to the current position of the cursor. This line would be color coded to indicate the chance of success of the action and what things might be getting in the way.
EG: When choosing a target for a ranged attack, the line would be green if there is a high chance of success and shade into red as success becomes less likely (due to long range or other game factors). Furthermore, the shading on the line is drawn out in such a way that the user can tell where these obstacles are. It starts out green at the source and shades to red or black as it goes along and encounters penalties or total obstacles.
I should point out that the system I am thinking of here is not tile-based.
This has been used to good effect in such games as
Warhammer Squad Command and
the Close Combat series for the PC.
Where I could use some guidance is how to go about structuring my map data and what kind of algorithm to use for generating this colored line. EG: Links to articles, how-tos, example code etc... I have a few basic ideas about how to go about this but everything I have come up with so far is a very brute-force approach and will likely cause performance problems.
Posts
Some of these links might be of help, as stolen from the SA game thread. I might be able to help if you have more specific questions on implementation.
Doesn't seem that hard, unless I've misunderstood the problem.