Showing posts with label Adventures of a rubber ball. Show all posts
Showing posts with label Adventures of a rubber ball. Show all posts

Monday, June 8, 2015

Nooby Unity tip - why you need prefabs.

Some people will tell you to use prefabs for safety and some will tell you for convenience when assembling scenes. Both reasons are true and more than enough, but I like prefabs for one more reason.

It makes it really easy to select complex elements in your scene that are made out of multiple gameObjects. Even if you have a label on your complex element, it will only select the whole thing if you click on that label. But if it's a prefab, it will select the whole thing anyway instead of the individual gameObject that is right under the mouse pointer. If your complex element doesn't have a prefab connection, it will select the individual gameObject that is directly under the mouse pointer. Want to select a single object in your prefabbed element? Just click again. (Or just directly double click on that object in the first place.) Handy for moving things around the scene.


Left object has a prefab connection, right one doesn't. I'm only clicking once on them, both have labels. Click on the GIF for a better look.
Adventures of a Rubber Ball thread.

Friday, September 12, 2014

Design/graphics cheat #2 - Mobile gaming

Mobile gaming is all the rage now, and companies are showing their latest phones, tablets, phones the size of slippers and chipsets for 3D graphics on-the-go.
Everybody are now showing off some awesome looking shaders, effects and high polygon (for mobile) models making sure you realize that it's rendering in real time. There's something that they don't show a lot though and that's real time - level wide shadowing. And there's a good reason for it as well; it's probably one of the more resource intensive stuff to pull off well enough, so people making games are resorting to all sorts of trickery like "baking" lighting, drawing the details in the textures instead, using shadow "blobs" for stuff that's moving... in general cut using realtime shadows in mobile gaming as much as possible.
(It can be done of course, but most of the time you'd be better off faking it and pushing your savings on making the game run at more fps or implementing some more resources into your enemies.)

So where am i going with it? 
Be smart in hiding things and using simple geometry to make shadows. Like the image on the right; those two things are just some of the obstacles in a game i'm trying to make that spew snow balls. 
I really wanted to have some slight shadowing/ darkening effect in those barrels. Light mapping wouldn't work of course because ... that's not how it works... and real time shadowing would be no-no. 


On a game you are trying to include as many devices as possible after-all to potentially have a larger install base. So it's back to old-school tricks, back to basics if you like. The barrels simply have 3 simple planes, with just 2 polygons each, and a simple black texture. Then the texture's alpha channel is set as semitransparent. Each plane will progressively make it look as if it's darker and darker the deeper you look. Of course this will only work for stuff that aren't out in the open.

For things that are out in the open, what someone could do is mark areas with simple trigger boxes that are placed in shadowy areas. Then have a simple script that would smoothly make the texture of the object that enters the box's volume darker, and lighter as the object exits. A poor man's light probe if you like. These things do require tweaking though, but the plus is that your game's speed won't suffer and you'll get some nice looking stuff.