|
| 20 Nov 2014 03:09 PM |
I am making a maze generator, and the script takes such a long time to generate a 20 x 20 maze. Here is how it follows:
10 x 10 maze - nearly instant
20 x 20 maze - 10 - 12 seconds to make the path, then 40/3 seconds to make the rest of the maze
100 x 100 maze - > 5 minutes (it hasn't even finished the path making)
The generation timing is in the "unnamedFunction()" in the loop.
script:
codepad.org/aQQjYAdv |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 20 Nov 2014 03:30 PM |
| http://blog.roblox.com/2012/02/an-optimization-for-lua-scripts-2/ |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 20 Nov 2014 04:23 PM |
| You can cut out a lot of the stuff with loop optimisations. If you know some things are immutable, or can be cut out / cut down, then make them so. If you're using a lot of Lua functions, make all of them local because local variables are faster hehe |
|
|
| Report Abuse |
|
|
|
| 20 Nov 2014 04:55 PM |
Also, some algorithms are faster than others. I have in my free models a maze maker that runs fast for you to use or get some ideas from. I have a hexagonal maze generator somewhere if you want that, and I have a geodome generator + maze on top here: http://www.roblox.com/Labyrinth-of-Betrayal-LOB-place?id=125625913
Oh, btw, I like mazes and pathfinders. Working on a really advanced pathfinder for a few months now. Navmesh + theta* + actions like gettings in cars. |
|
|
| Report Abuse |
|
|