I've just spent 2 hours making it from scratch!
It's quite a cool concept and I suppose it could be used in a game.
Try it out and tell me what you think (its only 20 Kb so it'll only take a sec!) - but be gentle you don't want to hurt it......
www.geocities.com/james_lohr/jelly.zip
-move mouse to move the jelly
-left click drops it
-right click resets it (trust me you'll brake it in no time and'll need to fix it..)
Could you suggest how I could use it in a game cause I can't think of any really good ideas.
PS (is it jelly or jello in the UK? I can't remember even though I've lived here 7 years - back home in South Africa it was jelly.)
Nice effect!
And no, I can't find a good game use for it either... unless you want to make a dynamic version of the Jell-O level in James Pond 2
[EDIT]
And what's thumbs.db doing in that zip file? Remove it and you can shave an additional 2 kB from the file size
If it were a ball you could use it as a weapon, JELLY BLASTER!!!
Is it possible to have multiple ones interacting? you could have the tower of jelly, or jelly blocks you must walk/jump across.
Marcello
neat! now that, my friend is l33t!:P
Very funny! And guys, I guess you figure it out yourselves, but just in case, edit the texture.bmp, import your own face f.i. Mind the palette.
Here's an idea to a game: The Amazing Cucaracha Busting Jelly! Smash the moving bugs with the jelly but don't smash the nice ladybugs or aunt Dorothy's porcelain.
hey, don't suppose you can compile a linux version or something? Or maybe provide source? (thats easiest)
Hoorah for jelly cube!
And yeah, it's kinda easy to break. Just move your mouse quickly through the cube and it will invert and do all kinds of funky things ... arrange it so that the sides will never go through their neighbouring sides, perhaps?
Yay jelly!
To bad it gets all messed up and triangle-ie when it moves to fast
Gimme source, I had an idea!
Jelly pong!
WHEE!
I'll see if I can make it a bit more robust (I do remember once getting it to be like a chunk of rubber in an earlier program.)
And no I haven't been able to get two bits of jelly to interact but I know it is possible (anything is possible in C! I just need to know more maths). I have been able to get it to interact with a solid background (like the backgrounds in my slugs game.)
I've included the source code as well now.
Hey, make a competion, best game using jelly.
I'm gonna download the stuff now.
haha.. nice!
It gets a little insane if you decide to whip it from side to side continuously though
I like the tower of jelly idea..
Could be some interesting collision detection problems
this jelly rocks!
i like the tower of jelly idea...
you must stack more and more jelly, the higher you get the more woobly it gets.
and its set on a picnic table.
and ants have found the "mother-load" and are begining to eat the base of your jelly tower..
but if you wobble it just right, it creates an anti-ant jelly shockwave that repels ants.
and as the ants die near the edge of the jelly tower they start piling up forming a baracade of dead ants that prevent more ants from getting to your tower'o'jelly.
I still wana see Jelly Pong
Reminds me of sodaplay
Marcello
Yes, but where is the whip cream!? Oh wait, I'm thinking of Jell-o.
There's an old arcade game called Food Fight. In that game, you had different kinds of food piled up in random positions on the screen. You would pick up a piece of food and throw it at the chefs, who were trying to hit you also. Something like that where you throw Jelly around would rock.
Mike_Vox
I reckon it funny when you move it fast.
At first it's just wobbling fairly normaly...
then it gets bigger and bigger!
I thought it was going to explode!
Very nice
I think my jelly does explode when i start to move it around alot
I made up a little game within that demo, I'm dumb!.
See how high you can throw the jelly without it messing up
Try not to take your mouse that far from the bottom when you throw it, it makes a cool laval lamp effect
Now thats a good idea!
The thing is I'm trying to make it so that the jelly can't mess up (it is quite ugly when it does to be honest).
Your idea is still a good one though, because I could make it so that the jelly breaks into pieces instead.
This could be a funny screensaver, those ones you see for hours drooling
If you shake it too hard it gets wild and is takes forever to render when it goes big.
Have you fixed that, if not, make sure the speeds don't go over the size of a "segment" (20).
I've been messing around with it a bit, converted to c++, and tried to change from arrays to linked lists but I failed, maybe next time.
Wow jelly rocks
Simple physics that looks really good, i've always wanted to do something like this.
BTW one idea to turn this into a game would be to make a tetris game where the falling blocks are made out of jelly. There already is a game with boucing rubber blocks which is very addictive (google for tryptych and bridge-builder).
it makes me hungry, too, mmmmmm <drools> jelly...
I've still been trying to fix the jelly (in between revising for my exams):
I tried making it so that the jelly was made up of triangles and restricting points from moving into triangles that they should not be in. This however had bad side effects - Although it stopped the jelly from becoming inverted, the jelly did not maintain momentum and would stop in mid air. Actually I can't believe I didn't foresee this problem. I think I'll have to try something completely new.
Maybe there's nothing wrong with the physics and I just have to change the structure of the jelly or the way the jelly is moved by the mouse.
I'm also planning to make it 3D sometime. Maybe one of you guys could try because I'm a bit short on time for the next week. - it should be quite simple because vectors are very similar in 3D.
eg:
void unit_vector_3d(double x1,double y1,double z1, double x2,double y2,double z2, double *vx,double *vy,double *vz){ double i,j,k,mag; i=x2-x1; j=y2-y1; k=z2-a1; mag=sqrt((i*i)+(j*j)+(k*k)); if(mag>0.000001){ *vx=(i/mag); *vy=(j/mag); *vz=(k/mag); } else *vx=0,*vy=0,*vz=0; }
There will be quite a lot to do in terms of setting up the jelly structure but it shouldn't be too difficult.
Anyway I'll be doing it myself in about a week.
hmm it reminds me of the nvidia bubble demo... if you clicked it too rapidly as well the triangles went bezerk and it pretty much blew up and you never saw it again. I'm sure there as got to be some way to "tame" the polygons.. but good luck anyway on the exams and your program.
What about just preventing any segments from passing through their neighbours, instead transferring any excess momentum to them? The momentum should propagate through the segments and eventually come out on the other end of the jelly, which is not obstructed in any way - right?
X-G, you're a genius!
That's exactly how it should work. I can visualize it.
Hey, That was really cool. Good Work.
Have a look at Triptych by Chronic Logic. It has an effect similar to your jelly, excepting of course that the blocks never deform like your jelly does.
Dude? Pontifex2? Then the heck did that happen? I still have 1, and the original Bridge Builder (that was cool, the train logic was messed, but very fun you ould make the trian fly in the air and it would keep going
)
Just tried the "jelly"; quite interesting
I also looked at the source code. Indents are our friends
What about just preventing any segments from passing through their neighbours, instead transferring any excess momentum to them? The momentum should propagate through the segments and eventually come out on the other end of the jelly,
I tried EXACTLY that!! but it didn't work for some reason although I can see no reason as to why it shouldn't work - I was problably just making a stupid mistake somewhere. As I say I'm looking forward to getting my exams finished so that I can spend more time messing with the jelly (far more fun than revising circular motion,SHM and centres of mass of composite bodies...) I'm sure I'll be able to resolve the problem then. 3D jelly's going to look cool!
Oh:
Indents are our friends
Sorry sorry sorry!
When I taught myself C, I had hardly any code to look at. As a result I have never used indents and in fact if I use someone elses code for something the first thing I do is get rid of the indents. It's a terrible habit I know. Maybe I'll attempt to use them in my next game.
Ha ha - I bet if you looked at the source code for my "Slugs" game you would vomit! and not just because of the lack of indents, even I don't know what half my code is doing...
Heh, I converted your code to my system before I even tried to read it.
Saturday, I wrote my own jelly in c++, from scratch. It works well but is pretty weak.
I have skipped the diagonal joints, I thinks they are the cause of it's instability.
But without them the jelly crumbels to easy.
I wonder how to make that "transer force" algo should look, I tried to solve it but couldn't hack it.
I also had the idea that a joint should consist of three points and it should struggle to keep the angle between the two resulting lines.
Haven't got that far though.
Something like this, maybe?
if segment_is_too_close_to_neighbour apply_force(neighbour, me.force) me.force = 0 endif
... iterate through each point. Somewhere, segment_is_too_close_to_neighbour will be false - at extreme the end of the jelly.
Note: I am not a physicist (yet), so this may be totally wrong.
X-G:
That's not how I would do it.
Trezker:
I would do something more like this:
-First points need to be grouped into 3 (each point can be in more than one group). Note that for this method diagonals are a good idea because groups are more easily formed. Now the point of these groups is to make sure that the triangle that the three points form does not become inverted. If it does, one of the points has moved to where it doesn't belong. Now to check if a triangle has become inverted you need to use something like this:
float a,b,c,d; a=x1-x2; b=y1-y2; c=x3-x2; d=y3-y2; if((a*d)-(b*c))<0)triangle_inverted();
where x1,y1,x2,y2 .... are the coordinates of the three points in the group of three.
To see which point is actually causing the triangle to become inverted you will have to increment only its coordinates (ie in my source do: pnt[n].x+=pnt[n].xx,pnt[n].y+=pnt[n].yy for only the point n if you are checking the point n) and then do the above check.
What you actually do when you find a point trying to move into a segment it shouldn't be in I am not exactly sure. You could try something like this:
xx=pnt[naughty_point].xx;
yy=pnt[naughty_point].yy;
pnt[naughty_point].xx=0;
pnt[naughty_point].yy=0;
for(n=0;n<N;n++)pnt[n].xx+=xx/N,
pnt[n].yy+=yy/N;
Where N is the total number of points.
This would distribute its "momentum" or impulse or what ever xx/yy is (I really wish I knew..) to all the jelly. Or maybe try just giving it to points near by or something.
Anyway I could not get this to work but I am reasonably confident that it can work.
As a side note:
Momentum p = m * v.
Impulse I = <u>/</u>p
Seems like there's a group of jelly-programmers here. Maybe we should start a club...
Now that's a good idea! We could have a race to see who's the first to make successful 3D jelly.
And then call it JellyHack?
An asteroids clone would be nice, plitting jellys in a glass of water...
The ideas just keep coming, jellys can be used in many ways.
Pretty Nice