Best way to render glowing lines/rectangles

Hey people!
I’m coding a simple “spacey” version of pong to introduce myself into Android and games developing. The game is fine and I’m doing some stuff to make it look better. This is a sketch image of how the game activity should look like:

As you can see I’ll put some glowing bars on the sides and I don’t know if it’s better to just load the images into the game because they are just “background stuff” or make it with some Java Graphics function. I made a fast google search and as far as I understood blurring/glowing could be heavy for the CPU. (yea but maybe I could render it just once the game is started and save it into a image that will be draw into the game)

The other way is to make it with GIMP adjusting the bars for every screen size. (maybe just rendering it with a size relative to the screen height could be the solution, but I think there should be problems from handling the width of the resized glow for the correct wall bounce…)

Usually what’s the best way to take in this case? Thanks for the advice!:slight_smile:

There are more experienced folks who will give you a “best” approach. All your ideas sound fine to me. For a game I made, I created various shapes and made them glow & be gels (look slightly raised) and it was a bit of work to write the code but interesting and works fine. Maybe a lot depends on the complexity. Bars sound pretty simple to handle via Java.

One thing I am curious about (and the main reason I am writing) is that I really like your background. Is it made on the fly or is it a graphic? I also made some stars that twinkle for my game (on the fly, using transparency), but I didn’t manage to figure out how to make the nice cloudy features.

Im pretty sure it’s static, but lest hope not and that he share it (I dream too much?) :)!

Anything made on the fly (such as glowing) will drop performance. I think that using an image/texture for simple 2D things would be easier.

And making glowing images is really easy with gimp or photoshop. The only major down side I have had in using images is that sometimes they do not scale very well and you need more memory.

I think you should go with using an image unless you want to create a blur/glow filter for fun.

IMO the easiest thing would be to bake the glow onto the assets. e.g. Your ball image would have a glow baked on it; making it a slightly bigger texture but not by much.

If for some reason you need to render the glow independently of the rest of the assets, you could think about 3- or 9-slice scaling a reusable “glow” effect to keep texture space to a minimum.

lol, I really would like to help you but it was a lucky find on Google. I don’t even know if I can legally use on my game, but since this is just a test and don’t know if will ever reach the market who cares:-P
This is the image, maybe with a TinEye search more infos could be find out about it:

Thanks for the advices, I’m gonna try the GIMP way + screen size adapting. I’ll let you know about the results!
PS: any suggestions for better paddles looking?:slight_smile:

You could make your own paddle images an if you want to get really fancy add a particle system for some cool effects.

It does not have to be robust at all just have an object that takes an x and y location and slowly fades out as it updates/draws.

Make it so on each move or every other move the ball/paddle create a one of these objects. You can do some cool things with just java2D rects.

For amazing space graphics, have a look at APOD. NASA images are often featured, and the nice thing about that is that they are all in the public domain, so free to use, I believe.

I’m doing a similar thing for a similar game, using “neon” lights instead of plain lines.

My current approach is to use SVG to define the graphics, the load the xml-like structure into my game and scale according to screen dimensions.

As for the glow, I just draw three rectangles: Fully solid white core, fully solid color glow (A bit wider and below the core), and finally a somewhat transparent wider glow.

Using a vector drawing program I play around with sizes colors and transparencies until they look right.

The idea afterwards is to scale the glow part in-game to make it flicker.

The faster alternative is to pre-render (or draw manually) the glowing bars at load time, and then just animate them as a regular sprite.