Browse Source

added world generation performance testing

Jonas Weinz 8 months ago
parent
commit
3438a458ba
1 changed files with 31 additions and 0 deletions
  1. 31 0
      tools/test_world_generation.py

+ 31 - 0
tools/test_world_generation.py

@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+import sys
+sys.path.append("../ServerCore")
+from WorldManager import WorldManager
+
+from pycallgraph import PyCallGraph
+from pycallgraph.output import GraphvizOutput
+
+
+def main(nchunks=10):
+    raw_noise_cell_size = 32
+    raw_noise_chunk_size = 4
+    world_seed = 42
+
+    # create world:
+    wm = WorldManager(raw_noise_cell_size=raw_noise_cell_size,
+                      raw_noise_chunk_size=raw_noise_chunk_size,
+                      world_seed=world_seed)
+
+    for x in range(nchunks):
+        for y in range(nchunks):
+            for z in range(nchunks):
+                wm.createEmptyChunk(x, y, z)
+                wm.applyPerlinToChunk(x, y, z)
+                # print(x,y,z)
+
+
+if __name__ == "__main__":
+    with PyCallGraph(output=GraphvizOutput()):
+        main(10)