Skip to content
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

feat: update production #2670

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/apps/game/src/three/scenes/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ enum BuildingFilenames {
Stable = "stable.glb",
Storehouse = "storehouse.glb",
TradingPost = "market.glb",
Walls = "market.glb",
Labor = "market.glb",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed ? Labor should be the castle

WatchTower = "market.glb",
WorkersHut = "workers_hut.glb",
Forge = "forge.glb",
Expand Down Expand Up @@ -126,7 +126,7 @@ export const buildingModelPaths = {
[BuildingType.Stable]: BUILDINGS_MODELS_PATH + BuildingFilenames.Stable,
[BuildingType.Storehouse]: BUILDINGS_MODELS_PATH + BuildingFilenames.Storehouse,
[BuildingType.TradingPost]: BUILDINGS_MODELS_PATH + BuildingFilenames.TradingPost,
[BuildingType.Walls]: BUILDINGS_MODELS_PATH + BuildingFilenames.Walls,
[BuildingType.Labor]: BUILDINGS_MODELS_PATH + BuildingFilenames.Labor,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

[BuildingType.WatchTower]: BUILDINGS_MODELS_PATH + BuildingFilenames.WatchTower,
[BuildingType.WorkersHut]: BUILDINGS_MODELS_PATH + BuildingFilenames.WorkersHut,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const SelectPreviewBuildingMenu = ({ className, entityId }: { className?:
key !== "None" &&
key !== "TradingPost" &&
key !== "WatchTower" &&
key !== "Walls" &&
key !== "Labor" &&
key !== "Settlement" &&
key !== "Hyperstructure",
);
Expand Down
2 changes: 1 addition & 1 deletion client/apps/game/src/ui/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const BUILDING_IMAGES_PATH = {
[BuildingType.TradingPost]: `${BUILD_IMAGES_PREFIX}trading_post.png`,
[BuildingType.WorkersHut]: `${BUILD_IMAGES_PREFIX}workers_hut.png`,
[BuildingType.WatchTower]: `${BUILD_IMAGES_PREFIX}watch_tower.png`,
[BuildingType.Walls]: `${BUILD_IMAGES_PREFIX}walls.png`,
[BuildingType.Labor]: `${BUILD_IMAGES_PREFIX}walls.png`,
[BuildingType.Storehouse]: `${BUILD_IMAGES_PREFIX}storehouse.png`,
[ResourceMiningTypes.Forge]: `${BUILD_IMAGES_PREFIX}forge.png`,
[ResourceMiningTypes.Mine]: `${BUILD_IMAGES_PREFIX}mine.png`,
Expand Down
42 changes: 30 additions & 12 deletions config/deployer/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
scaleResourceCostMinMax,
scaleResourceInputs,
scaleResourceOutputs,
scaleResourceProductionByLaborParams,
scaleResources,
TickIds,
TravelTypes,
Expand Down Expand Up @@ -190,30 +191,47 @@ export const setProductionConfig = async (config: Config) => {
config.config.resources.resourcePrecision,
);

const scaledResourceProductionByLaborParams = scaleResourceProductionByLaborParams(
config.config.resources.resourceProductionByLaborParams,
config.config.resources.resourcePrecision,
);

for (const resourceId of Object.keys(scaledResourceInputs) as unknown as ResourcesIds[]) {
const outputAmountPerLabor = scaledResourceOutputs[resourceId];
const resourceCostPerLabor = scaledResourceInputs[resourceId];
const outputAmountPerBuildingPerTick = scaledResourceOutputs[resourceId];
const predefinedResourceBurnCost = scaledResourceInputs[resourceId];
const resourceProductionByLaborParams = scaledResourceProductionByLaborParams[resourceId];
const calldata = {
amount: outputAmountPerLabor,
resource_type: resourceId,
cost: resourceCostPerLabor,
amount_per_building_per_tick: outputAmountPerBuildingPerTick,
predefined_resource_burn_cost: predefinedResourceBurnCost,
labor_burn_strategy: resourceProductionByLaborParams,
};

calldataArray.push(calldata);

console.log(
chalk.cyan(`
┌─ ${chalk.yellow(ResourcesIds[calldata.resource_type])}
│ ${chalk.gray(`${ResourcesIds[calldata.resource_type]} produced per labor:`)} ${chalk.white(`${inGameAmount(calldata.amount, config.config)} ${chalk.yellow(ResourcesIds[calldata.resource_type])}`)}
│ ${chalk.gray(`Cost of producing 1 ${ResourcesIds[calldata.resource_type]} labor:`)} ${
calldata.cost.length > 0
? calldata.cost
│ ${chalk.gray(`${ResourcesIds[calldata.resource_type]} produced per tick, per building:`)} ${chalk.white(`${inGameAmount(calldata.amount_per_building_per_tick, config.config)} ${chalk.yellow(ResourcesIds[calldata.resource_type])}`)}
│ ${chalk.gray(``)}
│ ${chalk.gray(`Using Labor Burn Production Strategy:`)}
│ ${chalk.gray(``)} ${calldata.labor_burn_strategy.resource_rarity === 0 ?
chalk.red("Cannot be produced with labor") : `
│ ${chalk.gray(`Resource Rarity:`)} ${chalk.white(` ${calldata.labor_burn_strategy.resource_rarity}`)}
│ ${chalk.gray(`Depreciation Rate:`)} ${chalk.white(` ${calldata.labor_burn_strategy.depreciation_percent_num / calldata.labor_burn_strategy.depreciation_percent_denom * 100}%`)}
│ ${chalk.gray(`Wheat Burn Per Labor:`)} ${chalk.white(inGameAmount(calldata.labor_burn_strategy.wheat_burn_per_labor, config.config))}
│ ${chalk.gray(`Fish Burn Per Labor:`)} ${chalk.white(inGameAmount(calldata.labor_burn_strategy.fish_burn_per_labor, config.config))}`}
│ ${chalk.gray(``)}
│ ${chalk.gray(`Using Multiple Resource Burn Production Strategy:`)}
│ ${calldata.predefined_resource_burn_cost.length > 0
? chalk.gray(` Cost of producing 1 ${ResourcesIds[calldata.resource_type]}:`) +
calldata.predefined_resource_burn_cost
.map(
(c) => `
│ ${chalk.white(`${inGameAmount(c.amount, config.config)} ${ResourcesIds[c.resource]}`)}`,
${chalk.white(`${inGameAmount(c.amount, config.config)} ${ResourcesIds[c.resource]}`)}`,
)
.join("")
: chalk.blue("Can't be produced with resources")
}
: ` ${chalk.blue("Can't be produced with multiple resources")}`}
└────────────────────────────────`),
);
}
Expand Down Expand Up @@ -358,7 +376,7 @@ export const setBuildingConfig = async (config: Config) => {

const calldataArray = [];
const buildingResourceProduced = config.config.buildings.buildingResourceProduced;
const buildingCosts = config.config.buildings.buildingCosts;
const buildingCosts = config.config.buildings.nonResourceBuildingCosts;
const scaledNonResourceBuildingCosts = scaleResourceInputs(buildingCosts, config.config.resources.resourcePrecision);
const BUILDING_COST_DISPLAY_ROWS = 6;

Expand Down
6 changes: 4 additions & 2 deletions config/environments/_shared_.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { QUEST_RESOURCES } from "./utils/quest";
import {
RESOURCE_PRODUCTION_INPUT_RESOURCES,
RESOURCE_PRODUCTION_OUTPUT_AMOUNTS,
RESOURCE_PRODUCTION_THROUGH_LABOR,
RESOURCES_WEIGHTS_GRAM,
} from "./utils/resource";
import { TROOPS_FOOD_CONSUMPTION, TROOPS_STAMINAS } from "./utils/troop";
Expand Down Expand Up @@ -156,9 +157,9 @@ export const EternumGlobalConfig: Config = {
startingResourcesInputProductionFactor: STARTING_RESOURCES_INPUT_PRODUCTION_FACTOR,
resourceInputs: RESOURCE_PRODUCTION_INPUT_RESOURCES,
resourceOutputs: RESOURCE_PRODUCTION_OUTPUT_AMOUNTS,
resourceProductionByLaborParams: RESOURCE_PRODUCTION_THROUGH_LABOR,
resourceWeightsGrams: RESOURCES_WEIGHTS_GRAM,
resourceRarity: RESOURCE_RARITY,
resourceBuildingCosts: RESOURCE_BUILDING_COSTS,
},
banks: {
name: BANK_NAME,
Expand Down Expand Up @@ -245,7 +246,8 @@ export const EternumGlobalConfig: Config = {
buildingCapacity: BUILDING_CAPACITY,
buildingPopulation: BUILDING_POPULATION,
buildingResourceProduced: BUILDING_RESOURCE_PRODUCED,
buildingCosts: NON_RESOURCE_BUILDING_COSTS,
nonResourceBuildingCosts: NON_RESOURCE_BUILDING_COSTS,
resourceBuildingCosts: RESOURCE_BUILDING_COSTS,
buildingFixedCostScalePercent: BUILDING_FIXED_COST_SCALE_PERCENT,
},
hyperstructures: {
Expand Down
Loading
Loading