Opened 2 years ago

Closed 2 years ago

#6363 closed task (fixed)

Split tasks from ProductionQueue.

Reported by: Freagarach Owned by: Freagarach
Priority: Should Have Milestone: Alpha 26
Component: Simulation Keywords: refactoring
Cc: Patch: Phab:D4333

Description

As it stands now, the Production Queue (PQ) takes care of quite some stuff (producing units and researching techs). In my recent train trips, I've thought out some way to reduce its scope a bit.

Why: The PQ should only care about its queue, getting that done and delegating specific tasks to components specialised in those specifics.

How: This means that we should have two more components (for now).

  1. Researcher.
  2. Trainer (do notice it technically should be able to produce structures).

In this scenario, the PQ gets an order to produce a unit, it delegates that to the trainer component and adds an item to its queue to keep track of the progress. Here, the trainer does the hard work of resources, population etc.

Idem for the researcher component.

Caveats: One thing to discuss is how to handle doing work. Is it the PQ telling the specific component that it may do stuff on every timeout (seems sane), or keep it for the components itself (how to handle fractions of timeouts then?).

It undoes some of the work I've done towards having both a tech and a unit in the same queue item, but I think I was overengineering that anyway.

Change History (2)

comment:1 by Freagarach, 2 years ago

Owner: set to Freagarach
Patch: Phab:D4333

comment:2 by Freagarach, 2 years ago

Resolution: fixed
Status: newclosed

In 26000:

Split tasks from ProductionQueue.

The task of the production queue should first and foremost be that; a queue for production items.
Hence, the specifics of training/researching are delegated to specific components.

As a side effect, this improves the test coverage and fixes:

  • Resource not refunding when hitting the entity limit. Introduced in r25753 / rP25753.
  • Autoqueue changing when unable to spawn. Introduced in r25779 / rP25779.

Modders can change their templates using https://code.wildfiregames.com/P256.

Differential revision: https://code.wildfiregames.com/D4333
Fixes: #6363
Comments by: @Silier
Refs. #6364

Note: See TracTickets for help on using tickets.