Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Major unsolvable bug in Level Generator


Recommended Posts


this script will make a level with boxes, and spawns a camera with :


this script attached.


When you press the E key, it will generate a new level

Everything should make no error, but there is a problem.

The "player" spawns in the middle of the level , (most of the time)

and once I even had some blocks with no colission at all.

The level is generated towards any directiom (-x,x,y,-y...)

but mostly not in the direction the player is facing,

which makes even more problems.


I have no idea at all why these things happen. Maybe the solution is easy but I dont see it.

Link to post

So if you want to know your first and last block, and make sure ones at one end, and the others at the other end.


Do something where you'd randomize the X and Z positions of each block (left/right, up/down) BUT for the Y axis, calculate the next block's position based on the (blockCount * distancePerBlock) then you'll know it keeps moving in one direction.


(You can even add slight random offsets to the Y position after you do the (blockCount * distancePerBlock) calculation to determine the next blocks y-axis position.)


Otherwise you're just looking for the block in the furthest direction each way.. there's no guarentee blocks won't spawn in each other and that you'll be-able to get across them.


Edit: I forward in LE the Y axis is up/down and Z is forward/back for some odd reason. (Turns out I just live under a shell and this is pretty common in games.)


Untested and not-very thought through but heres an example showing what I'd do:



In the future you may even want to make the offset's scale based on the 'box' size and what not just so you can have a really dynamic, easily customization obstacle generator.

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Facebook Twitter Youtube Github Steam
  • Create New...