juzzlin / DustRacing2D

Dust Racing 2D is a traditional top-down car racing game including a level editor.
http://juzzlin.github.io/DustRacing2D/index.html
GNU General Public License v3.0
301 stars 67 forks source link

Modify FloodFill #129

Closed BeyondXinXin closed 1 year ago

BeyondXinXin commented 1 year ago

I tried to use the editor to generate a map, and the software flashed back. What I traced back is flood filled recursive function causing stack overflow. It should not generate a huge canvas, I don't know if it is necessary to modify it.

juzzlin commented 1 year ago

Hmm...how huge? :)

BeyondXinXin commented 1 year ago

80 * 80

BeyondXinXin commented 1 year ago

image 动画

juzzlin commented 1 year ago

80 * 80 is not that big...let me check!

juzzlin commented 1 year ago

I believe this happened due to a nasty indexing overflow bug. However, I also eliminated the tail recursion and this now worked with 1000 * 1000 (a million) tiles:

e9d7719a9a26cae60aa9636c30f260ead8bb3e3b

Should be big enough!