Help on Lua Widgets
Moderator: Moderators
Help on Lua Widgets
Hi there, stupid question:
could anyone please tellme where to find info on how to USE Lua Widgets?
For example, i would like to know 2 use Custom Formations.
http://spring.clan-sy.com/wiki/Lua:WidgetDirectory contains nothing useful.
Thanks
could anyone please tellme where to find info on how to USE Lua Widgets?
For example, i would like to know 2 use Custom Formations.
http://spring.clan-sy.com/wiki/Lua:WidgetDirectory contains nothing useful.
Thanks
Re: Help on Lua Widgets
Easiest is to open springdownloader go to widgets tab and select this widget..
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Help on Lua Widgets
To install widgets put them in Spring/LuaUI/Widgets. If the widget link is a lot of text put the text in a text document(.txt) and rename it to .lua.
To enable them ingame press F11 and click on the widget to enable/disable, use the mousewheel to scroll the list.
To enable them ingame press F11 and click on the widget to enable/disable, use the mousewheel to scroll the list.
Re: Help on Lua Widgets
Ok, then I didn't explain correctly then.
I have them installed an running, but I would like to know what does each Widget do and how to take advantage of them in game.
Example: custom formations. What does it do? Do I have to issue any command in order to line up my units? Any particular key does modify widget's behavoiur?
Thanks.
I have them installed an running, but I would like to know what does each Widget do and how to take advantage of them in game.
Example: custom formations. What does it do? Do I have to issue any command in order to line up my units? Any particular key does modify widget's behavoiur?
Thanks.
- very_bad_soldier
- Posts: 1397
- Joined: 20 Feb 2007, 01:10
Re: Help on Lua Widgets
Where do you get widgets without at least a brief explanation? You should really change your dealer.
Whats wrong about Licho's suggestion?
When having multiple units selected you can draw a line when giving a move command while hold right-click pressed. Thats what customformations is doing.
Whats wrong about Licho's suggestion?
When having multiple units selected you can draw a line when giving a move command while hold right-click pressed. Thats what customformations is doing.
Re: Help on Lua Widgets
Sorry about the off topic, but I think the custom formations widget is one of the single greatest RTS UI innovations ever done.
Re: Help on Lua Widgets
Custom Formations can be further improved, like this:

ignore those two stray crosses plz ^^

ignore those two stray crosses plz ^^
- SwiftSpear
- Classic Community Lead
- Posts: 7287
- Joined: 12 Aug 2005, 09:29
Re: Help on Lua Widgets
I'd personally prefer the current one, but ya, it'd probably nicer for some players.imbaczek wrote:Custom Formations can be further improved, like this:
ignore those two stray crosses plz ^^
Re: Help on Lua Widgets
the current one makes units put each other of of the line and forces you to draw zigzags if you want a proper box. also, the default rmb-drag does box your units if there's too many of them to fit in one line, so there's also the consistency argument.
- SwiftSpear
- Classic Community Lead
- Posts: 7287
- Joined: 12 Aug 2005, 09:29
Re: Help on Lua Widgets
I prefer minute row control. Tactically speaking boxes are bad, they block your rear units from firing until your front units are dead, effectively halving your group DPS. There are exceptions, like artillery and stuff, but ideally you should be grouping those into separate groups and then just using the widget to draw two lines.imbaczek wrote:the current one makes units put each other of of the line and forces you to draw zigzags if you want a proper box. also, the default rmb-drag does box your units if there's too many of them to fit in one line, so there's also the consistency argument.
[edit] I'll seed the point of crowding. It should force overcrowed units into a back row as centered as possible to the group. But in all cases of non overcrowedness it should behave as it currently does... Maby a custom keystroke for more complicated formations, but honestly I think they will be more of a curiosity then something legitimately useful. Single file rows are simply the most efficient tactical shape you can form.
Re: Help on Lua Widgets
i agree that lines are the most efficient, i wouldn't like the widget to make a box when a line would be possible; the problem now is that due to units pushing each other you end up with units scattered all around the place if there's enough of them.
Re: Help on Lua Widgets
There could also be one more improvement, involving mixed forces:
Say you had some slashers and levelers, or some morties, a few cans, a 2 jammers and a radar bot:

