Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Best way to render glowing lines/rectangles  (Read 5022 times)
0 Members and 1 Guest are viewing this topic.
Offline dario3004

Junior Newbie

« Posted 2012-04-18 01:06:48 »

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!:-)
Offline philfrei
« Reply #1 - Posted 2012-04-18 02:34:20 »

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.

"It's after the end of the world! Don't you know that yet?"
Offline _Al3x

Senior Devvie

Medals: 7

Indie Games FTW!

« Reply #2 - Posted 2012-04-18 02:47:29 »

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

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline StumpyStrust
« Reply #3 - Posted 2012-04-18 03:52:05 »

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.

Offline davedes
« Reply #4 - Posted 2012-04-18 07:43:37 »

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.

Offline dario3004

Junior Newbie

« Reply #5 - Posted 2012-04-18 10:29:26 »

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?) Smiley!

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?:-)

Offline StumpyStrust
« Reply #6 - Posted 2012-04-19 05:13:29 »

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.

Offline ags1

JGO Wizard

Medals: 75
Projects: 3
Exp: 5 years

Make code not war!

« Reply #7 - Posted 2012-05-30 17:54:30 »

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.

Offline Oskuro

JGO Knight

Medals: 40
Exp: 6 years

Coding in Style

« Reply #8 - Posted 2012-07-26 15:06:04 »

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.

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.


Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!