3D Level Editor - Performance issue
-
-
Line 185. Set environment should just be used once when you’re setting up your lights and stuff. Try putting that outside of your loop :) fingers crossed
-
For public share, go to ’friends’, press r for ’my shared programs’, pick your program and press ’a’, then pick ’submit’. 2 people from the fuze team have to approve it, so it won’t happen instantly..
-
Nice, good one - Moved both setenvironment and the ground placeobject before the game loop and its running much better... still losing memory but i can now place more blocks!
Thanks, I've just submitted it for review
-
Quick update that I believe Ive found the cause of the memory issue!
The setup3D function runs each time the map has been loaded into memory and on each user input of the A button
At Line 178, I'm saying to read the entire array and place an object even if it already exists, so each time this function is called it's just creating whole replication of these objects filling up the map and memory quite quickly
So here's what I'm thinking...
- Create another array that stores if 3D objects have been placed or not and test / update that locations reference on each button push ONLY redrawing objects that do not yet exist
or - Unload all objects, if this is possible.. and then just read from the array and redraw everything everytime something changes
Option one seems like the better choice.. option two seems like the faster lazier route.. Solving this will also allow me to remote objects from the scene which will be needed as a map editor
keen for any thoughts / input :)
- Create another array that stores if 3D objects have been placed or not and test / update that locations reference on each button push ONLY redrawing objects that do not yet exist
-
@Tratax the second option doesn't appear lazy to me at all - I would argue that always removing unnecessary data is a very effective procedure
-
Thanks @CasualTie5 - I'll give it a go, just need to find a way to unload everything now haha
-
Ok, have had a go at removing the objects and have realised that the objects might not be created properly at the moment as removal is saying the object is invalid
Does anyone know the correct way to use a for loop to create multiple individually managable 3D objects?
Here's my current version:
obj = []for i = 0 to len(level01) loop
obj[i] = placeObject( model.wall, scale, pos )
repeat -
The problem you’re encountering now is the bane of my life. I solved it by making sure my array is global, and doing it outside of a function. It will be fixed in the upcoming patch, I do believe.
-
Nice, do you have any code you can share for how you're doing this?
-
I downloaded yours and had a look. If you change the line
Obj = []
To
Array obj[len(level01)]
That’ll fix it. I also noticed in your setup3d function, you say ’float scale = {1,1,1}’ - that works, but only because Fuze is so forgiving. {1,1,1} is a vector, as I’m sure you know.
It’s looking pretty good so far! The saving and loading works. Super cool!
-
I actually didn’t have to change anything else. Seems your problem isn’t the same as the one I’ve been having, and was just solved by setting up your array the way I just said..
-
How’s it going?
-
Have been flat out with work... should have a chance to get back into this on the weekend !