Skip to content

Commit

Permalink
feat: map new biomes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sceat committed Nov 16, 2024
1 parent ea3615e commit 0f18bbf
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions src/procgen/Biome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,28 @@ export enum BiomeType {
Temperate = 'temperate',
Artic = 'artic',
Desert = 'desert',
// Tropical = 'tropical',
Tropical = 'tropical',
Scorched = 'scorched',
Swamp = 'swamp',
Glacier = 'glacier',
Tundra = 'tundra',
Steppe = 'steppe',
}

export const BiomeNumericType: Record<BiomeType, number> = {
[BiomeType.Temperate]: 0,
[BiomeType.Artic]: 0,
[BiomeType.Desert]: 0,
[BiomeType.Tropical]: 0,
[BiomeType.Scorched]: 0,
[BiomeType.Swamp]: 0,
[BiomeType.Glacier]: 0,
[BiomeType.Tundra]: 0,
[BiomeType.Steppe]: 0,
}

Utils.typesNumbering(BiomeNumericType)

export const ReverseBiomeNumericType: Record<number, BiomeType> = {}
Object.keys(BiomeNumericType).forEach((type, i) => {
ReverseBiomeNumericType[i] = type as BiomeType
Expand All @@ -100,19 +113,19 @@ export type BiomeInfluence = Record<BiomeType, number>

const BiomesMapping: Record<HeatLevel, Record<RainLevel, BiomeType>> = {
[HeatLevel.COLD]: {
[RainLevel.DRY]: BiomeType.Artic,
[RainLevel.DRY]: BiomeType.Tundra,
[RainLevel.MODERATE]: BiomeType.Artic,
[RainLevel.WET]: BiomeType.Artic,
[RainLevel.WET]: BiomeType.Glacier,
},
[HeatLevel.TEMPERATE]: {
[RainLevel.DRY]: BiomeType.Temperate, // TODO
[RainLevel.DRY]: BiomeType.Steppe, // TODO
[RainLevel.MODERATE]: BiomeType.Temperate,
[RainLevel.WET]: BiomeType.Temperate, // TODO
[RainLevel.WET]: BiomeType.Swamp, // TODO
},
[HeatLevel.HOT]: {
[RainLevel.DRY]: BiomeType.Desert,
[RainLevel.DRY]: BiomeType.Scorched,
[RainLevel.MODERATE]: BiomeType.Desert,
[RainLevel.WET]: BiomeType.Desert, // TODO BiomeType.Tropical,
[RainLevel.WET]: BiomeType.Tropical,
},
}

Expand Down Expand Up @@ -242,6 +255,12 @@ export class Biome {
[BiomeType.Temperate]: 0,
[BiomeType.Artic]: 0,
[BiomeType.Desert]: 0,
[BiomeType.Tropical]: 0,
[BiomeType.Scorched]: 0,
[BiomeType.Swamp]: 0,
[BiomeType.Glacier]: 0,
[BiomeType.Tundra]: 0,
[BiomeType.Steppe]: 0,
}

const heatVal = this.heatmap.eval(pos) // Utils.roundToDec(this.heatmap.eval(pos), 2)
Expand Down

0 comments on commit 0f18bbf

Please sign in to comment.