The idea is to make an endless, possibly randomised,terrain for the player to explore (Modified from a concept found on Blendswap). Right now, I have it set up so that as the player walks toward the edge of a piece of land, then a new piece will spawn in front of them. This works fine. The only problem is there is a huge drop in framerate whenever the player walks onto a spawned landmass, and this is a big problem. Any ideas why this could be? I've included some screencaps with the fps breakdown. Let me know if there is more info I can give that might be helpful. Thanks!
1 Answer
I actually solved my own problem. I had never used the near sensor to spawn an object before so I didn't realise it will constantly spawn a new object every time you move within the sensor's range. So, I simply added an "end object" actuator to the empty below the "add object(landmass)" actuator. This ensures a landmass will only ever spawn once and not spawn again if the player returns to the area.
If anyone is wondering what method I used for the spawn setup: I have each square landmass in a second layer with 3 empties on every side except for one (the one "player"[property] just came from) with a distance 1.5x the landmass width from the center of said landmass. I then simply have each empty rotate the correct 90 degree interval to spawn the new landmass in the correct orientation.
-
1$\begingroup$ I recommend to use a plane (with physics type sensor) to detect when reaching he border. This is much more efficient than near sensors. $\endgroup$– MonsterCommented Dec 5, 2016 at 5:22