Very fast floodfill

Previous topic - Next topic

fuzzy70

Welcome back Brick  :booze:

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Brick Redux

Cheers Lee & keep up the good work.
A mournful owner of a HP HDX18 Laptop that has died...FECK!

Brick Redux

Ive cracked the pattern fill and its very quick.  Its now part of of my Sprite Editor re-write.  Coming soon folks.
A mournful owner of a HP HDX18 Laptop that has died...FECK!

Brick Redux

Quote from: erico on 2013-Apr-24
heey brick! back again uh!

Hope all that mailing cd went ok and that you are all fine!
Welcome again! :good:

Sorry Erico, I never noticed your reply unitl now - tut-tut - Yes, all is good, back coding with this excellent basic.  Post more of your work buddy.
A mournful owner of a HP HDX18 Laptop that has died...FECK!

Brick Redux

In my Sprite Editor I found this way to use a sprite/brush as a pattern fill.

First fill the selected area with the set transparent colour.
Copy the selected area to a virtual screen.
Grab it as a Sprite.
Save the Sprite. (only way to later recognise the transparency)
Draw the Pattern in columns & rows inside the virtual screen.
Load the Sprite and draw it over the Pattern.
Copy back to the main screen.

I dunno how this would work with full screen, but it works like a dream in my editor.

Hope it helps anyone exploring this.
A mournful owner of a HP HDX18 Laptop that has died...FECK!

erico

Nice it works fine. :good:

There was a discussion about alpha sometime ago based on Ian Price´s game "Aquaventure" (go play it, it is wonderful!).
We all gave a go on sorting the alpha thing, it was really a nightmare.

I wonder if your solution could eventually be used on that case and it is fast enough to keep the game up at good speed.
The thread is here:
http://www.glbasic.com/forum/index.php?topic=8906.0

Makes for a good reading...except for the part I said my game is almost done :-[ I added a lot of stuff to it after that and more then 6 months later I´m still on the same stage! (but the added stuff looks great at least :P)

erico

About your sprite editor, it would wonderful if it also works on the likes of android or even a caanoo.
Since I got a note II I have been looking for productive tools on this front and alas there are none good enough... :(

Grafx2 may work ok but it is really hard to make it work and it dosen´t read the wacom pen on note II on a fine way, so it is actually useless.
I found a few sound/music programs that are more or less ok.
But I can state that android lacks productive tools to the point that if I had time I would code my own tools.

People may not work on phones, but the note II or bigger tablets are well capable to handle fine art and music for retro games.
Heck, when I´m travelling, time would be well spent drawing game assets on them. :(
I can do some of that stuff on my caanoo that the note II can´t handle at all.

I dream of a pixel sprite editor capable of handling animations and onion skin, it would be a dream come true if such appears on mobiles and tablets.

The best tool so far I found for it is Dr. Pepper´s "Cherry Brush"
http://www.drpetter.se/projects.html

Post a peep on your sprite editor when you can, I would like to see it.
Cheers.

fuzzy70

Thanks for bringing my attention back to this routine of mine as I accidentally overwrote my newer version with an older one when I changed computers (along with a few others as well  :D ). Luckily nothing of great importance was lost as most where just experiments & proof of concept type things.

The way I done a pattern fill from what I recall was just SPRITE2MEM the pattern to use as the fill & a little bit of maths to convert the current fill position to the appropriate array position of the pattern, taking into account pattern size & repeating obviously.

When I have finished my current item I will revisit this routine & try to remember how I done it last time. Also started work on gradient fills on the lost version, but only got as far as RGB to HSV conversion with a straight up linear fill I think (angles & radial type etc was the next stage).

Because I have not had a need for a fill routine for quite some time I mainly the reason I forgot all about it  :whip:

Glad you found a solution that works well in your Sprite Ed Brick  :good:

Lee
"Why don't you just make ten louder and make ten be the top number and make that a little louder?"
- "These go to eleven."

This Is Spinal Tap (1984)

Brick Redux

Quote from: erico on 2013-Aug-30
About your sprite editor, it would wonderful if it also works on the likes of android or even a caanoo.
Since I got a note II I have been looking for productive tools on this front and alas there are none good enough... :(

Grafx2 may work ok but it is really hard to make it work and it dosen´t read the wacom pen on note II on a fine way, so it is actually useless.
I found a few sound/music programs that are more or less ok.
But I can state that android lacks productive tools to the point that if I had time I would code my own tools.

People may not work on phones, but the note II or bigger tablets are well capable to handle fine art and music for retro games.
Heck, when I´m travelling, time would be well spent drawing game assets on them. :(
I can do some of that stuff on my caanoo that the note II can´t handle at all.

I dream of a pixel sprite editor capable of handling animations and onion skin, it would be a dream come true if such appears on mobiles and tablets.

The best tool so far I found for it is Dr. Pepper´s "Cherry Brush"
http://www.drpetter.se/projects.html

Post a peep on your sprite editor when you can, I would like to see it.
Cheers.

Ok Erico, here you go - a sneek peek at my editor.  The leen eyed will notice no save/load/animate etc icons. Thats because i click the tab under the paintbox from 1 to 2 to display the other icons/options.

A mournful owner of a HP HDX18 Laptop that has died...FECK!

Brick Redux

In the paintbox Ive selected what I call DOT.  You can also see all the nibs / stamps / brushes or what ever you want to call them :)  I added all of them with speed in mind when designing an image - saves messing around having to creating such a thing and then copy it as a brush.

I like GraFX but find the icons along the bottom annoying at times - my younger self still screams at this when reflecting upon DPaint :).
A mournful owner of a HP HDX18 Laptop that has died...FECK!

erico

Looks awesome! Can´t wait to check it out, speed it up!

While thinking about an editor, I wondered if the brush tool could support pre-made dither as a color.
Like you would have different sets of dither between 2 colors (main and background)possibly controlled by a slider and it would paint that dither.

Just something that sparked on my mind but I hardly think it really necessary.

Cheers!

Qedo

Hi everyone,
speed is certainly an important factor in games and I think it will be of interest to an improved and faster version of the "fastfloodfill" project posted at therad https://www.glbasic.com/forum/index.php?topic=8663.msg78051# msg78051.
The complete project that I enclose "FillFastLine" is at least 4-5 times faster on my computer going from 50 fps to 220.
is a GLB version obtained from the site https://lodev.org/cgtutor/floodfill.html.
I hope you enjoy it and look forward to any comments and improvements in the case.
Ciao

dreamerman

Very nice code, and may have other usage as well.
I tried to compare it with my basic FloodFill from path finding routines, and Your code is 2 times faster, so I will try to implement this algorithm in path finding in near time. One thing to check would be using full size array and omit DIMPUSH/DIMDEL, it could bring some minor speed improvement but I'm not sure, it's very good in current state.
And in general the algorithm it self is more that 4-5 times faster, just that Sprite2Mem & FastMem2Sprite take some additional time, but even with them it's really fast, and could be used for some special effects in retro project.
Btw. I remember that lodev.org has also great articles about raycasting :)
Check my source code editor for GLBasic - link Update: 20.04.2020

SnooPI

Very interesting. Thanks for sharing Qedo.
Dreamerman, I remember your path finding routine and this could definitely improve it.
Lode Vandevenne is a very good programmer especially for retro coding.
QuickCG is so coOol  :P