Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    3D Level Editor - Performance issue

    Help
    3
    18
    946
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Tratax
      Tratax F last edited by Tratax

      Here's the code - haven't included the 2D drawbox function as its fairly basic and working fine




      1 Reply Last reply Reply Quote 0
      • PickleCatStars
        PickleCatStars F last edited by PickleCatStars

        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

        1 Reply Last reply Reply Quote 0
        • PickleCatStars
          PickleCatStars F last edited by

          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..

          1 Reply Last reply Reply Quote 0
          • Tratax
            Tratax F last edited by

            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

            1 Reply Last reply Reply Quote 2
            • Tratax
              Tratax F last edited by Tratax

              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 :)

              CasualTie5 1 Reply Last reply Reply Quote 2
              • CasualTie5
                CasualTie5 F @Tratax last edited by

                @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

                1 Reply Last reply Reply Quote 0
                • Tratax
                  Tratax F last edited by

                  Thanks @CasualTie5 - I'll give it a go, just need to find a way to unload everything now haha

                  1 Reply Last reply Reply Quote 0
                  • Tratax
                    Tratax F last edited by

                    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

                    1 Reply Last reply Reply Quote 0
                    • PickleCatStars
                      PickleCatStars F last edited by

                      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.

                      1 Reply Last reply Reply Quote 3
                      • Tratax
                        Tratax F last edited by

                        Nice, do you have any code you can share for how you're doing this?

                        1 Reply Last reply Reply Quote 1
                        • PickleCatStars
                          PickleCatStars F last edited by

                          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!

                          1 Reply Last reply Reply Quote 2
                          • PickleCatStars
                            PickleCatStars F last edited by

                            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..

                            1 Reply Last reply Reply Quote 3
                            • PickleCatStars
                              PickleCatStars F last edited by

                              How’s it going?

                              1 Reply Last reply Reply Quote 1
                              • Tratax
                                Tratax F last edited by

                                Have been flat out with work... should have a chance to get back into this on the weekend !

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post