Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / 2d water physics possible?

Author
Message
ghzero
7
Years of Service
User Offline
Joined: 13th Jun 2017
Location: Germany
Posted: 1st Jul 2017 07:29
hello,

is 2d water physics possible in any way?!

maybe by code ?

I like to create 2d game that has generally physics,
an waterline, below the waterline water(underwater)
typically physics.

example:
an object is dropping from sky and falling by the physics
rules. since coming in the water-area the for water typiscally
physics activ to the object - sinking slower, not continue the
moving so fast anymore as it was in the sky.

best regards,
ghzero
Golelorn
8
Years of Service
User Offline
Joined: 20th Nov 2016
Location:
Posted: 3rd Jul 2017 17:26
I am assuming you're asking if AppGameKit comes with a custom 2d physics engine, which it does. I really enjoy the custom 2d physics in AGK. They are simple and powerful.

If it doesn't meet your standards or specification nothing prevents you from making your own physics rules.

You can use this as a reference for commands.

https://www.appgamekit.com/documentation/commands.html
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Jul 2017 17:57
This is totally do-able in AGK. You would need to just have different rules affecting the object when it is above/below a certain Y position. This would not be terribly hard. If you get stuck post a question here, I'd be happy to help if I spot the post.
Using AppGameKit V2 Tier 1
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 3rd Jul 2017 20:05
Related to this, any good tricks to create some 2D water effects such as the splash when the object hits the water, or ripples when moving in water?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 4th Jul 2017 13:06
I have seen a few examples of ripple effects. It depends in whether you mean top-down or platformer?

Splashing could be done by creating individual (physics based) particle sprites which get deleted when they go back underwater.
Using AppGameKit V2 Tier 1
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 4th Jul 2017 22:59
I was thinking of something like this:

https://gamedevelopment.tutsplus.com/tutorials/make-a-splash-with-dynamic-2d-water-effects--gamedev-236

I guess that is more of the "platformer" style as you refer to it? Although I am also interested in a top-down version. Perhaps some shader from the shaders thread could be used to simulate the top-down..

But for the one in the link I am not quite sure how to do that in AGK. Shooting sprites and deleting them on going below water surface level would work but it would not create a dynamic "hole" in the water.

Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 5th Jul 2017 08:38
That's quite a good tutorial. I want to convert it to 3d!
Signature removed by mod because it's larger than 600x120... please resize and try again.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 5th Jul 2017 14:37
@tmu Nice link

That technique is a lot more technical than my old school approach.
I still never finished my water level yet, because I got sidetracked to another project.
So, the fish are not swimming as they should yet, just on the screen for display while working on the graphics.
You will note that I used my splash to make the transition from above water to under water.
That was mainly just to exit the hot air balloon and put on the scuba gear.
I was still working on the physics for the swimming too, but that is really all there is to it, changing the characters movements to simulate the water drag/lag.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
janbo
16
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 5th Jul 2017 15:13 Edited at: 20th Sep 2017 19:38
@tmu You could use 2DPhysic enabled sprites balls and an Metaball overlay to simulate water.
Then you are able to push it away and so on...
With the metaball overlay you can hide the lack of sprites balls, so you can make less and bigger balls.
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 5th Jul 2017 21:53
Thanks all.

@conjured:
I guess you use a specific animation when the pig hits the water for the splash? Seems like a reasonable approach, at least in a case when it is a one-time transition.

@janbo:
The metaballs look nice and I guess I kind of get your idea. But the implemention in AppGameKit is a bit lost on me, as is what you mean by overlay here. The tutorials I found seem to be doing it by rendering the pixels based on some formula. Do you mean to use some shader code on an overlaid sprite to do that or something else?

Suppose I could also just shoot some different colored and sized/shaped 2D physics ball sprites on different parts of water/sky and how bad that looks.. Probably pretty bad though

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 20th Sep 2017 16:00 Edited at: 20th Sep 2017 16:01
Quote: "That's quite a good tutorial. I want to convert it to 3d!"


I wanted to try water in 3d too, but didn't want to get into any complex methods for the realistic water.
The shaders that I found here have very realistic water, but when I try to use them my frame rates drop to from 59 to 1.
So, I tried a low-tech approach without shaders, and it isn't too bad (much better than my 2d) but it still is no where near as good as the shader water.
Here is a peek at what I have going on so far...


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
ghzero
7
Years of Service
User Offline
Joined: 13th Jun 2017
Location: Germany
Posted: 23rd Sep 2017 14:39
anyone who has code example for 2d water physics to publish here in this thread?

Login to post a reply

Server time is: 2024-11-24 07:21:28
Your offset time is: 2024-11-24 07:21:28