Here's a cool demo style effect I coded which I believe is called "bloobs". I did not invent the technique, just so you know. It's basically additive lightning. Anyway, I like the result and I wanted to share. Demo and src attached.
{"name":"bloob.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/e\/8edc6f8cdf17defe98cca2142ac89253.png","w":458,"h":344,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/e\/8edc6f8cdf17defe98cca2142ac89253"}
wow, nice effect. and the stretching makes it look even better (I wish that was true for all graphics:P)
I think I'll try to find a place for that in my current project...
thanks for sharing
Not bad, I see that effect a lot with compos, nice to see it done in software though, all the ones I see are pure OpenGL
The effect is quite cool, but I have some remarks about the code itself :
I have managed to compile it under linux, but I had to make some changes in the code :
- You are including winalleg.h whereas your code doesn't use any windows-specific code. Well, you might not care because you seem to only code for windows, but I think it should be pointed out anyway...
- I had to include math.h in order to make it work, because it otherwise uses the sin & cos function built in allegro, which return 'fix' and tus giving compile errors with gcc.
Well, one might think this is nitpicking, but I hope this could be useful
( Of course, I must consider what a great coder and game maker you are, so I feel a bit ashamed to point out such things )
Great coders don't concern themselves with silly things like that.
Marcello
woah peitz! that is elite!
The scene called, they want their effect back
You are including winalleg.h whereas your code doesn't use any windows-specific code. Well, you might not care because you seem to only code for windows, but I think it should be pointed out anyway...
Don't get Johan wrong, he's just trying to deter Linux users who are incapable of properly editting sourecode. I commend him for this.
- I had to include math.h in order to make it work, because it otherwise uses the sin & cos function built in allegro, which return 'fix' and tus giving compile errors with gcc.
I didn't have that problem, shrugs
Yeah I knew these remarks were quite silly... But I just felt like posting them
My apologizes to our great Johan Peitz, great among the great...
I had to include math.h in order to make it work, because it otherwise uses the sin & cos function built in allegro, which return 'fix' and tus giving compile errors with gcc.
I may be wrong, but I believe this depends on which flavor of GCC you are using (DJGPP, Ming, etc). Regardless, it might be better to skirt the issue entirely and include math.h.
very blooby, congrats
...Johan your code style is almost identical to mine!
DemoHack!
Ahh.. I'm feeling nostalgia for the ST/Amiga Vectorball demos.
So... are bloobs and blits related in any way?
Very nice And very fast. I also did some blob effects, but mine was quite slower (not that there's a difference in a decent computer).
It's basically additive lightning
Then it's a similar effect to blobs. With blobs, you sum the squares of intensities, so you get an attraction effect. This and that you use a lookup table (good idea, btw, I'll try it, too) explain the speed boost in your demo
I attach mine. The effect is not as spectacular as yours, but if you run the blobs_inv.exe one, the effect is cool You can move one of the blobs (the big one) with the mouse.
If you want to compile it yourself, the only difference between the two exes is the call to bs.draw() at the end of main, if the last parameter is true or false.
both EXEs crashed for me oscar.
Does your card support 640x480x16? I don't do any error checking, so if the call to set_gfx_mode fails... crash! I don't see any other reason that would crash on your computer but not on mine (but I'm in win98 ).
[edit]
Make sure to execute in from explorer or a dos box, so it uses the alleg41.dll shipped and not the one you may have in windows folder (4.1 dll's are incompatible).
Works extracted from the zip, my bad.
Anyway, as I mentioned in the Asteriods thread in the Game concepts, blobs are good for modelling certain things, asteriods for example. With enough blobs you can create organic structures that don't look too terribly blobby. Blobs are good for trees that have that kind of fused truck look (2+ trucks fused together).
Taken to the extreme and with some nasty-good physiscs you could very well simulate rain and water with them as well.
Not to mention some neato ghost-through-wall effects
Heh, glad you like it!
da_flo: You're right. winalleg.h is not supposed to be there. I tried something and forgot to remove it.
Oscar: I think the main speed boosts I get is from the lookup table. I was fairly slow before that. But also, I'm running 8bit in 320x240 which is always fast and nice to work in. Your inverse version looks really cool. Like cells or some other organisms.
can you make it into a screen saver, seems like i can starred at it all day, also it reminds me of the mac OS X screen saver, lots of graphic joy.
da_flo: stick to your guns, man, I had exactly the same problems as you. Thanks for the fix!
I saw a very 'jumpy' effect - was this intended? Look at this bit of code
'tick' is an integer that gets incremented 100 times per second. But, sin and cos wrap round every 2*pi (approx 6) so the bloob will oscillate very rapidly indeed.
imo it looks better if you put make tick a float (line 44) and put tick+=0.1 (line 95)
Maybe I just like my bloobs more chilled out that Johan
Pete
Don't forget to divide by a float if you do that peter. And probably multiply by a float too, but I'm not sure if multiply will cast it out to integer like division does.
WH: we're all friends here; a little implicit up-conversion can be excused, I hope.
Actually, several warnings are detected but none because of that:
[iBook:~/Downloads/bloobs Folder/src] peterhull% g++ *.cpp `allegro-config --libs` -O2 -W -Wall CBloob.cpp: In member function `CBloob::CBloob(int, int, int)': CBloob.cpp:17: warning: unused variable `int a' CBloob.cpp:17: warning: unused variable `int b' main.cpp: In function `int _mangled_main(int, char**)': main.cpp:51: warning: `text_mode' is deprecated (declared at /usr/local/include/allegro/alcompat.h:167) main.cpp:57: warning: missing initializer for member `RGB::filler' main.cpp:113: warning: `textprintf' is deprecated (declared at /usr/local/include/allegro/alcompat.h:189) main.cpp:42: warning: unused parameter `int argc' main.cpp:42: warning: unused parameter `char**argv'
Pete
Hah, I had no idea this piece of code would get so much attention. The movement of the bloobs is a hack I simply adjusted until I got a nice effect. (Btw, I don't get tha jump on my screen.) As for the unused variables... I ripped out some code from the CBloob class and probably forgot some variables in there. It's part of the old Hellcarrier code.
I tried to make it a screensaver, but I couldn't get it to exit normally by just moving the mouse or hitting a key. Do I have to put that in manually or does windows handle it?
scrsave.c says:
Am I the only one who keeps misreading this topic title?
Marcello
But, sin and cos wrap round every 2*pi (approx 6) so the bloob will oscillate very rapidly indeed.
No ... Johan didn't include math.h, so sin and cos wrap around every 255 as allegro's fixed point sin and cos are used implicitly (with mingw, anyway).
Edit: Marcello: No!
It's nice code. I like!
Marcello: Certainly hot!
Umm....was hot intentional, RP?
EDIT:
Marcello: Certainly hot!
There, just in case he changes it.
Of course! I think any body could see that.
Just an ordinary Freudian tit.
Of course! I think any body could see that.
Apparently everybody didn't.
No, they didn't getit.
It's so easy to derail a thread, it's soo easy to derail a thread...
(Sung to the music of "It's so easy to fall in love")
So... are bloobs and blits related in any way?
Well if 'blit' is 'block image transfer', then 'bloob' must be 'block oesophagus obstructus'. It's a kind of snake, I think.
I tried to download it but KGet is the most evil download manager in the world and I don't seem to be able to avoid it, short of loading Mozilla, and my X is being slow enough as it is. Maybe I should just go back to Windows
And Windows will be faster...how?
I think it should be "bob" and not "bloob". Bob is short for blitter object the term used for sprites on the amiga. And this particular effect is called "shadebob", AFAIK.
WH, I use it at work, and it's a lot more responsive.
Same computer speed?
latest version of X + latest version of KDE/Gnome shouldn't really be any less responsive than Windows XP.
If you're comparing it to a lesser version of Windows than you aren't making a good comparison.
If you're running on a low-end computer you shouldn't be using flashy and powerful window managers, gotta go for the efficent ones. You'll need to talk to a Linux expert about which ones will be best.
AthlonXP 1800+, 256 MB. I would expect it to be a lot more responsive than it is. I don't actually know the spec of the system I use at work, but it's a recent version of Windows. I also use Windows XP on my laptop, and that's a lot more responsive. It has a nice flashy and powerful windowing system, and the system spec is not much different from my desktop's (except it's Intel).
Why do I get the impression you're sticking up for Linux just for the sake of it?
Now I'm waiting for metaballs demo done in software.
Well then, I guess the Linux window manager and desktop managers suck.
EDIT: Metaballs can be done in software just fine. I read an article about them a few years ago (they were called metagoop). Same thing as this Bloobs, except in 3D.
I believe the article described the walking cubes or whatever method, which is patent and can't be used comercially
Just in case anyone else wants it; I hacked (very quickly and unprofessionally) peitz's demo into the screensaver example. I changed the ball movement in a very simple way; to change it back don't include math.h and change the tick increment back to one.
Source attached.
Hah, I had no idea this piece of code would get so much attention
More than that! Anyway I think I understand what has being going on, see my other thread.
Basically, Allegro 4.0 is implicitly converting to/from the 'fix' data type in the trig functions (lines 99 and 100) but Allegro 4.1 won't do this and gives an error.
Johan, if you want to used Allegro's fixed point functions, you should strictly cast to 'fix' there, or alternatively include math.h and cast to double. (if the latter, you'll need to tweak your parameters)
It is a cool effect, you can get something that looks like the moon reflected on moving water if you tweak the parameters.
Pete
I believe the article described the walking cubes or whatever method, which is patent and can't be used comercially
AFAIK you can't patent algorithms in EU at the moment and I hope you'll never be able to. Also I wonder how anyone would guess you've used certain algorithm without having your source code?
It's "marching cubes", and software patents are on their way in the EU unless a miracle occurs.
And metaballs have also been a standard Scene effect for many years...
We were taught marching cubes at uni, and no one told us they were patented. Shinjirarenaaai!
Oh, I managed to download it. It's cool
Oh, awesome, found the article I read. It explains both meta-goop, marching cubes, and the patent
[url http://www.gamasutra.com/features/20000523/lander_pfv.htm]
I like to imagine the state of the industry if Bresenham had patented his method for drawing a line on a graphic display and then charged a licensing fee for every line drawn.
I have strange feeling that something like this (by probably in more subtle way) will happen if patents will be allowed.
btw. Do you have to prove you have invented the thing in order to patent it? If not, line drawing algorithm could probably still get patented.
(sorry for off-topic, but this entire patent thing is making me sick )
In theory, patents are void if prior art, i.e. the same technique provably used by someone else before the date of the patent (or the date of development or whatever), is found. I'm not sure how much that applies in practice though. I'm not well up on the whole patent thing.
I read up on the U.S. gov's patent office site when I was contemplating patenting Progranisms, and if I read everything correctly, which I probably didn't: You can only patent something if you were the first to invent it, and you can only patent the invention within 1 year of its creation. If, after 1 year, you haven't patented the invention you cannot patent nor can anyone else. It becomes public domain.
Of course, a lot of patents get "passed" even though they aren't original. However, if you do take a patent to court and can prove the invention was used prior to the patent, then it'll be torn down.
The problem, I think, is that proving prior art can be less than trivial, and so small companies without legal muscle to spare will pay off people who have invalid patents rather than go to court ...
small companies without legal muscle to spare will pay off people who have invalid patents rather than go to court ...
Small companies will pay, but what about freeware game developers?
If you can't pay at all ... that's pretty much a death toll isn't it?
Or perhaps the software could run to hosts in countries where the patent laws don't apply. That could probably help...
I was contemplating patenting Progranisms
Haha, that's so siggable..
Re: Marching cubes and metaballs.
I'm quoting the Iehovah FAQ:
Q
Isn't the marching cubes algorithm patented?
A
Why? Did you think I used the marching cubes algorithm to create my volumes? It surprises me that whenever there's a talk about voxels-to-polygons rendering, people start talking about the marching cubes algorithm. I didn't use the marching cubes algorithm. There are always a thousand ways to do one thing, the marching cubes is just one of them. I came up with my own algorithm which is unpatented and which I think is still new. But I wouldn't be suprised if some other clever bastard already did something similar. So relax, there are no patent issues involved with iehovah. If you need to look for an algorithm to code your own volumes, than look in the links section.