Walking Through Grass - Water

17 replies [Last post]
JasDonor
Posts: 111

When walking through a field or water or something like that I want my character's lower half to become slightly transparent, as if they are standing in the water or whatever. Here's a clip without the transparency:

It looks pretty stupid to stand on top of the field like that.

My initial thought was to use transparent Grhs in the foreground, but this would also obscure the character's upper-half as well. So then I thought drawing two different character sprites all the time, one for the upper and one for the lower half would do the trick, but that seems time consuming and I'm wondering if there's an easier way. Any suggestions?

Posts: 1030

Sounds like a new kind of entity to me, one that only draws over the bottom half of anything that collides with it.

Posts: 1691

Or you could have like vbGORE had where a layer was either above or below a character depending on their respective Y coordinates. So it'd draw above a character only if the bottom of the grass is greater than the bottom of the character. NetGore sorts all sprites before drawing already, so it wouldn't be much work to add.

Stuff like this is precisely why I didn't want to make a top-down game. Wink

Posts: 1030

@Spodi that doesn't work entirely as when you'll just go north in the grass it'll draw above/under/above/under you. This only works when you go left or right.

JasDonor
Posts: 111

Skye wrote:
Sounds like a new kind of entity to me, one that only draws over the bottom half of anything that collides with it.
What kind of entity or flags would be necessary and from there where would they be implemented?

Spodi wrote:
Or you could have like vbGORE had where a layer was either above or below a character depending on their respective Y coordinates. So it'd draw above a character only if the bottom of the grass is greater than the bottom of the character. NetGore sorts all sprites before drawing already, so it wouldn't be much work to add.

Stuff like this is precisely why I didn't want to make a top-down game. Wink


That's what makes it so fun, though. Nothing wrong with the vbGORE method, eh? If it's not too much work to add, I'll do it if you can tell me where to add it.

Would it be feasible to have a transparent flag set on a Grh and if the character walked on it, the character or whatever entity would be drawn transparent. Or half transparent?

Ultimately I'm interested in which of the methods mentioned above is the quickest.

Posts: 1691

Skye wrote:
@Spodi that doesn't work entirely as when you'll just go north in the grass it'll draw above/under/above/under you. This only works when you go left or right.

I believe it'd work if you break it up into multiple sprites instead of just one large one.

Posts: 1030

And have them overlap? That would work I guess.

Posts: 1691

Not being an artist, I have a hard time visualizing how these things will look, but what I am guessing is that it will look like you basically have a lot of flat lines of grass in there. It'd probably look like it does in slightly older 3D games with grass where it is billboarded.

Having the sprite get the bottom half of their body chopped off would look good while in it, but not so good as they walk out of it. You could do a pixel-perfect detection of what parts to "erase" from the sprite, but it becomes quite a bit of work... this is a bit of a tough one.

JasDonor
Posts: 111

Pixel perfect detection would be ideal, but too much effort. I think I can get away with the method you mentioned and some clever mapping.

Skye wrote:
Sounds like a new kind of entity to me, one that only draws over the bottom half of anything that collides with it.
How about an entity that draws the upper half of the player sprite entity over the player entity?The player entity would be underneath the transparent image, while the upper player entity would be above it.

Like this:

Now we have the illusion that pixel perfect things are happening with very little fuss. I just need an idea on how to implement this.

Posts: 1030

I would just make one new entity which forces the upper half of the player to be drawn on top of the layer the grass is on when the player is walking on the entity.

Posts: 25

In my previous years of development, transparency was virtually impossible with the graphics engine I used. So what I did was took all of the sprites, cut them all in half and erased the bottom portions upwards so it would look like grass was over me, when in reality half of your body was missing lol.

-Jeff Sventora
______________________________________
Currently Doing:
-Tinkering with NetGore
-Working on an old game of mine (VB6)

JasDonor
Posts: 111

Skye wrote:
I would just make one new entity which forces the upper half of the player to be drawn on top of the layer the grass is on when the player is walking on the entity.

Any idea on how or where to implement this? I'm not so familiar with SFML API or building NetGore entities.

Posts: 1030

Nope, no idea. Haven't looked into it myself.

JasDonor
Posts: 111

jeffsventora wrote:
In my previous years of development, transparency was virtually impossible with the graphics engine I used. So what I did was took all of the sprites, cut them all in half and erased the bottom portions upwards so it would look like grass was over me, when in reality half of your body was missing lol.
What I'm trying to accomplish here is somewhat similar to what you've done there.
Skye wrote:
Nope, no idea. Haven't looked into it myself.
Fair enough. Does anyone know if this is possible without editing the core source? Or is a source edit necessary? If I can get away with some clever entity manipulation without editing the source, it'd be awesome. Otherwise, it looks like a "feature" type edit would be necessary to add to the source.

Posts: 1691

You can probably do it by editing an entity, but editing entities is all done through the source. How exactly you would do it, I am not sure.

JasDonor
Posts: 111

Spodi wrote:
You can probably do it by editing an entity, but editing entities is all done through the source. How exactly you would do it, I am not sure.

I'll prepare to tackle the source then. If anyone can think of a clever way to achieve this without changing the core, post it here please.

Posts: 1030

Entities aren't "the core" though. I don't see how one can make a game with only a teleport entity Tongue so everyone is bound to add new entities.

JasDonor
Posts: 111

Still new to the NetGore jargon, confusing core and source in a previous post.