The partly submerged in water effect (or in large grass effect, for example) is accomplished by making the bottom half (or less) of your sprite transparent. This allows the tile underneath to combine with the pixels of the sprite effectively creating the "submerged in water" look. This was cleverly done in RPG maker 2003.
My question is, how to go about the implementation of this design...
Possible Implementations:
#1 - The player base icon has a bottom half that is always transparent. There is a "full opaque / non alpha" half overlay that is drawn over the player to make him appear normal most of the time, then when in water or tall grass... we remove this overlay to reveal the effect. This requires that the overlay flicks when the player flicks, changes icon states when the player changes icon states, etc. I don't think this would require two versions of gear overlays...
#2 - There are two versions of the player, for every action and animation. The first version is normal, the second version is the pre rendered half alpha for the in-water effect. This also means any gear overlays the player is wearing is also needs two versions.
#3 - ???
If anyone can think of a great way of doing this that doesn't involve expensive icon operations at run-time (My graphics generator code can pre render any of these ideas), please share!
I am almost certain that rpg maker is just doing it a neat blt call trick to accomplish this, and sadly we do not have these types of things available to us in Dream Seeker.
Cheers!
ID:1132949
Jan 20 2013, 5:12 pm (Edited on Jan 20 2013, 6:45 pm)
|
|
In response to Magicsofa
|
|
Magicsofa wrote:
I would do it by putting an overlay on the turf rather than messing with the player icon. Unfortunately I don't think you can set overlays at compile time, but since I think you are already using auto-joining in conjunction with map saving, you could do it at runtime and then save the map. If it's an underwater scene why not just use client screen images? |
It isn't an underwater scene, we are talking about making it look like the player is walking in tall grass or wading in shallow water
Now that I think about it, I realized a major problem with my solution - it won't work at all unless moving between spaces is NOT animated. So FIREking I think you have the right idea with having a sort of 'mask' that gets activated and de-activated based on where the player moves |
3 - You can actually create the desired effect using the Icon blend processes and a simple mask. It allows you to remove or add opacity to an icon through the RGBA options. The primary problem with the implementation of this would be overlays & underlays that you may use. the only two ways I can think of around that would be to either do it to all of the overlays and underlays separately or to constantly blend the overlays & underlays into one icon. Either way seems rather inefficient.
|
The way to do this is no doubt changing the alpha value of the bottom half of the character. We know this.
The problem is the implementation. Do we make an overlay that is removed to reveal the alpha, or do we make a two sets of everything? Either way is achievable by math and pre-rendered icon states, which isn't hard. I'm just looking for a very clever way to do this. I already know how to change the alpha value of every graphic in my game, with code, and save it to a new icon, or new icon state. I already know how to add and remove overlays, etc. I can do all of these things, but none of them seem very pleasant solutions. |
Hmm. I'm pretty iffy about this, but what about making a grass and water overlay for the character the same way you would something like hair? It could be applied on Enter() and such. It'll animate whenever the character animates, so if it has all the right frames it might work.
If alpha blending is needed, I am not very familiar with blending, but I would imagine you could use it to blend the grass or water overlay into the character and its overlays easier than the other options. I'm exhausted, and about to get some sleep, so please excuse me if this is crazy or something. |
The problem with that is you would be able to see a rectangle of grass or water moving around with the character. That would really only work for a solid color background, and even then a mob that's entering or exiting the deep turf would show the overlay sticking out of the relevant area (unless you had non-animated grid movement, in which case its not necessary to change anything about the player icon)
|
Oh, wow. This is tougher than I thought. There has to be a better way, but my mind is drawing a blank here. I guess if one of the existing options have to be used I would say go with the overlay that is removed to reveal the alpha method.
I think that the two of everything option would end up increasing the size of the rsc, and while it probably wouldn't be a lot, might as well avoid it if both options work just as well, right? |
The size of the rsc doesn't matter. You realize that WoW is like 8 gigs, right? Everytime you refresh facebook, you get about 1MB sent to you. Imagine 32 refreshes... 32 MB is quite a HUGE byond game. Would only take a minute or so...
|
I have been thinking about this one for a while, but just couldn't decide on what would be the ideal method to use.
If you decide to go with making the bottom halves of mobs transparent in some way, then you would probably have to create multiple land-to-water and water-to-land transition states, otherwise it will look pretty odd when mobs' bottom halves just suddenly turn into ghosts halfway into the water. You would need multiple states here because mobs could probably enter or exit the water from 4 different directions (in your game's case), not taking into account possible variations in the water's edge. However, the most graphically realistic, and still feasible, way to do this, that I could think of, is to divide all water into 2 sets of turfs, and divide all mobs into 2 halves. What you would do is have a turf for the "bottom" of the water (like a sea floor, lake bed, river bed etc.) with sand or rocks, at the normal turf layer, then put another, transparent, animated water turf on top of that, set to 1 layer higher than mob. For, the players, or mobs, they would consist of 2 icons, with the upper half set to mob_layer + 2, so it will stick out of the water's surface, as the mob moves through it. The lower half will just remain at the default layer, which will be "underneath" the surface of the water. If the mob moves out onto land, nothing about it will have to actually change, because it will still display over the land, and appear pefectly normal. The best thing about this method is that you won't need any land-to-water transition states, since the bottom of the mob will actually move under the water's surface layer, kind of like real water, and it should look really nice too. That's not to mention the fact that you could easily add tons of detail to the water, since there's both the floor under the water, and the water itself. You could also add whatever objects and things you like between the 2 layers of the water, for players to pick up, without the need to create a separate set of icons. Here's the basic idea of the different layers, if it makes more sense: turf I'm not sure how this method compares in efficiency with making the lower halves of mobs transparent, because while there may be a higher total number of layers getting rendered, this method doesn't use any switching of icon states, adding or removing layers, or any kind of icon transformation procs. The best way to put it is that it just runs "unattended", without any procs needed to "make it work". This is a bit off-topic, but it may be easier to use the method I described in isometric or side view map formats, since I don't think you would actually need 2 separate icons for mobs, due to the way the pseudo-3d layering works. Basically, it just depends on what you are going for in your game. Do you want the highest efficiency possible, the best graphics quality, or a compromise between those? That's how you will have to decide which method is right for your game. For example, the method I described would probably produce less graphical glitches, and while it may be feasible, it might not be the most efficient way possible, if that's what you are going for. No one method is going to be right for every game. Anyway, I hope this is helpful in some way. |
Hmm, this idea makes me think about a lot of things, actually.
To be honest, I don't think there's a real efficiency problem with any of the methods discussed in this thread, because these are actually very simplistic things, especially if you consider the amount of other stuff going on (at least in my game). Splitting the mobs into two halves and overlaying the top half is actually genius... this means items can be "dropped into water" and mobs that are "short" will appear underwater, no problem. Thanks for the idea. I am going to work on implementing this very soon. |
The advantages of this method would be that A) Any mob or obj can properly look like it is partially submerged, i.e. items could be under the water! and B) you could easily have different effects for different turfs. Deep water could be transparent blue, while grass would be opaque.