Bouyancy

Community Forums/Showcase/Bouyancy

Rob Farley(Posted 2008) [#1]
Once again I was bored and did a bit of coding for no good reason other than to amuse myself... (and yes I know I've spelt buoyancy wrong!)



Basically the balls drop from the sky and bob up and down on the water. Oh, and you can pick them up and throw them around (using the mouse and the little green circle mouse pointer)

If two of the same colour are pushed together they reduce in size, once they get to a certain size they lose all buoyancy and sink.

I'm sure I could turn this into a colour match game, just no idea how, suggestions welcome!

All coded in the mighty blitz3D with real time mesh deformation for the water ripples. All physics are 100% fake nonsense that I made up and looks about right. The water ripple code is heavily modified from something Reda Borchardt wrote many many moons ago.

http://homepage.ntlworld.com/rob.farley/download/Misc/Bouyancy.zip

Enjoy!


stayne(Posted 2008) [#2]
Maybe have different colored shapes appear one after another somewhere (like Tetris pieces). The user has to grab a shape from the queue and drop it into the water near another same-colored piece.

Hmm... maybe not.


GaryV(Posted 2008) [#3]
I think the buoyancy is very realistic.


Grey Alien(Posted 2008) [#4]
Looks neato! You seem to be clever at this Physics stuff.


Warpy(Posted 2008) [#5]
So, you know this has to become Frogger, right? Those circles are MADE for walking on.


GaryV(Posted 2008) [#6]
Rob, is there any chance you can give us non-physics-geeks some tips on buoyancy? I am working on an underwater 2d game and would appreciate any advice you can give.


Paul Murray(Posted 2008) [#7]
How about a puzzle game where you have to get a floating ball from one side of the screen to another but you have to traverse obstacles (walls, pipes, etc) by controlling the water flow by turning taps on and off to increase the water levels in different sections of the 'map'.

You could include objects to block 'leaks' in walls to help the water level increase, but let the water rise too far and the ball is stuck, unable to sink. There's also the possibility of power-ups, such as turning the ball to lead/stone for a few seconds so that you can roll it along the floor through a gap in an underground wall/tunnel.


Rob Farley(Posted 2008) [#8]
Looks neato! You seem to be clever at this Physics stuff.
I can't believe you used the word 'neato' really, go to your room and think about what you've done for a while. That aside, I like physics, I like doing my own stuff, I don't know why, I find it fun!?

any chance you can give us non-physics-geeks some tips on buoyancy
Gravity pushes down, buoyancy pulls up... Um... That's about it... You'd do something like:
xSpeed = xSpeed + (Any Forces Applied e.g. Direction control, currents, wind etc)
ySpeed = ySpeed + (Any Forces Applied e.g. Direction control, currents, wind etc)

ySpeed = ySpeed - Gravity ; Gravity affects no matter what

If yPosition < Waterlevel Then
	; Properties of Water
	ySpeed = ySpeed + BuoyancyOfObject ;Counter act gravity, if this force is more than gravity you'll go up otherwise you'll sink
	ySpeed = ySpeed * WaterFriction
	xSpeed = xSpeed * WaterFriction
Else
	; Properties of Air
	ySpeed = ySpeed * AirFriction
	xSpeed = xSpeed * AirFriction
EndIf

xPosition = xPosition + xSpeed
yPosition = yPosition + ySpeed
Of course if you want to do it properly it's all about density, mass / area = density (if memory serves) then you just have density of air, water, objects and everything will rise or fall correctly... but personally I think it's too much like hard work!

Muzzer, that sounds way too over complicated for my tiny mind! Not a bad idea though!

Warpy, Frogger... Where are the cars going to go?


Stevie G(Posted 2008) [#9]
Nice. It looks a bit unrealistic but fun none the less. I thought you were always weary of games where the starting point was physics ;) Are you changing your tune now?


Warpy(Posted 2008) [#10]
cars? You've got gert huge circles falling from the sky! What more obstacle do you need?


Rob Farley(Posted 2008) [#11]
Ah I see! That could be fun!


GaryV(Posted 2008) [#12]
Thank you Rob, that is a HUGE help.