Archived

This topic is now archived and is closed to further replies.

Game using implicit surfaces (a.k.a. Metaballs/Blobbies)

This topic is 4940 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made a game using implicit surfaces as a basis for my maps. Its basically a 3D Pool game inside one of these implicit surfaces. All the collision detection between the pool balls and the surface is done using the vector field so its pretty fast. The gravity also is determined using the gradient of the vector field meaning the gravity acts towards the walls rather than always in a particular direction. I don't know if something like this has been done before or not but anyway, here it is: Click me! What do you people think? [edited by - SpaceDude on May 31, 2004 9:12:59 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Cibressus
can i get the source code to this? i don''t see any metaballs, i''d just like to see how you implamented them.


I implemented using the marching cubes algorithm:

http://astronomy.swin.edu.au/~pbourke/modelling/polygonise/

and i sped things up a bit using the ideas from:

http://www.angelcode.com/dev/metaballs/

The entire map is a big metaball if you want, they don''t move though its just a static map. I found that it was too much of a performance hit to have the whole map deforming all the time. Instead i''ve made it possible for small sections of the map to be deformed, thats how the pockets work.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
what an original concept, so crazy but better graphics would help you need an artist and a musician

Share this post


Link to post
Share on other sites
SpaceDude I am sad I could not make it work on this machine, probably because of the low FPS (DirectX probably launches the software implementation of some of your commands). It's a Celeron 700 with a GeF2 MX.

Nonetheless I have made a demo years ago, when prototyping a commercial game. I tested collisions based on anti-gravity fields. I made a routine than could sum the contribution of the particles in a triangle against a punctual particle somewhere else nearby. After some painful Mapple sessions I got a very nice and tiny formula with a few arctan and vector stuff. This way I had smooth - elastic collisions of the decor mesh. It gave a very special game play. The game was based on a flying car, and it was pretty funny to get ejected of tunnels or pass through small portals. I thought it might be also very interesting for world coherency and client side predictions in a multiplayer game, eliminating most hard solid/solid yes/no collisions and impulses. I also thought it could be great to use these fields with metaballs. But none of these things have been exploited in the game, probably because it was too weird for the staff.

So since I have thought about similar things a lot in the past, I think you should get a bit further and try a "terrain" based on dynamic metaballs. The other blobs could be static. Because of the x,y->z particularity, you can make great optimizations for both rendering and field evaluation. So this would be viable, and the result would certainly be worth the pain, very original and fun. And I can give you more detailed advices if you want to follow this track.


