Skip to content

Commit

Permalink
V1.2.3 Performance up & threading, python command line launch fixed, …
Browse files Browse the repository at this point in the history
…universal object attacher, diffrent biomes, cactus's, req.txt, TestSite imit
  • Loading branch information
MatinAfzal committed Aug 2, 2024
1 parent 11029cc commit 83632cb
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 53 deletions.
2 changes: 1 addition & 1 deletion main/Engine2/Settings2.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
SCREEN_MULTISAMPLESAMPLES = 4
SCREEN_DEPTH_SIZE = 24
SCREEN_CAPTION_LOADING = "Loading..."
SCREEN_CAPTION = "3DICU V [VANY] from [1.1.1]"
SCREEN_CAPTION = "OpenUniverse V [VANY] from [1.1.1]"
SCREEN_MAX_FPS = 60
10 changes: 6 additions & 4 deletions main/Level/Cactus.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ def __init__(self, position, max_height=4, min_height=0, biome="A", img=None, ma
cactus generator
Args:
position (pcenter_ygame.Vector3): tree center vertex position
max_height (int): tree maximum height
min_height (int): tree minimum depth
biome (str): tree biome
position (pcenter_ygame.Vector3): cactus center vertex position
max_height (int): cactus maximum height
min_height (int): cactus minimum depth
biome (str): cactus biome
img (path): texture
shematic (np.array): cactus generation sample
"""

self.level_name = "tree1"
Expand Down
101 changes: 65 additions & 36 deletions main/Level/Chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@


class Chunk(Mesh):
def __init__(self, position=None, max_height=10, min_depth=-10, shematic=None, img=None, material=None) -> None:
def __init__(self, biome="jungle", position=None, max_height=10, min_depth=-10, shematic=None, img=None, material=None) -> None:
"""
Chunk generator
Args:
biome (str): chunk type ["jungle", "desert", "snow"]
position (pygame.Vector3): chunk center vertex position
max_height (int): chunk maximum height
min_depth (int): chunk minimum depth
Expand All @@ -18,6 +19,8 @@ def __init__(self, position=None, max_height=10, min_depth=-10, shematic=None, i
material (): if material -> for loop gen
"""

self.known_biomes = ["jungle", "desert", "snow"]
self.biome = biome
self.chunk_center = position # for distance culling
self.level_name = "chunk"
self.material = material
Expand Down Expand Up @@ -49,8 +52,12 @@ def __init__(self, position=None, max_height=10, min_depth=-10, shematic=None, i
self.VM_L = 1 # Vertical Multiplier to last border
self.BD = 0.0000099 # border_deficiency
self.ONE = 1 - self.BD

self.vertices, self.triangles, uvs, uvs_ind, normals, normals_ind = self.level_maker(self.position)

if self.biome in self.known_biomes:
self.vertices, self.triangles, uvs, uvs_ind, normals, normals_ind = self.level_maker(self.position)
else:
if ESP:
print("Biome not found!")

# t1 = threading.Thread(target=format_vertices, args=(self.vertices, self.triangles))
# t2 = threading.Thread(target=format_vertices, args=(uvs, uvs_ind))
Expand Down Expand Up @@ -196,39 +203,61 @@ def level_maker(self, center):
for DEPTH in range(temp-4, temp): # Y
self.blocks += 1

if DEPTH <= -5: # SAND
self.HM_F = 0
self.HM_L = 1
self.VM_F = 2
self.VM_L = 3
# self.HM_F = 15
# self.HM_L = 16
# self.VM_F = 15
# self.VM_L = 16
elif -4 <= DEPTH < 0: # DIRT
# dirt = True
self.HM_F = 0
self.HM_L = 1
self.VM_F = 1
self.VM_L = 2
# self.HM_F = 15
# self.HM_L = 16
# self.VM_F = 15
# self.VM_L = 16
elif 0 <= DEPTH < 15: # GRASS
self.HM_F = 9
self.HM_L = 10
self.VM_F = 15
self.VM_L = 16
# self.HM_F = 1
# self.HM_L = 2
# self.VM_F = 14
# self.VM_L = 15
elif DEPTH >= 15: # SNOW
self.HM_F = 1
self.HM_L = 2
self.VM_F = 14
self.VM_L = 15
if DEPTH <= -5:
if self.biome == "jungle": # Jungle sand
self.HM_F = 0
self.HM_L = 1
self.VM_F = 2
self.VM_L = 3
elif self.biome == "desert":
self.HM_F = 0
self.HM_L = 1
self.VM_F = 2
self.VM_L = 3
elif self.biome == "snow": # Snow pure snow
self.HM_F = 15
self.HM_L = 16
self.VM_F = 15
self.VM_L = 16
elif -4 <= DEPTH < 0:
if self.biome == "jungle": # Jungle dirt
# dirt = True
self.HM_F = 0
self.HM_L = 1
self.VM_F = 1
self.VM_L = 2
elif self.biome == "desert":
self.HM_F = 5
self.HM_L = 6
self.VM_F = 15
self.VM_L = 16
elif self.biome == "snow": # Snow pure snow
self.HM_F = 15
self.HM_L = 16
self.VM_F = 15
self.VM_L = 16
elif 0 <= DEPTH < 15:
if self.biome == "jungle": # Jungle grass
self.HM_F = 9
self.HM_L = 10
self.VM_F = 15
self.VM_L = 16
elif self.biome == "desert":
self.HM_F = 0
self.HM_L = 1
self.VM_F = 1
self.VM_L = 2
elif self.biome == "snow": # Snow ice
self.HM_F = 1
self.HM_L = 2
self.VM_F = 14
self.VM_L = 15
elif DEPTH >= 15:
if self.biome == "jungle": # Jungle snow
self.HM_F = 1
self.HM_L = 2
self.VM_F = 14
self.VM_L = 15
else:
print(f"ERROR: Unidentified block detected... ZXY:{ROW}/{COLUMN}/{DEPTH}")

Expand Down
10 changes: 6 additions & 4 deletions main/Level/ObjectAttach.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from random import randint
from pygame import Vector3
from Level.Chunk import *
from Level.Tree import *
from Level.Cactus import *
Expand All @@ -11,13 +12,14 @@ class ObjectAttach:
Attach objects together !
"""

def __init__(self, object_name="chunk", start_x=0, start_y=0, start_z=0, number_x=1, number_z=1, shader=None,
texture=None) -> None:
def __init__(self, object_name="chunk", object_type="", start_x=0, start_y=0, start_z=0, number_x=1, number_z=1,
shader=None, texture=None) -> None:
if ESP:
print("Attaching Objects...")

self.known_objects = ["chunk", "tree", "cactus"]
self.object_name = object_name
self.object_type = object_type
self.layer = []
self.shader = shader
self.texture = texture
Expand Down Expand Up @@ -47,8 +49,8 @@ def chunk_binding(self):
print("Building Chunks (Multiple Level.Chunk Callings)...")
for x in range(self.sx, self.end_x, 8):
for z in range(self.sz, self.end_z, 8):
self.layer.append(Chunk(Vector3(x, 0, z), shematic=self.shematic.locate(x, z), material=self.shader,
img=self.texture))
self.layer.append(Chunk(biome=self.object_type, position=Vector3(x, 0, z),
shematic=self.shematic.locate(x, z), material=self.shader, img=self.texture))

def tree_binding(self):
if ESP:
Expand Down
2 changes: 2 additions & 0 deletions main/Level/Tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def __init__(self, position, max_height=4, min_height=0, biome="A", img=None, ma
max_height (int): tree maximum height
min_height (int): tree minimum depth
biome (str): tree biome
img (path): texture
shematic (np.array): tree generation sample
"""

self.level_name = "tree1"
Expand Down
10 changes: 7 additions & 3 deletions main/ICU.py → main/OpenUniverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MultiShaders(Screen):
def __init__(self):
if ESP:
print("Starting Engine...")
print("Project repo: https://github.com/MatinAfzal/3DICU")
print("Project repo: https://github.com/MatinAfzal/OpenUniverse")

start = datetime.now()
print("Starting at:" + str(start.now()))
Expand Down Expand Up @@ -91,8 +91,11 @@ def __init__(self):
self.sun_start = int(time())

# Object Attach
self.terrain = ObjectAttach(object_name="chunk", number_x=10, number_z=10)
self.trees = ObjectAttach(object_name="tree", number_x=10, number_z=10)
self.terrain = ObjectAttach(object_name="chunk", object_type="jungle", number_x=15, number_z=15)
self.trees = ObjectAttach(object_name="tree", number_x=15, number_z=15)

# self.terrain = ObjectAttach(object_name="chunk", object_type="desert", number_x=10, number_z=10)
# self.trees = ObjectAttach(object_name="cactus", number_x=10, number_z=10)

# Cell Attaches
cell_start = datetime.now()
Expand All @@ -101,6 +104,7 @@ def __init__(self):

self.world = CellAttach(self.terrain.layer, shader=self.mat, image=self.img_texture)
self.forest = CellAttach(self.trees.layer, shader=self.mat, image=self.img_texture)
# self.forest = CellAttach(self.trees.layer, shader=self.mat, image=self.img_cactus)

def initialise(self):
# Variables
Expand Down
32 changes: 27 additions & 5 deletions main/test/TestSite.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
import numpy as np
import pandas as pd
from main.Engine2.Settings2 import *
from Engine2.Settings2 import *


class TestSite:
def __init__(self, action="view"):
self.known_actions = ["view", "import"]
"""
format: format_version-chunk_num_x-chunk_num_z-obj_num_x-obj_num_z-chunk_type-object_type-lighting_method
details:
- chunk_type -> [P: Plain, D: Desert, S: Snow]
- object_type -> [T: Tree, C: Cactus]
- lighting_method -> [D: Dynamic Lighting]
#
test_sample:
- V1-S -> 1: 1-10-10-10-10-P-T-D
test_method:
- soft: stand still / locked FPS
- normal: move around / locked FPS
- hard: move around / open FPS
- aggressive: move around / look around / open FPS / fast
"""

def __init__(self, action="view", test_sample="1", test_method="soft"):

self.known_actions = ["test", "view"]
self.known_settings = ["V1-S, "]

if action not in self.known_actions:
if ESP:
print()

print("action not found!")
elif action == "test":
pass

0 comments on commit 83632cb

Please sign in to comment.