#1387 closed enhancement (fixed)
[PATCH] Limit gatherers per resource
Reported by: | historic_bruno | Owned by: | wraitii |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 13 |
Component: | UI & Simulation | Keywords: | patch |
Cc: | Patch: |
Description
Currently you can order a ridiculous number of units to gather from a single resource. We need to enforce some sensible limits, whether it be farms, trees, or mines. It should be added as a new element to the ResourceSupply
component. Units can be tasked to gather normally, but when reaching the target, a check is performed on the number of current gatherers. The "extra" units can move on to a similar nearby resource or go idle (or we can add some kind of queue system where units wait for a slot to open, without constantly using the pathfinder).
Attachments (2)
Change History (17)
by , 11 years ago
Attachment: | Gatherers3.patch added |
---|
comment:2 by , 11 years ago
Attached diff, that allows limiting amount of workers per resource supply.
Tested following scenarios (with limit of 5 workers per field):
- built 2 fields, sent 6 workers to work in one field. One moved to the 2nd field and worked there
- built 1 field, sent 6 workers to work there. One worker went back to base and stood there idle
Now, the problem is - resource supply templates won't load, unless max number of workers is specified, so I guess there should be some discussion about these limits per each resource and it should be added to diff.
comment:3 by , 11 years ago
Summary: | Limit gatherers per resource → [PATCH] Limit gatherers per resource |
---|
comment:4 by , 11 years ago
Keywords: | patch review added |
---|
comment:5 by , 11 years ago
Milestone: | Backlog → Alpha 13 |
---|
by , 11 years ago
Attachment: | GathererLimits.patch added |
---|
comment:6 by , 11 years ago
Thanks or the patch crezax. It seemed to work (pretty good for a beginner :) ), but I think this behaviour should be handled more by UnitAI than by passively recounting now and then in ResourceSupply. Using you patch as a framework I've uploaded a new one.
Units will try to find a new nearby resource if there is one, and if none, they will return to the nearest dropsite. The information about gatherers is broadcast as a message for AIs (and I have updated qBot and Aegis to use them), and "Display Selection State" has been updated too. I have changed all basic templates to have a minimal number of gatherers, the numbers are basically based on "how many units approximately can go around said resource", feel free to discuss.
I have failed to have it bug (then again it took me a good 3 hours to get it to work. Thank god for the JS debugger), but I'd recommend to try it out anyway.
Two issues remaining: should a notification be sent? Formations also begin by walking towards the resource and then only break if there is not enough space. This could be annoying, particularly for treasures (which currently can only be gathered by 1 unit).
follow-up: 8 comment:7 by , 11 years ago
Good to know it wasn't that bad wraitii :) BTW, you mentioned JS debugger, when I tried debugging my code, I tried using http://trac.wildfiregames.com/wiki/JavascriptDebugging but I can't see 0ad/source/tools/jsdebugger/ directory in repository. Tried looking for index.html, jsdebugger etc without any luck. Is there something I'm missing, or is that tutorial outdated? I could really use having working JS debugger for future :)
comment:8 by , 11 years ago
Replying to crezax:
Good to know it wasn't that bad wraitii :) BTW, you mentioned JS debugger, when I tried debugging my code, I tried using http://trac.wildfiregames.com/wiki/JavascriptDebugging but I can't see 0ad/source/tools/jsdebugger/ directory in repository. Tried looking for index.html, jsdebugger etc without any luck. Is there something I'm missing, or is that tutorial outdated? I could really use having working JS debugger for future :)
Are you using the latest version from SVN/GitHub? It should be in there: https://github.com/0ad/0ad/tree/master/source/tools/jsdebugger
comment:9 by , 11 years ago
ok thanks :) somehow that directory wasn't there when I checked out SVN repository
comment:14 by , 8 years ago
Keywords: | review removed |
---|
Hey, I thought I could try doing this.
I have a small question though. Is there any way to check what a given entity is doing at the moment? Or at least check, if it's collecting suplies?
EDIT: nvm, found UnitAI.js