Page MenuHomeWildfire Games

Allow entities to autoproduce.
Changes PlannedPublic

Authored by Freagarach on Mar 21 2020, 5:50 PM.

Details

Reviewers
wraitii
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Trac Tickets
#3914
Summary

This patch adds an Autoproduce tag to the production queue, which means that an entity bearing this tag will autoproduce when the queue is empty.
Currently a random template from the possible entities is chosen, but it might be better to specify a list of entities to autoproduce?

Also it would be nice to let users start/stop this behaviour via a button and to be able to specify a template and amount to autoproduce.

With D2657, it would become possible to let forests grow (autoproduce trees by trees).

Test Plan

Test, with the given template change, that entities are being produced automagically. Also test that when destroying a entity with the tag does not "steal" resources by starting another batch just before the entity is destroyed.

Event Timeline

Freagarach created this revision.Mar 21 2020, 5:50 PM
Owners added a subscriber: Restricted Owners Package.Mar 21 2020, 5:50 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1875/display/redirect

wraitii requested changes to this revision.May 30 2020, 3:31 PM
wraitii added a subscriber: wraitii.

Other RTS games generally have a few buildings with this feature (I'm thinking of the terracotta army in RoN, but Age I think also has buildings like that).

I do think you should go a little beyond what you've done here, namely:

  • Add a button to the GUI to auto-queue the current production.
  • Let the template specify whether the player can control the production queue, or the entity does its own thing and you can't do anything about it.

Most likely we either want an entity to autoproduce on its own and not let the player control it, or give the player full control and not auto produce, so I would simply make the schema an "or": either you <autoproduce>SomeTemplate</autoproduce> or you have the ability to set entities, technologies, ...

Adding a batch count is also a desirable feature, can be an attribute of autoproduce imo.


Let me know if you disagree with the above.

This revision now requires changes to proceed.May 30 2020, 3:31 PM
myou5e added a subscriber: myou5e.Aug 16 2020, 5:13 PM
myou5e added a comment.EditedAug 16 2020, 5:46 PM

Hey guys. I am new here. So I don't know exactly the process of contributing, and i generally use git, not svn. Here is the schema capability I would suggest to add to the templates for generality's sake.

Unit template

<Autoproduce>
  <One>
    <Entity>athen_infantry_spearman_b</Entity>
    <Quantity>3</Quantity> 
    <Time>30000</Time> <!--milliseconds, or seconds-->
  </One>
  <Two>
    <Entity>athen_cavalry_spearman_b</Entity>
    <Quantity>2</Quantity> 
    <Time>20000</Time> 
  </Two>
</Autoproduce>

I'm not sure exactly how to write this in the schema description, this is my attempt[with the required scaffolding added for JS].

<element name ='Autoproduce'>

  <oneOrMore>
    <anyName/>

    <element name='Entity'>
      <data type="string">
    </element>

    <element name='Quantity'>
      <data type="integer">
    </element>

    <element name='Time'>
      <data type="decimal">
    </element>

  </oneOrMore>

</element>

Here is the schema capability I would suggest to add to the templates for generality's sake.

Kinda late, but that schema looks good. Not sure about the time parameter, though.

This is indeed very similar to D3865: Auto-Queue feature.

What do you think about assigning Autoproduce to units instead of structures? I.e. if a unit is marked as autoproduce, then any structure that can train it will automatically added to queue regardless if Autoqueue is on or off in said structure. It could be a separate component or in existing component other than ProductionQueue (Cost, perhaps?).

Freagarach added a comment.EditedApr 19 2021, 11:32 AM

I think it makes more sense for the structure to be able to autoproduce than the entity be able to be autoproduced. It is also more easily modified in the structure. One might want a structure that automatically produces a type of unit, while for some other structure human intervention is necessary for the same unit.

Freagarach planned changes to this revision.May 8 2021, 9:55 AM

Easier to do now.