lag problem in 3d
Asked Answered
C

11

0

my 3d game lags very much. And I think I don't have lots of triangles in the scene... I have the newest m3 Mac and I don't think it should be the case. I run much bigger scenes with lots of objects that didn't lag at all 🙁

Cachet answered 17/2 at 14:14 Comment(0)
C
0

that's basically all I have in that scene...

Cachet answered 17/2 at 14:19 Comment(0)
C
0

Cachet answered 17/2 at 14:21 Comment(0)
C
0

Just curious, why your scene have relatively large number of drawcalls?
Also I won't call 100000k triangles 'not much' -.-

Colman answered 18/2 at 3:11 Comment(0)
C
0

but why so many draw calls? These trees are super low poly...

Cachet answered 19/2 at 15:57 Comment(0)
C
0

Colman

Cachet answered 24/2 at 17:29 Comment(0)
M
0

Have you made sure there's nothing in process that might be triggering? It makes me think that something is repeating in your scene that shouldn't be. Are these items pre-rendered (as in a scene in the editor) before you load or are they instanced when the scene loads?

Madelynmademoiselle answered 24/2 at 18:22 Comment(0)
C
0

this is in the process:
`func _process(delta):

growstate += delta / 100
if type == "tree":
	if growstate < 1:
		$mesh.scale = Vector3(growstate,growstate,growstate)
	if main.hapiness < 100:
		main.hapiness += delta / 10
if growstate > 0:
	if plantready == true:
		return
		$mesh/mesh.modulate = Color(0,0,0,0)`
Cachet answered 24/2 at 19:32 Comment(0)
C
0

adding a tree or pot to the scene:

func addpot(position,type,data):

if type == "tree":
	print("yup")
	for j in range(potdata.size()):
		print("yup2")
		if potdata[j][1] == position:
			print("yup3")
			if potdata[j][2] == "pot":
				for h in range(potdata.size()):
					if potdata[h][2] == "tree":
						if potdata[h][1] == potdata[j][1]:
							message("there is already a plant in this position!",position)
							return
				potlist(position,type,data)
				return
			
	message("you need to place the pot first!",position)
	
elif type == "pot":
	if position.y == 0:
		for k in range(potdata.size()):
			if potdata[k][2] == "pot":
				if potdata[k][1] == position:
					return
		potlist(position,type,data)
Cachet answered 24/2 at 19:36 Comment(0)
C
0

you can plant them when the game runs - they are instanced

Cachet answered 24/2 at 19:39 Comment(0)
C
0

instancing plants:
func potlist(position,type,data):
var i = potdata.size()
var inst = load("res://game/objects/plants/plantmaster.tscn").instantiate()
potdata.append([null,position,type,ids,data])
inst.createPlant(potdata[i][4])
inst.position = round(potdata[i][1] + Vector3(0,0,0)) + Vector3(0,0.5,0.5)
inst.set_name(str(potdata[i][3]))
inst.type = type
inst.data = data
$flowerpots.add_child(inst)
potdata[i][0] = $flowerpots.get_node(str(ids))

Cachet answered 24/2 at 19:40 Comment(0)
C
0

I fixed the issue... kinda... Each tree had 4 gpuparticle children which were turned off. but even when they were turned off they caused lag? idk why really.

Cachet answered 24/2 at 20:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.