ModelLib & Scenario EditorThere are several libraries ( dll ) which are intended to be used in the various exe.
One of these is ModelLib, the "model" in programming terms is the data being represented and this contains a class called Map. Which is (surprise) all about the map. This is where what terrain is where is stored and has methods to read that data.
In order to give orders to units we want the user to choose a unit and drag to a waypoint.
With a "rubber band" showing the line it would take. Just a line from start point to where you're dragging or moving the cursor.
This is gaming stuff ( I'm a business app developer ) so Ezra designs this sort of thing and knows about game specific things like working out what terrain a line crosses.
Maybe this is interesting to someone reading.
There's this thing called a Bresenham line algorithm
https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm.
Which Ezra "just knows" about and explained is very fast.
I've been prototyping something to see whether this'll work or not.
I grabbed this guy's code:
http://ericw.ca/notes/bresenhams-line-algorithm-in-csharp.htmlWhich is nice and efficient, I particularly like the use of yield.
We don't have a game solution yet so I've temporarily bolted this onto scenario editor.
I needed 2 points. Somewhere to go from and to, so I used a retreat point as starting point.
Turns out that algorithm is very fast and takes less than a millisecond.
My machine has a fairly recent i5 processor so it's reasonably fast but I'm testing this in debug mode so which is slower than optimised code.


I'm using faked terrain checking with woods, water and swamp as invalid for anything.
On the top image you can see the line crosses woods and is an invalid move.
On the bottom image the line crosses nothing invalid and is OK.
You can also see some debug info I've put in top right.
I'm using a stopwatch to check performance and you can see the milliseconds and "ticks" elapsed. ms 0 means less than one ms which is fast.
ConclusionThe experiment shows excellent performance.
I'd expect even an old i3 and maybe atom would be fine with this.