Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411508 Posts in 69374 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 10:28:16 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperArt (Moderator: JWK5)water in 2D platformers
Pages: [1] 2
Print
Author Topic: water in 2D platformers  (Read 8416 times)
György Straub
Level 4
****


Friendly Giant Nano


View Profile WWW
« on: September 17, 2008, 01:31:01 AM »

how do you implement water in your platformers? on the first rung it's just about the changed movement of the characters, but then the water's behavior should be considered too (anything more sophisticated than a splash animation whenever a character enters / leaves water).

I've just been thinking about this (well not really, but I'm getting close to a point where I'm going to need it one way or another)... there are couple of approaches that come to mind before having googled for it:

* spatial approach: water is everything below a certain Y coordinate, so if the entities go beyond this coordinate, the physics that apply to them. yeah, but water can be beyond this "sea level". (wall) collisions are calculated afterwards.
* tile based approach: water is a tile type; collision detection has to be done before physics, and physics then can be applied to game entities based on what "substance" are they in. the tiles (can be an additional layer) can have, like a density (friction?) value. I kinda like it, it can even be brought in sync with walls (them being absolutely dense) - but it's tiles.
* cloud approach: it's really the extension of the tile based approach, but level data isn't stored in a grid (of uniform tiles) rather than a, I dunno, list or bsp-tree; everything can be a convex shape with an arbitrary number of edges, have unique unique orientation and scale - then the physical qualities.

anything more sophisticated?
Logged

deadeye
First Manbaby Home
Level 10
*



View Profile
« Reply #1 on: September 17, 2008, 02:35:13 AM »

You should definitely make your water a particle system with fluid dynamics.  And I want to see the Brownian motion on the character as the heat interchange from individual particles pushes him around.

But no, really I've only done water as tiles where overlap causes a change in the player's movement.  Well, that and instant death.
Logged

tweet tweet @j_younger
György Straub
Level 4
****


Friendly Giant Nano


View Profile WWW
« Reply #2 on: September 17, 2008, 02:47:38 AM »

You should definitely make your water a particle system with fluid dynamics.  And I want to see the Brownian motion on the character as the heat interchange from individual particles pushes him around.
:D

affirmative.


but that's nothing compared to how I like the idea of the player entity's instant death. optimization ftw!
Logged

jeb
Level 5
*****


Bling bling


View Profile WWW
« Reply #3 on: September 17, 2008, 03:09:37 AM »

You should definitely make your water a particle system with fluid dynamics.  And I want to see the Brownian motion on the character as the heat interchange from individual particles pushes him around.

Don't forget that, over time, the water should erode the platform walls.
Logged

Hayden Scott-Baron
Level 10
*****


also known as 'Dock'


View Profile WWW
« Reply #4 on: September 17, 2008, 04:01:20 AM »

I've been wondering about this myself recently. I don't know how fun real water displacement physics would be in actuality, as it would require quite a bit of fighting with the controls. I think a body of bouyancy is pretty fun to work with, and the idea of water pouring from one area to another can be simulated with some interesting methods. When a small amount of water falls on a wide flat surface though it's always a bit tricky to know how that should behave.
Logged

twitter: @docky
György Straub
Level 4
****


Friendly Giant Nano


View Profile WWW
« Reply #5 on: September 17, 2008, 04:15:38 AM »

You should definitely make your water a particle system with fluid dynamics.  And I want to see the Brownian motion on the character as the heat interchange from individual particles pushes him around.

Don't forget that, over time, the water should erode the platform walls.

haven't quite done with the wind engine yet.=)
Logged

deadeye
First Manbaby Home
Level 10
*



View Profile
« Reply #6 on: September 17, 2008, 04:40:56 AM »

I've been wondering about this myself recently. I don't know how fun real water displacement physics would be in actuality, as it would require quite a bit of fighting with the controls. I think a body of bouyancy is pretty fun to work with, and the idea of water pouring from one area to another can be simulated with some interesting methods. When a small amount of water falls on a wide flat surface though it's always a bit tricky to know how that should behave.

