Consider I want to have a filter that filters out units in area-attack or area load. For example, I might wish to skip all units cheaper then 100 M in an area-attack for strategic bombers, so that they concentrate on bigger targets. Or, if I am making an airdrop, I may wish for the heavier units to get more priority over lighter ones.
Any ideas how it can be done? I figured that it would require messing with command queues, but I have no idea where to start. The only callin i have found useful is allowCommand, but then I would have to duplicate the area-order logic in LUA which is redundant.
Filtering for area orders
Moderator: Moderators
Re: Filtering for area orders
maybe look at this?
Smart Area Reclaim
Smart Area Reclaim
Re: Filtering for area orders
Hmmm, I think it will troublesome to issue unit-weighted attack priority, you don't know an unit's metal value unless it in within LOS. Thus, the filtering would only work on those units that are currently withing LOS, not very practical imo. If I'm wrong, please correct me.
About loading/unloading in different order, yes, I think you can do it. It's just to select a group of units and sort the group based on metal value.
Have a look at my keyfix widget for an example. It selects best transporter based on type and distance.
http://springrts.com/phpbb/viewtopic.ph ... pe#p501645
About loading/unloading in different order, yes, I think you can do it. It's just to select a group of units and sort the group based on metal value.
Have a look at my keyfix widget for an example. It selects best transporter based on type and distance.
http://springrts.com/phpbb/viewtopic.ph ... pe#p501645
-
- Posts: 53
- Joined: 15 May 2007, 12:33
Re: Filtering for area orders
Well at the moment loading is a priority. And the most important thing is that in the best case scenario I'd like the immediate unit state to affect, not the state when the order is given. For example, if a stunned enemy unit is to be loaded into air transport, transport should check if the unit can still be loaded when it arrives to the load area, and keep on checking until the unit can be loaded.
So in the end i think that the best course of action will be to monitor a trans in a loop, when it gets close to target area start looking for units to load in a similar way to reclaim widget.
So in the end i think that the best course of action will be to monitor a trans in a loop, when it gets close to target area start looking for units to load in a similar way to reclaim widget.
Re: Filtering for area orders
the concepts in my SmartAreaReclaim and SmartSelect widgets might help get someone on the right track
SmartSelect has some very fast methods of locating and filtering units inside an area. SmartAreaReclaim shows how you can play with area commands
as for not duplicating commands, you can just check to see if the next command is an area load to decide when you want to start scanning, then insert your load command at the start of the queue in place of the area load once you've made a decision (maybe detect if the unit is on repeat, if so, cycle the area load to the end of the queue instead of removing it)
SmartSelect has some very fast methods of locating and filtering units inside an area. SmartAreaReclaim shows how you can play with area commands
as for not duplicating commands, you can just check to see if the next command is an area load to decide when you want to start scanning, then insert your load command at the start of the queue in place of the area load once you've made a decision (maybe detect if the unit is on repeat, if so, cycle the area load to the end of the queue instead of removing it)
-
- Posts: 53
- Joined: 15 May 2007, 12:33
Re: Filtering for area orders
Yeah, that was the way I saw this. I was just kinda hoping there is a faster approach. But if there is none I will probably make a gadget/widget that would be general-purpose filter for are commands and then build transporting thing on top of that. Then if the functionality is merged into engine not much work will be wasted.
Re: Filtering for area orders
SmartSelect runs something like six filters on 5k units with almost zero slowdown in my testing... and the method's already there, you'd just need to change the distance check to a circle for some commands.
-
- Posts: 53
- Joined: 15 May 2007, 12:33
Re: Filtering for area orders
Well if the performance is not a problem then I might just use it. For slow-update it should be quite OK.
Re: Filtering for area orders
There are other ways these days (duno if it is faster):
the event `UnitCommand` gets directly called after `AllowCommand`.
the event `UnitCommand` gets directly called after `AllowCommand`.