Since i use mixed forces alot, it would be nice if the unit types stayed mixed in the formation, because currently units of different movetype really tend to get grouped on one side f the formation.
On another note, this is one of the features that deserve a software patent, then we could troll games who implement it for monies and get free publicity :) Seriously, the amount of original ideas and great accomplishments in spring is nothing short of staggering.
Say you had some slashers and levelers, or some morties, a few cans, a 2 jammers and a radar bot:
Since i use mixed forces alot, it would be nice if the unit types stayed mixed in the formation, because currently units of different movetype really tend to get grouped on one side f the formation.
On another note, this is one of the features that deserve a software patent, then we could troll games who implement it for monies and get free publicity :) Seriously, the amount of original ideas and great accomplishments in spring is nothing short of staggering.
Re: Help on Lua Widgets
custom formations thread: "Also you can now use ALT to use a random algorithm."Beherith wrote:There could also be one more improvement, involving mixed forces: ......
(perhaps I should put it in the tooltip)
Only doable with a lot of math and nearly impossible to compute in a decent time, yeah you would even need a neural network to find out in which direction the box should expand etc.imbaczek wrote:Custom Formations can be further improved, like this:
ignore those two stray crosses plz ^^
Not to think of all those tasks without a decent solution (-> what if you draw a circle, spiral, a cross, ...).
Re: Help on Lua Widgets
expansion direction wouldn't be that hard: take average position of all selected units, then take the average position of the custom formation line (average segment endpoints), subtract. the resulting vector, when normalized, gives you an approximate (= hopefully good enough) direction of expansion. shapes could be handled like this:

not perfect but will get the job done as long as it's an option.

not perfect but will get the job done as long as it's an option.
Re: Help on Lua Widgets
Does this mean that I could, say, put my artillery behind my fighting units, alt+custform them, and expect them to retain their formation? Please say yes please say yes please say yes please say yes please say yesjK wrote:custom formations thread: "Also you can now use ALT to use a random algorithm."Beherith wrote:There could also be one more improvement, involving mixed forces: ...[img]...[/img]...
(perhaps I should put it in the tooltip)

Re: Help on Lua Widgets
Custom Formations could do with lining up units as quick as possible.


Re: Help on Lua Widgets
:/ the one I'm using does the one on the right.
Re: Help on Lua Widgets
Just did a load of testing on this and it seems that this only occurs when you have a smaller group of units. I tested with 8 Peewees, lined them up then drew the same length line just ahead of them. They did the formation on the right, the good one.aegis wrote::/ the one I'm using does the one on the right.
I tested with 30 peewees, the one on the left happened :<
Edit: Nvm, they seem to form into left or right diagrams randomly... Dunno if it depends on which way the units are facing. Unit type seems irrelevant.
- SwiftSpear
- Classic Community Lead
- Posts: 7287
- Joined: 12 Aug 2005, 09:29
Re: Help on Lua Widgets
I think the algorith goes through the list of units putting them one after another into the shortest pathed location that isn't already taken. So you get weird results as a unit may be closest to X path location when it's turn comes to select a spot, so it selects X spot... but Y unit, who's turn comes later, although they are much closer to X spot they are forced to choose a different spot because X already is taken.
When units are in a straight line adjacent to eachother the closest location each unit can choose is the location directly across from them, but in more complicated formations and groups it breaks completely, and you get some very weird and inefficient movement in order to get in assigned locations.
A good algorithm would use imbaczek's calculation, list the units in order of closeness to the middle location of the line, and then have the units choose a spot based on thier location relative to the calculated center axis vs the other units in the group. If 2 units are directly parallel to the line, then they use the old system of choosing the closest location VS the other unit, so the unit closer to the closest location gets put there, and the farther unit has to go a little bit farther to the next closest location.
When units are in a straight line adjacent to eachother the closest location each unit can choose is the location directly across from them, but in more complicated formations and groups it breaks completely, and you get some very weird and inefficient movement in order to get in assigned locations.
A good algorithm would use imbaczek's calculation, list the units in order of closeness to the middle location of the line, and then have the units choose a spot based on thier location relative to the calculated center axis vs the other units in the group. If 2 units are directly parallel to the line, then they use the old system of choosing the closest location VS the other unit, so the unit closer to the closest location gets put there, and the farther unit has to go a little bit farther to the next closest location.
Re: Help on Lua Widgets
JAZCASH: the cutoff point is defined in the widget to be around 17 units IIRC (it was like that last time I looked.) The problem is that doing the Right Thing is very CPU-expensive and should probably be written in C, which we don't allow for security reasons. A divide and conquer heuristic could work here, ie. split the selected group into squads and assign segments. This could be done more or less efficiently by leveraging the engine's spatial queries (GetUnitsIn*) so there's no pairwise distance comparisons in Lua to determine squads.