paperjack Posted March 23, 2018 Share Posted March 23, 2018 Hello, I am making an arena shooter multiplayer game with destroyable obstacles. You can see a pre-alpha here: http://mechsgame.s3-website.eu-west-2.amazonaws.com I have encountered a problem I'm not sure on how to proceed on and I surprisingly couldn't find any information on similar issues. My game will have tall walls and other obstacles which can potentially cover the player's character. I would like to make an effect similar to RTS games, where an outline or a shadow of the player is visible on top of the obstacle. See the below picture to get an idea of what I mean. My player container contains several sprites. I have a few ideas on how to do this, but I do not think they are optimal. One is rendering the player container to a texture and using that a mask for potential overlapping obstacles, along with a filter. Secondly is just placing a simple GUI marker that shows where the player character is. In both cases, I am unsure on how to detect overlapping sprites. Is there an established solution for such cases? Thanks! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 23, 2018 Share Posted March 23, 2018 No, its up to whatever geometry library you are using. As for masks and "shadow" behind elements, its possible with combination of renderTextures and layers. I'm implementing a demo for https://github.com/pixijs/pixi-display to show this case. Quote Link to comment Share on other sites More sharing options...
paperjack Posted March 23, 2018 Author Share Posted March 23, 2018 Thank you! Could you provide me with an ETA for the demo? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 23, 2018 Share Posted March 23, 2018 I have it, i just didnt upload it yet paperjack 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 23, 2018 Share Posted March 23, 2018 I'll show it today. However, it does not have any collisions. It has easy way to use renderTextures for masks. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 23, 2018 Share Posted March 23, 2018 Ok, here it is: http://pixijs.io/examples/#/layers/lighting.js all lights are rendered to "lighting" layer, and "lighting.getRenderTexture()" can be used in any filters/sprites/masks. Quote Link to comment Share on other sites More sharing options...
paperjack Posted March 23, 2018 Author Share Posted March 23, 2018 I'm not sure I understand how it's applicable to my situation. Should I have a layer with a filtered copy of the player, which is then masked only by overlapping sprites (which are determined by a separate method) ? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 23, 2018 Share Posted March 23, 2018 You can add extra sprite inside player, that gets rendered in special layer. You pass that renderTexture to something (filter, shader)., or used as a mask for something. Some experience with filters/shaders/masks is required. Quote Link to comment Share on other sites More sharing options...
paperjack Posted March 23, 2018 Author Share Posted March 23, 2018 I think I understand what you mean: the player would be on layer 1, then you have the obstacles on layer 2, then you have a filtered layer 3. Layer 3 uses layer 2 as a mask, and layer 3 has always highest Z-order. Every frame, the image from layer 1 is copied to layer 3, creating the overlay effect. Is this correct? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted March 23, 2018 Share Posted March 23, 2018 Yeah. the only thing is zOrder and zIndex- they are applied only inside the layer and only if sorting is enabled. Z-index of layer/group is deprecated. You have to experiment with it. You can try to do it without pixi-layers first. Just separate layers as containers and add renderTexture. pixi-layers is just making the process simpler to write. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.