Optimizing procedural terrain

This forum is currently in read-only mode.
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • So I finished my randomly generated platformer terrain.

    http://www.moddb.com/members/figalot/images/caverns

    But unfortunately when I generated the maps to the size which is needed to make the game fun makes the game lag. I tried optimizing it by making all blocks outside the camera invisible but i think the game is still rendering them. Any idea how i can make the game run better?

    I actually have a pretty powerful computer so rule that out.

  • ou don't have to make them invisible offscreen, it will automatically not render them.

    If you have physics on them, disable when off screen

    If you have per pixel collision on them change it to bounding box

    My guess is the per pixel collision thing

    If neither of those things, I guess post back unless someone else has helped by then

  • Neither of those things did any thing major, another thing I noticed (If you look at the picture you can see that there are 2 characters) It only gets a drop in fps when both my characters jump. I deleted 1 character and tested it with 1 guy and it ran 20-30 frames better. Btw its a direct x 9 game with no motion blur or any special stuff.

    Edit: Also the screen is always shaking (not on purpose) i think this is because i have both main characters with the attributes center view.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hmmm

    Hard to say without a cap filethen, which I couldn't do anything with until later today, then maybe someone else couldhelp.

    Only other thing I could see was trying the non per pixel collisions on your characters

    But really, it should only be a problem with very large images or very large amounts of images

  • Hopefully this helps

    Well its 1 in the morning here so ill be back in 6-9 hours

    heres the cap

    http://www.mediafire.com/?c5g5f5th825jai8

    Thx for your help

  • Hmm this looks familiar.

    Your biggest issue is too many tiles. Just about any computer is going to have issues when you go over a couple thousand.

    Your options are:

    1: Reduce the size of the layout.

    2: Only create a set amount of tiles when they are within a certain area, and then destroy those tiles when they aren't needed.

    3: A combination of 1 & 2, smaller layouts connected to other layouts.

  • Could Could you explain the answer 3 a little more ? like different maps?

  • Take your big map and split it up into equal parts. The first layout would be quadrant 1, second layout quadrant 2, etc.

    You can then add triggers to each layout that tell it when to go to a particular layout.

    Like if player x is > 600 go layout 2, if player y is greater than 600 got to layout 3.

  • 2 is how id do it if dealing with 1000's of tiles

    As long as its not too important to keep track of offscreen enemies navigating the terrain or anything

  • Is there any way i can make prefabs and instead of on start up randomly generating tiles it creates these prefabs?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)