Droids in production

For AI and campaign script related discussions and questions
Post Reply
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Droids in production

Post by NoQ »

The original problem is as follows. Suppose some AI has 30 factories and 0 trucks. He wants to make a truck, so he orders all factories to produce a truck. Then, after producing 15 trucks, he can't really produce more, thus other 15 factories stall waiting for the truck to come out, which will happen only when some trucks die.

That sort of problem actually arises in the ultimate scavenger mod.

Is it possible to allow the script to find out what is the droidType of the thing being produced in a factory?
Is it possible to allow the script to find out whether a certain factory is stalled due to unit limit?
Etc.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Droids in production

Post by aubergine »

I'd love the following properties on factories:

.task: null if the factory is idle, otherwise a droid object defining the droid being built
.progress: one of the following:

* CHARGING - waiting for power before production starts
* IN_PROGRESS - production is in progress
* STALLED - production complete, but blocked from releasing the unit due to limits
* IDLE - factory is idle

I guess similar properties could go on a LASSAT too - .task would be a Position object (the target of the lassat) and .progress would be any of the above except BLOCKED (IN_PROGRESS = lassat has it's target and will fire soon).

I'd like to be able to cancel an order at a factory too - new function required for that? For example, if it's stalled or if I need to quickly create some other unit.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Droids in production

Post by NoQ »

In fact, i was thinking of some sort of "CHARGING" for buildings as well (is the structure that is BEING_BUILT already paid for?), this is a nice thing to know when trying to fix the no-gen hangs.
a droid object
I think it should be some completely different sort of object. It doesn't have x or y or order or action or health or armed, and it doesn't accept orders itself.
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Droids in production

Post by aubergine »

It does have x,y (of the factory) and it's health and armed would be 0 to start with until production is finished.

The reason I was thinking of a droid object is that it would let you access all the other properties of a droid, such as .cost, .body and .propulsion.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
dak180
Trained
Trained
Posts: 288
Joined: 01 Nov 2009, 23:58
Location: Keeper of the Mac Builds

Re: Droids in production

Post by dak180 »

Another thing that might be useful to know is if and which commander the factory output is assigned to (because when assigned to a commander a factory will not produce beyond the commander's control limit).
User:dak180
Keeper of the Mac Builds
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Droids in production

Post by Per »

Added new function (3.2+) called getDroidProduction(factory) that gives you a virtual droid object for inspecting what is next in the pipeline at a factory. It returns null if nothing is in the pipeline. Together with getDroidLimit(), this should be sufficient to handle the stalled production issue, I believe?
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Re: Droids in production

Post by aubergine »

Just the commander assign issue now Per - eg. if commander set to gather output of factory 2, when commander is full what happens to factory 2?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
User avatar
dak180
Trained
Trained
Posts: 288
Joined: 01 Nov 2009, 23:58
Location: Keeper of the Mac Builds

Re: Droids in production

Post by dak180 »

aubergine wrote:Just the commander assign issue now Per - eg. if commander set to gather output of factory 2, when commander is full what happens to factory 2?
Once the comander's control limit is reached it halts production at the end of the current stage (resource gathering or actual construction) and will resume when there is space for more droids under the commander's control (be it replacement droids or additional ones as the commander levels).

Keep in mind that artillery attached to a commander does not count towards its control limit.
User:dak180
Keeper of the Mac Builds
Post Reply