Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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  
  Two Image Questions  (Read 1174 times)
0 Members and 1 Guest are viewing this topic.
Offline Black Drazon

Junior Newbie





« Posted 2006-04-05 22:41:13 »

Wow, a Java game programming forum.  Glad I finally foudn this place!

It hit me mid-way through planning a new project (new graphics and interface for a fantasy strategy game originally played with circles and squares, very "Rogue", I know) that I know... nothing about images for programming.  Well, that didn't come out right.  I know well enough to say that BufferedImages don't like me (I tried for a few weeks, once) and so forth, what I don't know is something I know quite well for web design: which image format to use.  I need a format that supports transparency and is still small in size.  I'm not sure if I want to use gif or png or something else because my knowledge is strictly limited to web design - I don't know if there's anything better, or if one of those two works better with Java, or what have you.

My question for images is a lot more complicated, as it's the challenge I put into the design to improve my skills.  I want to create "contact sprites", namely for showing damage being taken.  Every weapon in the game is its own sprite, so that they can be interchanged.  The trouble is, I can't even begin to work out how to do the contact without spending way too much time duplicating images (one sprite of a spear attacking a peasent, another of a sword attacking a wolf, another of this attacking that... etc).  Any ideas?
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2006-04-05 23:01:58 »

Wow, a Java game programming forum.  Glad I finally foudn this place!

It hit me mid-way through planning a new project (new graphics and interface for a fantasy strategy game originally played with circles and squares, very "Rogue", I know) that I know... nothing about images for programming.  Well, that didn't come out right.  I know well enough to say that BufferedImages don't like me (I tried for a few weeks, once) and so forth, what I don't know is something I know quite well for web design: which image format to use.  I need a format that supports transparency and is still small in size.  I'm not sure if I want to use gif or png or something else because my knowledge is strictly limited to web design - I don't know if there's anything better, or if one of those two works better with Java, or what have you.

I generally use PNGs these days.  If you need something that is very small and dont mind lossiness then JPEG would be a good solution.

Quote
My question for images is a lot more complicated, as it's the challenge I put into the design to improve my skills.  I want to create "contact sprites", namely for showing damage being taken.  Every weapon in the game is its own sprite, so that they can be interchanged.  The trouble is, I can't even begin to work out how to do the contact without spending way too much time duplicating images (one sprite of a spear attacking a peasent, another of a sword attacking a wolf, another of this attacking that... etc).  Any ideas?

What about a generic blood splat?  Do it right and the splat can even hide the actual contact point so you dont need to really have pixel to pixel contact.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline noblemaster

JGO Ninja


Medals: 20
Projects: 9


Age of Conquest makes your day!


« Reply #2 - Posted 2006-04-06 00:24:34 »

PNG: If you need to create translucent/transparent images (are little bit bigger in size than JPG/GIF)
JPG: for photo-style images with lots of colors where exact pixel colors do not matter (no transparency)
GIF: for basic transparent (not translucent) images. Good in compression if not so many pixels.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Kova

Senior Member





« Reply #3 - Posted 2006-04-06 01:15:06 »

Yeah I use PNGs also. I noticed that fancy glow and transparency (at the same time) can't be achieved with GIF... can someone explain to me (in addition to anwsering Black Drazon's first post) what is translucet? Oh nvm I'll google it first.
Offline noblemaster

JGO Ninja


Medals: 20
Projects: 9


Age of Conquest makes your day!


« Reply #4 - Posted 2006-04-06 03:48:01 »

translucent: allows you to define a see-through level.

gif: either opaque or transparent only
png: from see-through level 0 (opaque) to level 255 (transparent).

Offline Black Drazon

Junior Newbie





« Reply #5 - Posted 2006-04-06 04:55:05 »

Okay, so images in programming are like images on the web, except we know how TIFFs do special things for us, and they can't   Roll Eyes.  lol, well... TIFFs are messy anyways.

I think I can probably use the blood spatter!  Or maybe something else that just occured to me... either way, thanks all!!
Offline Vage

Senior Newbie




learning++;


« Reply #6 - Posted 2006-04-07 01:17:09 »

If I remember my Final Fantasy, I'm pretty sure it was always a general 'hurt' animation and an 'attack' animation....

Personally, you could strap me into a mech cockpit with 47 virtual HUD displays, two complex hand controls and foot pedals and I'd be grinning like the gamer freak I am.
Offline Ask_Hjorth_Larsen

Junior Member




Java games rock!


« Reply #7 - Posted 2006-04-07 01:20:01 »

Quote
PNG: If you need to create translucent/transparent images (are little bit bigger in size than JPG/GIF)

That's funny, I find that png's generally take less space. Actually just about the same amount. They are very similar formats, except png does not support animation (which is generally useless to us) whereas it does supports translucency (i.e. partial transparency for those it may concern). Oh, and .gif is a non-free format so just use .png (or JPG where appropriate).
Offline noblemaster

JGO Ninja


Medals: 20
Projects: 9


Age of Conquest makes your day!


« Reply #8 - Posted 2006-04-07 01:55:46 »

Quote
That's funny, I find that png's generally take less space. Actually just about the same amount

I thought so too, but it always come out as slightly more than GIFs or JPG. At least for me. Do I do somthing wrong?

I don't see any compression options for PNG? I use Photoshop.

Offline Kova

Senior Member





« Reply #9 - Posted 2006-04-07 02:42:44 »

I apologize to author for using his topic Smiley
Mine come out slightley bigger also, but we're talking about pics, they are to small to take any serious space even in raw, uncompressed format. It matters only if you need them downloaded from net every time you run an app. I remember somebody saying that pictures uncompress in memory anyway so it's only their size in pixels that counts, with formula width * height * 3. Can anybody tell me why 3 at the end?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline noblemaster

JGO Ninja


Medals: 20
Projects: 9


Age of Conquest makes your day!


« Reply #10 - Posted 2006-04-07 03:44:30 »

Size in memory (uncompressed): width * height * 3 [bytes] 
3 bytes for: TYPE_RGB (Red, Green, Blue - each 1 byte)
4 bytes for: TYPE_ARGB where A is the alpha (tranlucency) value

Offline Ask_Hjorth_Larsen

Junior Member




Java games rock!


« Reply #11 - Posted 2006-04-07 15:31:42 »

I have just made a few tests. Using the ImageMagick convert function without arguments, .png files do indeed take considerably more space than .gifs. However, using Gimp I can specify a level of png compression, which at the highest level yields smaller file sizes than gif counterparts.
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.

xsi3rr4x (75 views)
2014-04-15 18:08:23

BurntPizza (68 views)
2014-04-15 03:46:01

UprightPath (80 views)
2014-04-14 17:39:50

UprightPath (65 views)
2014-04-14 17:35:47

Porlus (81 views)
2014-04-14 15:48:38

tom_mai78101 (105 views)
2014-04-10 04:04:31

BurntPizza (165 views)
2014-04-08 23:06:04

tom_mai78101 (261 views)
2014-04-05 13:34:39

trollwarrior1 (210 views)
2014-04-04 12:06:45

CJLetsGame (220 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org 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‑gaming.org
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!