Thursday, March 3, 2016

Pop Up Nameplates #gamedev


This is my newest feature added to the game. This pops up when you are touching something. Obviously the name that pops up is also relevant to the object I am currently touching. I also have a setup where you could touch 5 things at once... though so far I am only really able to touch two things at any one time.

So Why the pop up placard, name plate?

When I first implemented touching objects in the game I had them alpha cycle in and out. then I changed that later to darkening their color instead. But there were always problems with this approach.
1. Some of the objects looked bad cycling in this way.
2. When I introduced multi-sprite objects, only the first spriterenderer would alter it's colors. The children do not inherit this change.
3. I then created my first animating sprite and they were even less cooperative, as the base spriterenderer would not cycle as the color was being controlled from the animation.

I always knew that I needed to do something. So a few days ago I came up with the idea of just for now putting the list of objects you are touching at the top of the screen somewhere. Then in discussion with a friend of mine, he suggested I place it near the player. This ended up being the approach I have taken. What's cool is that the placard actually moves as you brush past objects. This is because I place the placard half way between the players origin and the objects origin. It gives it a really professional look.

I also put that faded back plate under the text, and I can color that if I want to show specific traits of the objects you are touching, and it scales based on long the string is.

I did have other ideas for how to handle showing what you are touching. They are a lot more complicated than this one, such as:- Having a render buffer and render the object you are touching (it's whole hierarchy) and then write an outline shader, or possibly a fill shader. finally take that buffer and render it over the objects you are touching. There are many possibilities with this technique, but I do feel it would be a bit of a resource hog on some platforms.

I really think this is a major addition to a problem I have had since I started working on this game.

G'night
Da Voodoochief

No comments:

Post a Comment