ISOPLACCA5LP37URPIYP6XCEAUMYD5ORSM2V5BBHRUBUJFZDD6XQC
X7IQA5I46B6EHXPBIWTPCMZR4RZQ7PSJN5IMSEHA7H6F2NWQSNSQC
Z3E7XJOW6NSBDYRDKSGTOAEJSPATAUX4JUFCL4DIL3372GL4K52QC
ZGS4FTTFBXTF2SHYTPAJJBWEUVWVYXPSJVEFI5NYJWTW273B4NHAC
HUH4SI4HXIP72KQSJP2I4ELHX5KUQZM7FFGKZZGJ33DF7E3JHMYQC
GZRMSSTEWT3T2JERC7WCVT727X237UA6MXWVT6OSV5D5BRD4UOGQC
PSY4Y3X4ZWLXR2FEDR2W5E4SW2ASS4BPBOT4W5TDLNU2NCFZISNAC
6EXHALB3E5HP3IQVC47M4RVZE2JERJHX37GOOHPYIVAFBWSWUX7QC
Z5I5KK7NX6RS23QAB7ISLQCM5Z6TMVZK532NPSE7CO4MNXNKVKMAC
5NOOFT552GDEBDUACQZXG4TOLQSILGZEPGEJRS5BQD34TIJQ6T2QC
WBAN6KIPMKEXHGGQGE3TB6G7YXHGOPT3HRCEUYZKLNJCJBMR7JHAC
YBUOYJDAPDTPBG7F6QXYQDX53UFJ5WTHI32V6WOENCZIHZCPPLBQC
DFFMZSJOCLTBA3IGRYS2ZIJNO2MC3VLBBU42QL5DFY2SMCNFXPIAC
OPUQ6NVYM2BN4H2FENH6EBGVU25XQBY2GRRZANPZEBEACZMDOGEAC
NXFHSO7QRL6QWEPDEK4E25UIYLH2HQX4BDWA5IHXSZQCGM6LV2YAC
6REHBZAOJN4CVZY4HFXVNEUMWGQUXFTXMLQPXEH7RTH5FBL2TXIAC
import { Vector2 } from "../lib/util/geometry/vector2";
import { PlayerSaveState, Quest } from "./PlayerSaveState";
export type { PlayerSaveState, Quest } from "./PlayerSaveState";
import { PointNodeRef, ChunkRef } from "./PointNodeRef";
export { PointNodeRef, ChunkRef } from "./PointNodeRef";
import { ChunkGenConstants, ChunkGen, ZLevelGen, PointNodeGen, ResourceModifier, ResourceNontrivialType, ResourceType, WorldGenState } from "./WorldGenState";
export type { WorldGenState, ChunkGen, ZLevelGen,PointNodeGen, } from "./WorldGenState";
export { ChunkGenConstants, ResourceModifier, ResourceNontrivialType, ResourceType } from "./WorldGenState";
export type WorldGenState = {
seed: number;
zLevels: { [z: number]: ZLevelGen };
};
export type ZLevelGen = {
id: number;
chunks: KeyedHashMap<Vector2, ChunkGen>;
};
export type ChunkGen = {
id: number;
pointNodes: KeyedHashMap<Vector2, PointNodeGen>;
};
export class ChunkGenConstants {
public static CHUNK_DIM = 9; // each chunk is a DIM x DIM grid of nodes, centered on a single node
public static CHUNK_HALF_DIM = (ChunkGenConstants.CHUNK_DIM - 1) / 2;
public static DROP_NODES_CHANCE = 0.3; // before generating edges, how many of the nodes to throw out
}
export type PointNodeGen = {
id: number;
// more data to be generated here - size, color, etc.
resourceType: ResourceType;
resourceModifier: ResourceModifier;
resourceAmount: number;
};
export enum ResourceNontrivialType {
Mana0 = "Mana0",
Mana1 = "Mana1",
Mana2 = "Mana2",
}
export type ResourceType = "Nothing" | ResourceNontrivialType;
// eslint-disable-next-line
export const ResourceType = { Nothing: "Nothing", ...ResourceNontrivialType };
export enum ResourceModifier {
Flat = "Flat",
Increased0 = "% increased",
AfterIncreased0 = "added after % increased",
Increased1 = "% increased multiplier",
AfterIncreased1 = "added after % increased multiplier",
}
export type PlayerSaveState = {
availableSp: number;
activeQuest: Quest | undefined;
batchesSinceQuestStart: number;
// TODO(bowei): save the seed in here as well?
// selectedPointNodeHistory: PointNodeRef[],
// justAllocated: PointNodeRef | undefined,
allocatedPointNodeSet: HashSet<PointNodeRef>;
// history[-1] == most recent, histoery[0] == oldest
allocatedPointNodeHistory: PointNodeRef[];
};
export type Quest = {
description: string | undefined;
resourceType: ResourceType;
resourceAmount: number;
};
export type PlayerUIState = {
selectedPointNode: PointNodeRef | undefined;
activeTab: number;
};
export class PointNodeRef {
public z: number;
public chunkCoord: Vector2;
public pointNodeCoord: Vector2;
public pointNodeId: number;
constructor(args: {
z: number;
chunkCoord: Vector2;
pointNodeCoord: Vector2;
pointNodeId: number;
}) {
this.z = args.z;
this.chunkCoord = args.chunkCoord;
this.pointNodeCoord = args.pointNodeCoord;
this.pointNodeId = args.pointNodeId;
}
public hash(): string {
return (
this.pointNodeId.toString() +
this.z.toString() +
this.chunkCoord.toString() +
this.pointNodeCoord.toString()
);
}
}
export class ChunkRef {
public z: number;
public chunkCoord: Vector2;
public chunkId: number;
constructor(args: { z: number; chunkCoord: Vector2; chunkId: number }) {
this.z = args.z;
this.chunkCoord = args.chunkCoord;
this.chunkId = args.chunkId;
}
public hash(): string {
return (
this.chunkId.toString() + this.z.toString() + this.chunkCoord.toString()
);
}
}
export type PlayerUIState = {
selectedPointNode: PointNodeRef | undefined;
activeTab: number;
};
import { ResourceModifier, ResourceNontrivialType, ResourceType, WorldGenState } from "./WorldGenState";
import { HashSet, KeyedHashMap } from "../lib/util/data_structures/hash";
import { PointNodeRef } from "./PointNodeRef";
export type PlayerSaveState = {
availableSp: number;
activeQuest: Quest | undefined;
batchesSinceQuestStart: number;
// TODO(bowei): save the seed in here as well?
// selectedPointNodeHistory: PointNodeRef[],
// justAllocated: PointNodeRef | undefined,
allocatedPointNodeSet: HashSet<PointNodeRef>;
// history[-1] == most recent, histoery[0] == oldest
allocatedPointNodeHistory: PointNodeRef[];
};
export type Quest = {
description: string | undefined;
resourceType: ResourceType;
resourceAmount: number;
};
import { Vector2 } from "../lib/util/geometry/vector2";
export class PointNodeRef {
public z: number;
public chunkCoord: Vector2;
public pointNodeCoord: Vector2;
public pointNodeId: number;
constructor(args: {
z: number;
chunkCoord: Vector2;
pointNodeCoord: Vector2;
pointNodeId: number;
}) {
this.z = args.z;
this.chunkCoord = args.chunkCoord;
this.pointNodeCoord = args.pointNodeCoord;
this.pointNodeId = args.pointNodeId;
}
public hash(): string {
return (
this.pointNodeId.toString() +
this.z.toString() +
this.chunkCoord.toString() +
this.pointNodeCoord.toString()
);
}
}
export class ChunkRef {
public z: number;
public chunkCoord: Vector2;
public chunkId: number;
constructor(args: { z: number; chunkCoord: Vector2; chunkId: number }) {
this.z = args.z;
this.chunkCoord = args.chunkCoord;
this.chunkId = args.chunkId;
}
public hash(): string {
return (
this.chunkId.toString() + this.z.toString() + this.chunkCoord.toString()
);
}
}
import { KeyedHashMap } from "../lib/util/data_structures/hash";
import { Vector2 } from "../lib/util/geometry/vector2";
export type WorldGenState = {
seed: number;
zLevels: { [z: number]: ZLevelGen };
};
export type ZLevelGen = {
id: number;
chunks: KeyedHashMap<Vector2, ChunkGen>;
};
export type ChunkGen = {
id: number;
pointNodes: KeyedHashMap<Vector2, PointNodeGen>;
};
export class ChunkGenConstants {
public static CHUNK_DIM = 9; // each chunk is a DIM x DIM grid of nodes, centered on a single node
public static CHUNK_HALF_DIM = (ChunkGenConstants.CHUNK_DIM - 1) / 2;
public static DROP_NODES_CHANCE = 0.3; // before generating edges, how many of the nodes to throw out
}
export type PointNodeGen = {
id: number;
// more data to be generated here - size, color, etc.
resourceType: ResourceType;
resourceModifier: ResourceModifier;
resourceAmount: number;
};
export enum ResourceNontrivialType {
Mana0 = "Mana0",
Mana1 = "Mana1",
Mana2 = "Mana2",
}
export type ResourceType = "Nothing" | ResourceNontrivialType;
// eslint-disable-next-line
export const ResourceType = { Nothing: "Nothing", ...ResourceNontrivialType };
export enum ResourceModifier {
Flat = "Flat",
Increased0 = "% increased",
AfterIncreased0 = "added after % increased",
Increased1 = "% increased multiplier",
AfterIncreased1 = "added after % increased multiplier",
}