Page 1 of 1

custom formations lines do not look right (stipples spacing)

Posted: 15 Mar 2013, 18:05
by knorke
Drawing a line via right click, with a single unit selected: everything looks ok.
Multiple units selected: the lines and distances between them get very long, almost not visible.

Image
blue line = the path i dragged mouse in both pictures

I thought its a new bug in 93 but looks the same in 91. Or is it some setting? In xta the spacing is normal.

Re: custom formations lines do not look right (stipples spac

Posted: 16 Mar 2013, 03:25
by Niobium
The implementation of the varying line spacing (stipple) is... not good.

Code: Select all

local _,zoomY = GetCameraPosition()
zoomY = zoomY/470 --magic number with 20 units its 27 stipp with 30 its 39
local lineStipple = lineLength/((GetSelectedUnitsCount()-1)*zoomY)
--TODO fix the pattern and rest of math -so that always starts with half line and ends with half line
DrawFormationLines(tVerts, lineStipple)
  • Based on camera height which by itself doesn't have any relation to how the line will appear
  • Magic numbers...
  • ... with incorrect comments
  • GetSelectedUnitsCount multiplied by the camera height...
  • Note about fixing parts of the commit, but no fixes in following 6 months
If the goal is to draw a line that graphically indicates final positions then the drawing method should be rewritten to do so (all the information is available), not by taking the existing fixed-stipple based code and hacking it towards the goal by fudging the stippling amount.

Re: custom formations lines do not look right (stipples spac

Posted: 16 Mar 2013, 16:42
by knorke
yes, good points.
The widgets in 0k & xta seem different (did not look in detail for but example no uses of camera height etc) and work good, so I suggest just taking one of those.

Re: custom formations lines do not look right (stipples spac

Posted: 06 Apr 2013, 16:05
by PixelOfDeath
I made new visuals for that script:

http://springfiles.com/spring/lua-scrip ... ons2dotlua

Re: custom formations lines do not look right (stipples spac

Posted: 14 Apr 2013, 00:43
by Silentwings