36 lines
1.4 KiB
Markdown
36 lines
1.4 KiB
Markdown
# Outline
|
|
|
|
Timeline of villager production
|
|
* should be able to duplicate them easily and make modifications to compare
|
|
* throws an error if a task is impossible and a warning if you get idle time
|
|
|
|
# Design
|
|
|
|
Was originally doing object-centric:
|
|
each thing contained all information about itself.
|
|
For example,
|
|
a Blacksmith was a thing (class) that had fields representing
|
|
a cost, a time to build, an Age requirement, etc.
|
|
However, this led to circular dependencies.
|
|
For example, a Blacksmith required Feudal Age,
|
|
and Castle Age optionally required a Blacksmith.
|
|
This made it difficult in Python to have Ages and Buildings in separate files.
|
|
They had to import each other,
|
|
which is not possible in any simple way in Python.
|
|
|
|
Instead, data is stored in an attribute-centric way.
|
|
Costs is a class,
|
|
and it holds costs for Blacksmith, Feudal Age, Militia, and everything else.
|
|
Dependencies is another class,
|
|
and Times (i.e., build or unit production times) is yet another,
|
|
and others are added as needed.
|
|
|
|
If you think of the information needed as residing in a table
|
|
with the rows representing entities (House, Villager, etc.)
|
|
and the columns representing attributes (Cost, Build Time, etc.),
|
|
we are storing the data by column rather than by row.
|
|
As an aside,
|
|
this is similar to what I've seen described as the fundamental difference
|
|
between object-oriented (row-based) and functional (column-based) programming,
|
|
though I'm still using classes and objects.
|