Yeah, in my experience physics and platformers don't mix too well.  It's nice in theory, but a bitch and a half to get looking and behaving properly.  That is, if you're using a pre-made physics engine.  If you're making your own physics engine then you're a hell of a lot smarter than me and probably have some idea what you're doing.

As for water displacement and stuff, the two games I can think of off the top of my head that do an okay job are Bloody Zombies and Phun.  Though in both the water (or blood as the case may be) effect is best when it's contained.  The illusion breaks down when individual particles escape the main body and go sliding around on their own.

Don't forget that, over time, the water should erode the platform walls.

Only if it's over the course of several thousand years.  And this would naturally have to take into account evaporation and precipitation.
Logged

tweet tweet @j_younger
ImaginaryThomas
Level 1
*


Reor, Creo, Incito


View Profile WWW
« Reply #7 on: September 17, 2008, 04:46:15 AM »

Will it be able to sustain a small eco system of simple invertebrates?
Logged

medieval
Guest
« Reply #8 on: September 17, 2008, 04:53:56 AM »

take this into account too:
Logged
Gnarf
Guest
« Reply #9 on: September 17, 2008, 04:55:23 AM »

That cave flyer thing game that was called Wings or something and was Finnish and I played rather a few years ago had water in it! And you could shoot water, and it sort of floated about, every little pixel of water. Float float float. Not very convincing floating, but cool.

I think the spatial approach could be just fine. Could to crazy hilarious awesome stuff that was wicked sick, like, eh, raising the water level during a level.
Logged
Hajo
Level 5
*****

Dream Mechanic


View Profile
« Reply #10 on: September 17, 2008, 05:00:09 AM »

Don't forget that, over time, the water should erode the platform walls.

While not realistic (as deadeye already told), this could be a neat idea to impose a time limit on levels, when the platforms actually grow too short to carry the player.
Logged

Per aspera ad astra
Danrul
Level 4
****


View Profile
« Reply #11 on: September 17, 2008, 05:03:06 AM »

I reckon that a game where erosion of wind and water is exaggurated could be interesting.  Like, where water is acid to platforms and stuff but not you, so jumping out you drip it on the platforms and if you try to climb ledges it fails.

on second though, that idea fails.
Logged
György Straub
Level 4
****


Friendly Giant Nano


View Profile WWW
« Reply #12 on: September 17, 2008, 05:05:21 AM »

I've been wondering about this myself recently. I don't know how fun real water displacement physics would be in actuality, as it would require quite a bit of fighting with the controls. I think a body of bouyancy is pretty fun to work with, and the idea of water pouring from one area to another can be simulated with some interesting methods. When a small amount of water falls on a wide flat surface though it's always a bit tricky to know how that should behave.

Yeah, in my experience physics and platformers don't mix too well.  It's nice in theory, but a bitch and a half to get looking and behaving properly.  That is, if you're using a pre-made physics engine.  If you're making your own physics engine then you're a hell of a lot smarter than me and probably have some idea what you're doing.

As for water displacement and stuff, the two games I can think of off the top of my head that do an okay job are Bloody Zombies and Phun.  Though in both the water (or blood as the case may be) effect is best when it's contained.  The illusion breaks down when individual particles escape the main body and go sliding around on their own.
That cave flyer thing game that was called Wings or something and was Finnish and I played rather a few years ago had water in it! And you could shoot water, and it sort of floated about, every little pixel of water. Float float float. Not very convincing floating, but cool.

I think the spatial approach could be just fine. Could to crazy hilarious awesome stuff that was wicked sick, like, eh, raising the water level during a level.

'zactly, Bloody Zombies is a good example. Sadly I haven't seen Wings, nor have I found anything closely resembling to it. I'm just banging my head against my platformer's physics - but very basic things: collision detection, jumping... I can really feel that the generosity that had to characterize framework development is coming to the end with actual game development.

It's hacktime.

Logged

Alex May
...is probably drunk right now.
Level 10
*


hen hao wan


View Profile WWW
« Reply #13 on: September 17, 2008, 05:06:01 AM »

how do you implement water in your platformers? on the first rung it's just about the changed movement of the characters, but then the water's behavior should be considered too (anything more sophisticated than a splash animation whenever a character enters / leaves water).

