Twisted Road Preview Slow

Discussion in 'Buildbox 3.0' started by Frank Freeman, Nov 16, 2020.

  1. Frank Freeman

    Frank Freeman Boxer

    Joined:
    Sep 6, 2018
    Messages:
    18
    Likes Received:
    4
    Hello,
    I'm in the process of learning to use the Twisted Road template. I've added some of my FBX files and noticed that when they load in the preview, the player slows down or is choppy. I found that there are some threads suggesting Intel and Radeon cards may cause slowness in preview. I've seen similar on both my PC's that are a Xeon Radeon 5700 XT and an i7 NVidia GeForce GTX1060. It runs slightly faster on my Mac Book Pro i9. My FBX files are very small under 1MB. I've messed with the thresholds and fog distances to no success. Does anyone have any suggestions? Thanks!

    Here is an example...
    https://www.dropbox.com/s/p1koerbmr9kyskq/BB-Game.wmv?dl=0
     
  2. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    604
    Likes Received:
    360
    Uuuu so this is interesting,

    Assuming that asking for that bbdoc won't get a positive response if so please sent it to a DM so I can have a look on it. I think you should do the following changes:
    - Disable shadows when possible
    - Disable the fog (for now it will be enabled later on)
    - Set the physics for the background objects from static / dynamic / kinematic to None (there's no need to calculate physics on something that will not be triggered by the player
    - Split your scenes in smaller chunks and make sure your objects are deleted after you pass them
    - Remove unused nodes that may have some logic in Update function
     
    Frank Freeman likes this.
  3. Frank Freeman

    Frank Freeman Boxer

    Joined:
    Sep 6, 2018
    Messages:
    18
    Likes Received:
    4
  4. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    604
    Likes Received:
    360
    I was able to improve the fps by disabling all the shadows from the subscene (fbx) objects. Have you tried to import obj instead of fbx and see if that helps?
     
  5. Frank Freeman

    Frank Freeman Boxer

    Joined:
    Sep 6, 2018
    Messages:
    18
    Likes Received:
    4
    Thanks! So I haven't done anything more with shadows yet. I did just place the obj of the building instead of the fbx and it was still choppy. Weird that it cannot handle simple 3D buildings. I'm going to test with BB Assets and other free 3D models to see if it is just my models.
     
  6. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    604
    Likes Received:
    360
    The main issue of your game are shadows and count of vertices in the screen at one point. What I mean by that is that the engine has to calculate shadows and physics fr multiple object that has a big amount of vertices.

    What you can do is to split the scenes in 4 and load them and remove them as the game pass by or you can do what they did in marathon template.... generate scenes as full fbx or obj and use them as hole thing
     
  7. Frank Freeman

    Frank Freeman Boxer

    Joined:
    Sep 6, 2018
    Messages:
    18
    Likes Received:
    4
    I think your suggestion to turn off shadows is the biggest fix. Simple objects with shadows seem to work just fine. In addition, I couldn't figure out how to turn off shadows for FBXs, just OBJs. Not sure if there is a way to do so? Thanks!
     
  8. Vlad-NY

    Vlad-NY Serious Boxer

    Joined:
    Jul 21, 2018
    Messages:
    604
    Likes Received:
    360
    Hey there @Frank Freeman,

    It's been more than 2 months since you came up with this challenging puzzle and I finally was able to understand what's going on and adjust the bbdoc as much as I can. Now take up a coffee or tea and prepare to read what I am gonna say about the cause of this issue:

    • So the number one on the list is Hotel1 fbx object. This specific object has 272 individual objects that have options for cast and receive shadows, well the engine has to calculate a lot of points for each frame in order to cast the shadows on this object not to say how hard it will be for it to calculate physics if that is enabled as well.
    • Since I talk about physics I found out that the most common mistake boxers do is to allow objects to interact with "All" group types, and that means that every 3D model has to be calculated if it is colliding with any other 3d object. (Imagine a scenario where you have 2 hotels near each other and every single piece out of that 272 is checked if is interacting with the environment since there's no specific range for physics detection that you can set up).
    • All of the above issues with light aka shadows or physics are also applied when adding/removing the next scene
    • Now those are the downsides that can be handled but for that, all of you will need an advanced tutorial. I'm not intending to do that as of now but the provided bbdoc should be enough for those who are willing to understand the solution.
    • The good part?
      • Luckily Ivan released a dynamic Time warp system that can be used here to get a smoother experience I've tested it on preview with the latest 3.3.7 build and I got between 45 and 59 fps while playing the game. If I remove some objects with a high object count then I got an average of 58 fps but that's another story.
      • Ther's a way to enable or disable shadows on fbx and this bbdoc has that node included
      • I've done all the changes that are needed so the bbdoc is ready for testing.
      • Here's the summary for all your objects that slows down your game:
        • Hotel1: 272
        • House1: 126
        • Cabin2: 88
        • Cabin1: 72
        • TreeSmallSnow: 20
        • TreeSmallLight: 12
        • TreeLargeSnow: 89
        • TreeBigSnow: 7

    And your bbdoc link is:
    https://drive.google.com/file/d/1fCGAoHYGxQQ0dlqk-CqCyZxZDBqH55nc/view?usp=sharing

    I hope this helps and I wish you good luck with your game template!

    Kind regards,
    Vlad
     

Share This Page