Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Try out my jelly program!

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Try out my jelly program!
Hard Rock
Member #1,547
September 2001
avatar

Hey, That was really cool. Good Work.

_________________________________________________
Hard Rock
[ Stars Dev Company ][ Twitter ][Global Warming: ARA My TINS 07 Entry][Pong Ultra Website][GifAllegS Ver 1.07]
"Well there's also coolwebsearch but we'll let that be an IE exclusive feature" - arielb on the New Browser Plugins "What's better, HTML or Variables?"

X-G
Member #856
December 2000
avatar

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.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Thomas Fjellstrom
Member #476
June 2000
avatar

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 ;D)

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

23yrold3yrold
Member #1,134
March 2001
avatar

Just tried the "jelly"; quite interesting :)
I also looked at the source code. Indents are our friends ;)

--
Software Development == Church Development
Step 1. Build it.
Step 2. Pray.

james_lohr
Member #1,947
February 2002

Quote:

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:

Quote:

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...

Trezker
Member #1,739
December 2001
avatar

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.

X-G
Member #856
December 2000
avatar

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. :-/

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

james_lohr
Member #1,947
February 2002

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.

X-G
Member #856
December 2000
avatar

As a side note:

Momentum p = m * v.
Impulse I = <u>/</u>p

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Trezker
Member #1,739
December 2001
avatar

Seems like there's a group of jelly-programmers here. Maybe we should start a club...

james_lohr
Member #1,947
February 2002

Now that's a good idea! We could have a race to see who's the first to make successful 3D jelly.

X-G
Member #856
December 2000
avatar

And then call it JellyHack? ;D

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

Trezker
Member #1,739
December 2001
avatar

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.

guilt
Member #2,553
July 2002
avatar

Pretty Nice :-*

 1   2 


Go to: