Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#1871 closed enhancement (fixed)

[PATCH] Display the number/max of gatherers when selecting a ResourceSupply

Reported by: mimo Owned by: peter
Priority: Should Have Milestone: Alpha 14
Component: Core engine Keywords: gui resourcesupply patch
Cc: Patch:

Description

Now that there is a max number of gatherers for the ResourceSupply, it would be useful to display it as well as the number of gatherers -when we select such a ResourceSupply. Here is a patch to do it. Feel free to change the icon : I've temporarily taken the repair.png, but a more adequate one would be better. In the same way, I also display the number of builders for a foundation. This number of builders was computed using a timer counting the number of active builders in one second. I think the way to compute the gatherers in ResourceSupply is more robust, so I've changed Foundation.js to use this same method (but I could provide a patch without this last change if necessary).

Attachments (1)

numworker.diff (10.3 KB ) - added by mimo 11 years ago.

Download all attachments as: .zip

Change History (11)

by mimo, 11 years ago

Attachment: numworker.diff added

comment:1 by mimo, 11 years ago

Keywords: gui resourcesupply patch review added

comment:2 by Kieran P, 11 years ago

Milestone: BacklogAlpha 14
Type: defectenhancement

comment:3 by alpha123, 11 years ago

This works well and has useful functionality, but after some discussion on #0ad-dev, it was decided we don't want this until #599 is finished. The problem is that, after scouting the enemy base once, you can select any of the entities near it to see what they are gathering and with how many units.

But thanks for the patch. The only thing I'd change is "number/max of gatherers" to "Current/max gatherers". Also the changes to Foundation.js no longer apply cleanly.

comment:4 by mimo, 11 years ago

I agree with the problem you mention which I did not realize before. So thanks for the review. But may-be instead of waiting for #599, it would be better to make this information visible only by the player (and its allies with whom it shares the los) ?

comment:5 by alpha123, 11 years ago

There are 2 ways to do that: either make entities outside of LOS unselectable or just don't display the gatherer information if the entity is not in LOS. I would be fine with either of those, but both are probably complicated enough it seems like duplicated effort not to wait for #599.

IMO, this needs some more design discussion.

comment:6 by mimo, 11 years ago

Yes both ways would be fine for me too, and I've the impression it would be quite easy to implement compared to #599 which looks much more involved. Here we just need a new function from GuiInterface which tells if an entity is in the player's LOS or not ?

I'm afraid that #599 will require quite some time (it's already 3 years old, with no activity since 8 months) to be finalized, and it would be a pity to prevent other improvments because of that. Once #599 is here, switching such improvments to it would be trivial. But as you say, may-be some design discussion are needed.

comment:7 by wraitii, 11 years ago

Showing this information only for stuff in LOS should be trivially easy (there is a "visible" status iirc for each player) but doesn't completely fix the issue: if another player sends a unit to gather from that resource, it will be counted, so the player could "cheat" slightly.

Proper way to fix this currently would be to actually recount by checking for every gatherer if they're visible or not by the player (and change the tooltip to "X known/Y maximum"). This is obviously a bit slower, but if it's lazily done when a resource is selected, given that the number of gatherers are low, it should be possible without too much overhead.

Note that UnitAI doesn't really consider those issues so you could still tell if a resource is full by trying to send a worker to gather there. Iirc, it should refuse to start gathering if the resource is full. Perhaps that can also be lazily recounted in that case, when, for example, the resource is out of LOS (as this is basically the only case where this would actually be an issue. If the resource is in LOS, then the player most likely already has all the information he wants). This can actually sort of be used as a cheating mechanism right now, even though the info gathered is basically nil.

Last edited 11 years ago by wraitii (previous) (diff)

comment:8 by historic_bruno, 11 years ago

I'm not convinced that the LOS problem should block this patch. Am I right in thinking you could watch the resource supply's amount decrease and basically infer the same information? It's not the only bug related to #599, not the most serious one (seeing territories and buildings magically appear in fog of war are more serious cheats IMO). We know the proper solution is to fix #599 so let's just do that and not hack around it here :)

Last edited 11 years ago by historic_bruno (previous) (diff)

comment:9 by peter, 11 years ago

Owner: set to peter
Resolution: fixed
Status: newclosed

In 13541:

Display current/max gatherers or builders when a resource or foundation is selected. Based on a patch by mimo. Fix #1871.

comment:10 by alpha123, 11 years ago

Keywords: review removed

Thanks for the patch. :) I included the foundation stuff as well since it is much cleaner than the old code IMO.

Note: See TracTickets for help on using tickets.