Fluid Grid (aka Geometry Wars background)

Started by
17 comments, last by Nypyren 14 years, 4 months ago
I found the interview I remembered:

"
Q: One of the most striking new graphical features in the game is the "gravity grid" play area. How did you make this look so cool; does every object in the game really have its own gravity?

A: The grid itself is made up of 60,000 points, each one exerting a small amount of force on its neighbour. The simulation itself sits on the edge of stability which is what causes it to swing about so much when one of the game objects gives it a small push!

Only a few types of object affect the grid. As the grid system is rather expensive to calculate, it actually runs on the second core along with the audio system, (the first core being dedicated to gameplay and particles, the third is used to render the audio).
"

from http://www.bizarrecreations.com/games/geometry_wars_retro_evolved/interview.php

60k sounds like a lot (and it's way more than I would have guessed), but that's only 256x256, which is pretty low-rez.
Advertisement
Quote:Original post by h4tt3n
Quote:Original post by Sudi
I made a little demo trying that effct myself.


Neat, but it seems to go unstable in some situations :-)


well that only happens when your cpu is not fast enough bc then forces pile up and kinda screw everything.
Quote:Original post by apefish
Hi,
You have to model every point as a newtonian mass (F=ma) and each spring as a linear(f=kx) spring.
Each point just has position, velocity and mass.
Each spring has a free length and a spring constant and two endpoints, each of which can either be a point mass, or a fixed point (inheritance).
Every time step:
For each spring:
get the distance between the two endpoints, subtract the free length, multiply by the
spring constant, and apply the resulting force to both endpoint objects be sure to take
angle into account, and reverse the direction for one of them. Also you will want to do the
same with some velocity damping or your grid will oscilate and probably blow up.
For each point mass:
just integrate using your favourite method (euler or verlet works well for this, RK4
requires multiple passes each time step).

You'll have to construct a grid with at least 2 fixed points in it (preferably at the edges) to start with, and then apply outside disturbances to it to make it interesting.

And there you go, this thing will have all sorts of fun behaviour, like waves and such.

Hope this helps.
Yes this helps a lot. Thanks.
Quote:Original post by Sudi
Quote:Original post by h4tt3n
Quote:Original post by Sudi
I made a little demo trying that effct myself.


Neat, but it seems to go unstable in some situations :-)


well that only happens when your cpu is not fast enough bc then forces pile up and kinda screw everything.


My laptop runs spring simulations an order of magnitude larger than that without breaking sweat - and without screwing up :-) Are you sure there's not a bug hiding in there somewhere? Just asking out of curiosity and in the hopes of making a nice piece of code even nicer.
well its not the spring system that is so expensive but drawing it is....its not really optimised. and maybe also the postprocess shaders do their part maybe try the bat file that says no shader.
After reading through this interesting discussion I have the following question:

Are the outer most nodes/points attached to a non moving frame or does gravity have no effect on each node in the grid?

Thank you.
The way I usually anchor the edges or ends of a "net" or "band" of springs is I just make a special type of node that ignores any force applied to it.

Alternatively you could just treat them like normal nodes, and then have some external code that zeroes out the edge node velocities before you do velocity/position integration.
Thanks Nypyren.

So if I understand you correctly, gravity plays no part with any of the nodes and the outmost nodes should have no rigid bodies attached to them (treated as static actors).
Quote:Original post by Spa8nky
Thanks Nypyren.

So if I understand you correctly, gravity plays no part with any of the nodes and the outmost nodes should have no rigid bodies attached to them (treated as static actors).


Gravity, as far as the Geometry Wars black holes go - that does affect nodes (but only the nodes that are movable). There's no 'world' gravity in Geometry wars. If you wanted to make a side-scroller with rope bridges, and you used springs to hold the rope together, THEN you could apply gravity to all nodes, which would result in the rope automatically settling into a parabolic curve that everyone's familiar with.

The only thing the anchor nodes are used for is an endpoint for the spring(s) attached to the movable nodes. If you allowed the anchor nodes to be affected by other forces, the entire grid could fly away like a tarp in a windstorm :)

This topic is closed to new replies.

Advertisement