15-08-2007, 11:25 PM
Tizela Wrote:Your thinking of something like this. Though you do no't want to check all 8 tiles, since its not supposed to leak at corners.
sub filltiles(x,y, filltile,seedtile)
If seedtile = GetTile(x, y) Then
ChangeTile x, y, fill
Call filltiles(x - 1, y, filltile,seedtile)
Call filltiles(x + 1, y, filltile,seedtile)
Call filltiles(x, y - 1, filltile,seedtile)
Call filltiles(x, y + 1, filltile,seedtile)
end if
end sub
And that is indeed a fully working fill algoritm, but its also weak. (Thats point fill). Since it calls itself 4 times every time you call it, it recussion like hell and if you fill large areas you easily overflow the stack. If this was aplied to and empty 3x3 grid the recussion pattern would end like this.
Recussion 10
2-2-2
1-3-2
1-1-1
Each tile visited way more times than nessesary. When scaling that a bit it easily overflows the stack. It's probably okay for most Mirage Source users but my mapeditor should be able to handle 5000x5000 maps hehe.
Ah, I see.
But why 5000x5000 maps? Wouldn't it be more practical to simply use smaller maps but make them seamless rather than sharding the large map?
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?