[edited by - Charles B on June 5, 2004 5:57:11 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It crashes on my PC directly on startup:

Radeon 9700 pro
AMD Athlon XP 1800
512 mb ram

I do hear a sound, so that part probably doesn''t cause it.

Share this post


Link to post
Share on other sites
>>Nonetheless I have made a demo years ago, when prototyping a commercial game...

wow thats cool. have you still got the demo? can we play it or is it "top secret" stuff?

So are you saying that it doesn''t work at all? or it runs at very low FPS?

>> It crashes on my PC directly on startup

When you say crash, what exactly do you mean? Does the game just exit or does it come up with an error?

I''ve had a lot of ppl telling me it doesn''t work on their PC, which is anoying but I don''t really have any means of testing it on any other PC than my own.

Share this post


Link to post
Share on other sites
wow thats cool. have you still got the demo ? can we play it or is it "top secret" stuff ?

No I have not brought that code home. First normally anything you write for a company belongs to them. And this company does not exist anymore, the files are lost. Anyway there is a lot of code written during prototyping (the first months of a project) and then thrown to the trashcan. It''s just meant to test some ideas. I did a demo because the physics engine was not ready at that time and I wanted to test game play and steering behaviour.

But there is no top secret in it. All I made in this demo is compute this integral of a force field on a triangle, which I did with Mapple and a lot of paper. I coded the formula in C and I added a small physics kernel and a small OpenGL program to render a decor mesh.

The only thing I regret is I lost this formula, I should have recorded it somewhere on a paper. I won''t have the courage and time to find it again because it was very tricky to solve. It required geometric astutes (dividing the triangle into 6 right triangles), and a lot of variable changes under Mapple to find a readable formula. When the formula was finally reduced and humanized it was pretty simple though.

Maybe I could give it as a homework to my youngest brother who is studying math the hard way to become an engineer. Unless you wish to do it ;p

This was a good way to make cheap collision detection and response that would work on any generic decor model.

Share this post


Link to post
Share on other sites
I have to admit i don''t know what you''re talking about. My colision detection is pretty simple, you can find if a point is above or below your isolevel very easily. And since i''m working with spheres only, i just take the center of the sphere move it along the gradient by its radius and find if that point is above or below. done.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Woah, seriously impressive game. I love it. Worked flawlessly on my machine too (2200xp/9700pro/winxp).

I like the camera movement a lot as taking shots feels very intuitive, even if you can''t see the cueball or the cue you can still visualize where the ball is going to go.

Share this post


Link to post
Share on other sites
It doesn''t work on my pc. I get a window of zero size.

amd 1800 xp , geforce 4 ti4400 and win 98 se

The screenshots look nice

Share this post


Link to post
Share on other sites
quote:
Original post by SpaceDude
I have to admit i don''t know what you''re talking about. My colision detection is pretty simple, you can find if a point is above or below your isolevel very easily. And since i''m working with spheres only, i just take the center of the sphere move it along the gradient by its radius and find if that point is above or below. done.


K then it''s all about collision detection only. You just evaluate if the sphere hits the blob, where the iso-potential is 0. And you use the radius and field vector to find which point of the sphere you''ll take to evaluate the potential. Right ?

I thought you used the fields to generate -1/r2 (gravity like) forces, which would also enable some kind of free collision detection + the collision response (as an effect of the force field). Something I call more generally smooth or elastic collisions.

Anyway. Basically what you exploit the centers of metaballs (to get the potential and field) and the sphere centers. What I did is let surfaces (triangles) repulse material points with "anti-gravity" or "magnetic" (as you like) force fields.

This is just newtonian theory with negative masses (or negative gravity as you like) if you see what I mean.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Charles B
K then it''s all about collision detection only. You just evaluate if the sphere hits the blob, where the iso-potential is 0. And you use the radius and field vector to find which point of the sphere you''ll take to evaluate the potential. Right ?

I thought you used the fields to generate -1/r2 (gravity like) forces, which would also enable some kind of free collision detection + the collision response (as an effect of the force field). Something I call more generally smooth or elastic collisions.

Anyway. Basically what you exploit the centers of metaballs (to get the potential and field) and the sphere centers. What I did is let surfaces (triangles) repulse material points with "anti-gravity" or "magnetic" (as you like) force fields.

This is just newtonian theory with negative masses (or negative gravity as you like) if you see what I mean.



Spacedude here (don´t have login with me atm)

Yes i find out if the sphere hits the iso-potential 1 actually (0 would be at an infinite distance away).

I do generate fields with 1/r2 forces. I understand what you´re talking about now, but I don´t have any elastic collisions going on. Its just like a hard surface where the iso-potential is 1. I think i could change the physics in my game fairly easily to do what you have done. It would make the game even more freaky

Definetely worth a try though to see what it looks like. Thx

Share this post


Link to post
Share on other sites
Yes i find out if the sphere hits the iso-potential 1 actually (0 would be at an infinite distance away).

Right. But it's because I remember my implementation. I biased the potential value by -1, which does not change the gradient. It's just a bit faster to test sign than comparing to one. Always my bias towards optimizations.

It would make the game even more freaky

Probably, you could set it as an option in your game.

But then beware that you have to keep your solid collisions even if you add these forces. If the physics were perfect (decreasing potential energy due to air-frictions) these collisions could be enough, provided that you can bound the cinectic energy.

Because if the ball has too much speed and due to finite time steps, the ball center might come much too close to a metaball center and cause a division by zero or at least create quasi infinit forces. Another side effect of growing energy due to numerical approximations (here the non infinitesimal time step) in the simulation.

I remember that because it was only a demo and I had not implemented solid collisions. But sometimes, once every 5 minutes roughly, my car got ejected in outer space with astronomic speed, and the decor was not even visible in any direction LOL


[edited by - Charles B on June 7, 2004 8:25:48 AM]

Share this post


Link to post
Share on other sites