set max_speed seems broken using the group move widget....

set max_speed seems broken using the group move widget....

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

set max_speed seems broken using the group move widget....

Post by smoth »

Code: Select all

setSFXoccupy(setSFXoccupy_argument)
{	
terraintype = setSFXoccupy_argument;	

		if(terraintype == 2)
		{	
		SET MAX_SPEED to [4]; 	
		speedMult = 4;
		}
			else
			{	
			SET MAX_SPEED to [1.0];	
			speedMult = 2;
			}
}
is used in grts to give my amphibs a boost when in water. Now on my "juagg" the faster move animation is triggering(what speed mult does) which tells me that the setSFXoccupy is in fact working but they get none of the speed boost.

since I cannot embed flash here:
http://www.youtube.com/watch?v=BMDnNgYFm5g
Watch this video notice that when this unit is in water, it's max speed is higher and it can really truck it. This is now broken in spring, if you try the latest grts, the land and sea speed are the same for this unit. STRANGE. What is even stranger is that it seems to be linked to when you move a group in the water. Singular units(often) move correctly.

Any ideas? It may be a bug I just noticed as much of my work has not been on a per unit basis but I wanted to get a discussion about what is going on started so I can collect enough info to file a mantis report.
Last edited by smoth on 02 Dec 2010, 20:31, edited 1 time in total.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: set max_speed seems broken using the group move widget....

Post by smoth »

WOW, ok, please move to lua forum
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: set max_speed seems broken using the group move widget....

Post by FLOZi »

Group move widget probably issues that magic command that every forgets which makes a group move at the same speed, only it gets the speed wrong because it doesn't know about the change activated in cob.

Maybe?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: set max_speed seems broken using the group move widget....

Post by smoth »

maybe but still this thread needs to be moved to lua instead of dev. I thought it was an engine bug at first.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: set max_speed seems broken using the group move widget....

Post by aegis »

moved
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: set max_speed seems broken using the group move widget....

Post by knorke »

This is now broken in spring
Might want to give more detail when it broke and when it still worked, now=in master?

maybe related:
i think its the crtl hotkey to move units at the same speed. (=speed of slowest unit) (without group move widget)
anyway i made a unit that kind of "deploys" by setting its speed to 0 and I think I remember correctly when ordering that now stationary around with other units, other units would drive in their normal speed instead at the speed of the slowest unit like they usually do. Which would have been 0. So I think changed unitspeed is ignored by crtl-move and probally by widget too when adjusting the speed of the group. Just do make clear: the 0 speed unit still did not move but other units did not adjust their speed.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: set max_speed seems broken using the group move widget....

Post by smoth »

not just groupmove but custom formations as well

So it has more to do with lua issued commands vs user issued move commands.

seems that nio was noticing this as well as there was a lack of setting the wanted_speed whenever a lua move command was given. Where as a user issued command does
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: set max_speed seems broken using the group move widget....

Post by smoth »

Here is a high-res video:
http://www.smoth.net/files/luabug.wmv(26 megs)
showing the issue that is happening.

(the file size is not the audio but the video because I wanted it to be sharp enough for you to see the actual unit movements instead of a blob.)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: set max_speed seems broken using the group move widget....

Post by smoth »

I need more input so I can go make a proper mantis as to not send kloot/jk/whoever on a wild goose chase, can someone post some more thoughts?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: set max_speed seems broken using the group move widget....

Post by jK »

Maybe echo something when setting MAX_SPEED in COB/Lua?

Just an idea, but it maybe that the move command is given before the MAX_SPEED one and the code that handles given MAX_SPEED during an ongoing move command fails somehow.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Re: set max_speed seems broken using the group move widget....

Post by Kloot »

The problem is that like many widgets CustomFormations (v3.2) gives each unit an individual command via GiveOrderToUnit, which issues a NETMSG_AICOMMAND rather than a NETMSG_COMMAND and those do not get processed through the same channels (the former are fed directly into the CommandAI's, the latter also causes CMD_SET_WANTED_MAX_SPEED commands to be inserted, etc).
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: set max_speed seems broken using the group move widget....

Post by Niobium »

Kloot wrote:The problem is that like many widgets CustomFormations (v3.2) gives each unit an individual command via GiveOrderToUnit, which issues a NETMSG_AICOMMAND rather than a NETMSG_COMMAND and those do not get processed through the same channels (the former are fed directly into the CommandAI's, the latter also causes CMD_SET_WANTED_MAX_SPEED commands to be inserted, etc).
So what would be the best solution then? Manually issuing the SET_WANTED_MAX_SPEED's? Or is there a way to trigger the 'normal channel' logic for commands?
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: set max_speed seems broken using the group move widget....

Post by smoth »

Honestly I am unaware of any other way to give an order to a unit beyond give order, is there something I am missing?
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: set max_speed seems broken using the group move widget....

Post by TheFatController »

I ran into this problem with a synced move order IW was giving its Royal Guards.

I'm certain that CMD.MOVE issued by Lua used to do the appropriate issuing of CMD.SET_WANTED_MAX_SPEED but now it doesn't and the solution looks something like:

Code: Select all

GUARD_SPEED = UnitDefs[GUARD_DEF_ID].speed/30
...
Spring.GiveOrderToUnit(guardID, CMD.MOVE, {moveX, moveY, moveZ}, 0)
Spring.GiveOrderToUnit(guardID, CMD.SET_WANTED_MAX_SPEED, {[1] = GUARD_SPEED}, 16)
On every move order.


I have also noticed that CMD.SET_WANTED_MAX_SPEED doesn't work reliably in a widget environment so people may want to watch out for this - I was writing some experimental widget code to see if I could stop the engine pushing units (here it is using Wait: http://consternationstation.com/mirrors/pushtest.avi) and I was trying to get it working by setting the speed down with CMD.SET_WANTED_MAX_SPEED; some units got stuck at snailspeed no matter how many times the widget issued a faster CMD.SET_WANTED_MAX_SPEED so I have a feeling it may also be a bit buggy anyway...
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: set max_speed seems broken using the group move widget....

Post by Niobium »

I've updated custom formations to v3.3 which now emulates springs SET_WANTED_MAX_SPEED orders (and the control modifier). So for those having problems with unit speeds you will want to check it to see if it solves them (for everyone else, you should update anyway).
Post Reply

Return to “Lua Scripts”