-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow buildings to assist construction #1597
Comments
Sounds like what you really want is to have the unwanted side effects fixed. |
Since the implementation itself is a workaround, it would be nicer to not have to implement additional workarounds for the workaround. |
Things can be immobiles instead of true buildings purposefully so fixes should be made regardless. |
Took a look at this, and one problem I see is in how orders are given, right now factories have most/all of the non unit creation commands assigned to the built unit queue. Having factories support the same commands would make it a bit problematic to know where the queued command needs to be put. For example, if a guard/repair command is given to the factory, should it be given to the to be built units, or to the factory itself. Not sure how gui could handle that. |
What about for buildings that aren't factories, i.e. construction turrets? For UI for factories, we could split the command palette in two, one for the factory itself, one for its waypoints. |
Add |
For those it wouldn't be a problem, but I think there's no building ai class atm, main distinction now is movable or factory, maybe we could introduce an immobile AI to be the parent of factory, or make some specialization of factory, or just not do anything special in that case, but probably would be good... not sure if needed at this point yet. |
I got some advances here, but would like some feedback. I have a working implementation of factories able of guard, repair and fight commands. You can check this branch or this commit to see more or less what this needs. This is just a proof of concept implementation, so please don't roast me XD. What this shows is basically a lot of code from Builder.cpp and BuilderCAI.cpp is needed with pretty minimal changes, just removing/changing some parts where movement is used. Adding resurrect and terraform will add even more code but shouldn't be much more difficult. Of course all of this needs to be refactored to share code. Also, the commands should work for any buildings, not just for factories, I just merged them there to have a feeling of the difficulty. Code now is normally shared among AIs and unit types through inheritance, and there's high coupling among unit types and cais, specially for The problem I see, is how the inheritance graphs (for unti types and command AIs) are constructed at the moment: Right now, I think buildings can be using any of Regarding command AI, ideally, there would be some code that could be shared among For unit types it could be more simple since there's already a Building type that could probably be used, although a BuilderBuilding could be included between Building and Factory. Would like to hear feedback, or ideas for other possible approaches. -- teaser screenshot with working "building" nanoturrets (using Factory type and FactoryCAI atm). Yes, they look the same :P, the only advantage atm (for nanoturrets) is after getting transported they always end in cardinal direction instead of sometimes getting slightly rotated XD. |
Extracting |
Since those action implementations don't seem to be extremely coupled among themselves, also metal extractor behaviour seems to be pretty loosely coupled... I'm thinking maybe trying a composition approach could be worth it, where some sort of Behaviour/Action base class is created that can be added to any CommandAI independently at runtime. So, these are the ways I can think of, so CommandAIs could be refactored to allow for builder commands (and possibly also extractor behaviour) to be used in more CommandAIs:
|
Currently a building with buildpower cannot assist other construction, only perform its own i.e. be a factory.
Due to this, construction turrets are implemented as mobile units with zero speed, but this has unwanted side effects, e.g. radar ghosts do not appear in fog because they are technically not buildings.
Allow buildings with buildpower to assist other construction, supporting the full set of building unit def tags that mobile builders use.
One consequence of this is that we will need to decide what counts as factory. One option is a factory is a unit with buildpower, a buildlist, and can start construction within its own footprint. Thus, SupCom's Fatboy would count as a factory, since it builds units inside itself, but BAR's combat engineers wouldn't, since they build units beside themselves.
The text was updated successfully, but these errors were encountered: