-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSettlementGen.py
32 lines (25 loc) · 909 Bytes
/
SettlementGen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from generatorGAN import makeStructures
from schematic import SchematicFile
import numpy as np
import SchematicTools
import generatorGAN
## Generate a settlement
INPUTWORLD = "data/example_world.schematic"
EXPORTPATH = "data/example_world_output.schematic"
BUILDINGSTOGENERATE = 10000
BUILDINGSTOSPLAT = 10000
blockArr = SchematicTools.loadArea(INPUTWORLD)
print("loaded area: %d, %d, %d" % blockArr.shape)
height = blockArr.shape[0]
width = blockArr.shape[1]
length = blockArr.shape[2]
output = SchematicFile(shape=blockArr.shape)
print("generating structures")
#structures = np.load('data/np_samples.npy')
structures = makeStructures(BUILDINGSTOGENERATE)
print("generated %s" % str(structures.shape))
print("splatting %d" % BUILDINGSTOSPLAT)
SchematicTools.randomSplatSurface(blockArr, structures, BUILDINGSTOSPLAT)
output.blocks = blockArr
output.save(EXPORTPATH)
print("output to %s" % EXPORTPATH)