[patch] Movelines following height of the map

[patch] Movelines following height of the map

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

[patch] Movelines following height of the map

Post by colorblind »

I've take the liberty of writing a patch that makes the movelines follow the height of the map. That way they won't disappear into mountains or other high objects.

Here's what it looks like:

Image

And here's the diff file.
It doesn't work for the commander yet; I guess his commands are drawn somewhere else. And only the move command is drawn this way. But extending it to other commands should only be a matter of copy-and-paste.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

yay! I've hated the drop below heightmap thign for ages.
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

Its drawn in CBuilderCAI instead of CMobileCAI for commanders and other build vehicles. Otherwise it looks good although it might become a bit slow with many units selected maybe.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

When many units are selected and they share a common destination, they shoudltn all ahve their own line, instead a polygon should be drawn around then and then a single line from the group polygon to the destination
or in the case fo simple formation polgyon to polygon. The polygon should be either a circle or rectangle.
colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

Post by colorblind »

You're right SJ. I've just tested it with 250 jeffies going from one corner of the map to another. When I didn't hold down shift I got 31 fps, but with shift pressed only 7 fps remained. Mind you I have a slow pc (P3 866Mhz).

The only obvious way to speed up the algorithm I wrote is to make the numbers of divisions lower, i.e. change

Code: Select all

num = ceil(dpos.Length() / 4);
to

Code: Select all

num = ceil(dpos.Length() / 8);
or even higher. But then the lines will get ugly and start to go below the terrain if you have steep slopes.

Perhaps Alantai's suggestion deserves some attention. But it'll take far more time to implement that then to get myself a faster computer :).
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I'm sure there's already algorithms to plot the rectangle, just determine which face is facing the target and draw the line from the middle.
Gnomre
Imperial Winter Developer
Posts: 1754
Joined: 06 Feb 2005, 13:42

Post by Gnomre »

Is there any way to just make them show up as a straight line over all terrain regardless of the height?
User avatar
Min3mat
Posts: 3455
Joined: 17 Nov 2004, 20:19

Post by Min3mat »

how do you use that file looks cool for singleplayer at least
SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ »

Thats probably the easiest way gnome. Just need to turn of depth testing and writing while drawing. Only question is if one should let it draw above units and particles or only above terrain.
colorblind
Spring Developer
Posts: 374
Joined: 14 Mar 2005, 12:32

Post by colorblind »

To save my work from perishing I tweaked the algorithm a bit. The diff file has been updated appropriately. I now only drop from 31 to 15 fps instead of 7 :).

And for the curious among us I've uploaded a custom exe.
Betalord
Former Engine Dev
Posts: 543
Joined: 29 Jun 2005, 09:31

Post by Betalord »

You're right SJ. I've just tested it with 250 jeffies going from one corner of the map to another. When I didn't hold down shift I got 31 fps, but with shift pressed only 7 fps remained. Mind you I have a slow pc (P3 866Mhz).
Did you test it with the old algorithm when holding down shift with 250 jeffies? It's drawing the lines that takes time not the algorithm itself, I believe.
Doomweaver
Posts: 704
Joined: 30 Oct 2004, 14:14

Post by Doomweaver »

Have it draw above everything, I reckon.
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj »

I have to disagree with your idea, Alantai.

I prefer having individual lines for units, because often my selection groups are very wide, or perhaps I have groups from numerous directions. It is likely that the selection would become increasingly inaccurate as my forces spread out.

A way to include your idea is perhaps to allow group lines for units in formations, or set to hotkey groups

-------------

On a different tangent, I'd personally like to see ETA values displayed on the shift lines. This doesn't necesserily have to be an actual clock function that counts down the seconds until a unit arrives at its target; it could be the colour of the line. You could have two primaries at either end of the spectrum, and as the line goes from one to the other, it indicates that the unit is closer (ETA wise) to its target. For example, say a yellow line indicates a unit is still 2+ minutes from its location, an orange line indicates that the unit is near its location, and a red line indicates that the unit's arrival is imminant. Useful for coordinating attacks from different points, keeping track of your units progress, making sure your units arrive at the same time (for example, launch your bulldogs, and when their line is yellow, launch the flashes), as well as being particularly useful with faster units (aircraft especially), whose ETA is difficult to estimate.
Although, if it chews into the CPU, disregard the idea.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Warlord, that can eb fixed by allowing multiple boxes. So lets say the box is hgue and there's a wide range of units, or two main clumps far apart both selected, then that box should be split into 2 boxes/circles and re-orientated so it fits better. And if units are randomyl spread and selected over a large area then perhaps the old way should go though it'd likely slow down.

So rephrasal. Units selected that're close to eachother should have a box or circle drawn around them with their line coming from the face of that box that faces the target rather than a line for each. Units tht are sparsely placed that're selected should use the current system. Both box/circled untis and ordinary sparsely placed units would have the patch above applied to them so they dotn dip below the terrain.

Does that suit better?

And I like the ETA and coloured lines thing, if ti does eat into cpu then it should be on offable. It would work well with the above suggestion too, and could be made to work specifically for those untis that are clumped together and selected and have the circle/box around them.
mongus
Posts: 1463
Joined: 15 Apr 2005, 18:52

Post by mongus »

The lines "float" over the hills and stuff. looks great.

2fps with 500 units (+-450 moving) , using simple formation and waypoints.

256ram1467mhzati9200

but its playable with less units paths showing. also, no crash! :)
User avatar
Tim Blokdijk
Posts: 1242
Joined: 29 May 2005, 11:18

Post by Tim Blokdijk »

I can't test the patch right now but still I have a comment.
Can the lines follow the actual path the unit is going to use?
I mean around obstacles like water, buildings and hi ground?

ETA is a great idea imo.
Why not have a dynamic line divisions relative to the FPS?
HellToupee
Posts: 59
Joined: 01 May 2005, 01:27

Post by HellToupee »

I would like it to draw line on hover over unit, and for units with a common destination should be a circle around them with a single line.
Post Reply

Return to “Engine”