I DID IT!!! I ACTUALLY DID IT!!! MWAHAHAHAHAAA!!!!

Miscellaneous Forums/General Discussion/I DID IT!!! I ACTUALLY DID IT!!! MWAHAHAHAHAAA!!!!

Hi Blitzers,
Guess what? I'VE ACTUALLY CREATED A SUCCESSFUL, UNIVERSAL FLOOD FILL ROUTINE!!! FOR BLITZ!!!!!
I couldn't believe it! The best part is that the whole thing, once I figured out the trick, only took me an hour and a half from start to finish! And it's compact!!! HOORAY!!!

Congratulations.

Seriously, though... it took you a whole hour and a half?

Well, if you don't know how to do it in the first place, it probably would take that time. I dare say you could write a pathfinding routine in an hour if you knew exactly what you were doing. I'm on day 5 :D

Well done on your achievement :D

Someone wrote a clean and unobfuscated pathfinding routine in the bmax section, some months ago, upon my humble request.. :P

Don't even get me started on pathfinding. Took me like a month to 'finish' an A* pathfinding routine.

Tell me what PathFinding is, and I might. ^_^

Pathfinding is how to find the shortest path from one point to another.

Google for A* to find out more and some tutorials.
Not that far from floodfill if you ask me.

DId you use recursion in your floodfill code? :)

No, didn't need to, believe it or not; the code's amazingly compact. I put it in the code archives: it's at http://www.blitzbasic.com/codearcs/codearcs.php?code=2157

Pathfinding is how to find the shortest path from one point to another.
It's not always the shortest. A* for instance is a heuristic algorithm that, given an unknown graph, will find a path from a to b, if one exists it's not likely to find the shortest (particularly for dense graphs), but it'll find a path that's usually good enough. In most cases you'd probably want either a minimum spanning tree, or a shortest path tree, and in most cases - particularly computer games, the grid would almost never have a reason to be in an unknown state.

Man Adam - those variable names are MASSIVE! You could have saved a lot of typing time by keeping them a bit shorter.

Actually, the "Ghz_Lib_Var" prefix was just copy-and-pasted on after the code was completed; trust me, I'm a very lazy typer, and I don't hit more keys than I have to. ^_^

Guess what? FloodFill no longer takes 10+ seconds to execute!!! I did some fiddling around with WritePixelFast(), and figured out how to integrate it. Finally. :P

Anyway, it's now good enough for a (very) fast computer to render in realtime. I've updated the codearchs entry; just click the link above!

awww you so happy.

I got one of the coders who uses cobra to do an example for me on how fast they could read all the colours of the pixels in a 1024 res image.

He did an example using the inbuilt asm and it took 0.0 milliseconds (was faster than the system could calculate).

So if you really need a damn fast pixel read write in a similer language have a look at cobra.

sounds like his timing system was in error ;)

anyway, grats Adam!

Adam the link you posted is broken (or appears that way to me anyway).

Darkheart

Boomboom, have you got the code they used as it would be interesting to compare it against the compiled output from Bmax.
<edit> It's OK I got it.

ASM is sooooooooooooooo quick. If you think about the speed of a processor, it's not surprising, if it's done right :o)

Congratulations on your achievement,
keep up the good work mortal.

The Mighty WERDNA(Lord of Darkness)

stop it with the freaking werdna thing!!
NOOBS HAVE NO RIGHT TO BE COCKY AND WEIRD

Only the chwaga may be cocky and weird while remaining a noob.

though, i wonder, how is it that MS paint and other image programs can do this stuff in realtime, but blitz can't??

WHY IS BLITZ 2D SO SLOW??
can someone who knows directx & c++ write a lib plz?? (i'm working on learning it and gracing you guys with a lib or two, but c++ is so BORING by comparison to blitz, I'm still on the functions chapter of MS VC++ 2005 Express Edition Programming for the Absolute Beginner!!

(lol, I'm such a noob...)

chwaga:
DUDE, MS PAINT WOULD NOT FLOODFILL IN REALTIME!!!
Seriously, it may look fast, but if it had to render it as an animation, it would probably scrape about 10 FPS tops on a standard PC. Also, B2D really isn't slow at all, IF you know how to squeeze out speed! ^_^

-=darkheart=-:
Thanks for the tip on the link dude... I'll get on it right away.

Okay, link updated: it's http://www.blitzbasic.com/codearcs/codearcs.php?code=2157