I've just been thinking about this (well not really, but I'm getting close to a point where I'm going to need it one way or another)... there are couple of approaches that come to mind before having googled for it:

* spatial approach: water is everything below a certain Y coordinate, so if the entities go beyond this coordinate, the physics that apply to them. yeah, but water can be beyond this "sea level". (wall) collisions are calculated afterwards.
* tile based approach: water is a tile type; collision detection has to be done before physics, and physics then can be applied to game entities based on what "substance" are they in. the tiles (can be an additional layer) can have, like a density (friction?) value. I kinda like it, it can even be brought in sync with walls (them being absolutely dense) - but it's tiles.
* cloud approach: it's really the extension of the tile based approach, but level data isn't stored in a grid (of uniform tiles) rather than a, I dunno, list or bsp-tree; everything can be a convex shape with an arbitrary number of edges, have unique unique orientation and scale - then the physical qualities.

anything more sophisticated?

It's not really clear what your aim is. If your bodies of water are static areas, then you want a static solution like box areas or tiles as you suggest, or something in the attribute layer of your map data. Anything further can be done with smoke and mirrors e.g. physics particles on the surface or created by objects at the surface, other cosmetic particles, rendering tricks, etc.

If your water is fluid, you want to make sure it either isn't gameplay critical (could the player move all the water somewhere with persistence for example) or it can somehow be restored to its level-designed state. For fluid water you probably want a particle-based solution using some kind of SPH interaction (look up lennard-jones) for the water physics.

An intermediate solution could be to have static bodies of water but to define the surface with a line of connected springs or some other simulation of water surfaces. Add particles for splash effects and you'll have a pretty effective water body with a stable yet fluid-like surface.
Logged

Danrul
Level 4
****


View Profile
« Reply #14 on: September 17, 2008, 05:09:19 AM »

I reckon water is an under-utilised possibility in games.  Its an oppurtunity to add another level of depth (oh a pun) to the gameplay. 

I think we need to think about displacement.  Imagine having a cave underwater that will fill if you knock the enemies into the water, so you have to take them out carefully.
Logged
deadeye
First Manbaby Home
Level 10
*



View Profile
« Reply #15 on: September 17, 2008, 05:25:04 AM »

I reckon water is an under-utilised possibility in games.  Its an oppurtunity to add another level of depth (oh a pun) to the gameplay. 

I think we need to think about displacement.  Imagine having a cave underwater that will fill if you knock the enemies into the water, so you have to take them out carefully.

That's actually a pretty sweet idea.  Definitely a step up from the see-saw or crate stacking puzzles you generally see in physics games.
Logged

tweet tweet @j_younger
Hajo
Level 5
*****

Dream Mechanic


View Profile
« Reply #16 on: September 17, 2008, 05:32:44 AM »

Check dwarf fortress for fluid dynamics and good use of water Wink
Logged

Per aspera ad astra
Danrul
Level 4
****


View Profile
« Reply #17 on: September 17, 2008, 05:56:03 AM »

Another annoyance is rain without consequence.  I wanna see levels eroding and valleys filling up,tides rising and vicious storms. 

Though, the inherent formlessness of water goes against the rigidity of a 2D platformer, so eh.
Logged
moi
Level 10
*****


DILF SANTA


View Profile WWW
« Reply #18 on: September 17, 2008, 09:30:32 AM »

I went totally crazy in my current platform engine when implementing water and I've totally spent too much time on that but here is what I done:
-water falls down through holes and fill cavities (ex: if you blow up parts of the level)
-"wave" effects on the surface, increased when water is moving to fill a gap
-infinite water to simulate sea or river (you can totally flood your level)
-players and ennemies bob in water when on the surface
-all enemies can either, float up, sink down or swim (player floats up when idle by default)
-player has an oxygen bar that appears after a few seconds

Logged

subsystems   subsystems   subsystems
Μarkham
Level 10
*****



View Profile WWW
« Reply #19 on: September 17, 2008, 09:44:45 AM »

Quote from: moi
Crazy-awesome physics engine capabilities

You can not just say all that and not post pictures of it in action.
Logged

Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic