Hi, I've been having this problem since I started making my game, I searched the forums
for a solution without any luck.
Most of my objects wont align
exactly where I want them to, they usually jump a pixel or two to the left or right,
whether I position them manually or with scripting.
Pixel perfect alignment is necessary due to the nature of my objects. in order to avoid
aliasing on them I save the object PCX with the surrounding area of the room.
So if the scenery area of the object doesn't fit perfectly with the actual scenery its
easy to spot the mistake.
My game is 640x480 32bit, and my desktop resolution is 1152*900
Any help would be appreciated.
Objects can currently only be positioned on even pixels, because they use the relative, internal screen resolution for that (320x240 in your case).
You have to keep that in mind when designing your backgrounds.
There's already a tracker entry (http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=434) for a more accurate positioning system.
Can you not use the alpha channel to create sprites with antialiased borders? That way it won't matter so much if they're a pixel off.
I'm working with Kikuta on this game, so I can answer for him.
Snarky:
I've been playing around with Alpha channels with some success for some time now, but I try to avoid using them as much as possible due to their big size. We're already having trouble keeping the game file size down. But I don't know if after compiling the .Targa's size drops considerably.
Do they?
strazer:
Well I'm glad this isn't affecting only us. Is there a way I can know if I'm saving a file with a resolution that works fine with those even pixels?
Its seams pretty random whether the file will fit or not.
When they don't fit I usually have to take the object back to Photoshop and resize it by a pixel, and I'd really like to find a way to get the right size in the first try.
Quote from: Razorback link=topic=18792We're already having trouble keeping the game file size down. But I don't know if after compiling the .Targa's size drops considerably.
Do they?
Nope, as all sprites are NOT compressed in an AGS game, because of speed issues, so, actually it doesn't matter what graphic files you are using for import (TGA, PNG, BMP, PCX, etc. but then only TGA and PNG supports alpha channels here) the resultant game file size will be the same (unless they're of different colour depth), if your sprites are 24-bit already, and you add a alpha channel to each, it'll use 4 bytes instead of 3 for each pixel, so roughly speaking, if you add alpha channels to the game's sprite, the sprite data size would be increased by about 1/3 of the original, which I think is not really that much compared to the already large size of the 24-bit sprites (well if you used 8 or 16 bit colour sprites to save memory, then it's a different story...).
Quote
Well I'm glad this isn't affecting only us. Is there a way I can know if I'm saving a file with a resolution that works fine with those even pixels?
You paint them on a layer above the background, and then grabbed them as rectangles right? The only thing you need to know is that when grabbing the rectangles, make sure both of the X and Y coordinates of the upper left corner are both even. It would be even more secure if the width and height are both even pixel too.
and you could always add a transparent pixel colum (or row) to the left and bottom edges of those objects that you have already done and dont have even dimensions coords
Actually, the x/y-coordinate of objects is measured from the bottom-left corner of the sprite (characters: bottom-middle, overlays: top-left).
So when you have your background with object opened in your image editor, make sure that the bottom-left corner of your selection is on even pixels.
Actually, as the position of the anchor is different when using the sprite for different purposes, the safest way is still "make sure both of the X and Y coordinates of the upper left corner are both even AND the width and height are both even pixel too."
Also I think it depends on how CJ implement the engine (which we're not very sure about it), for example, if a sprite is of odd pixel height, if it's used as an object, where should the bottom-most line of pixels in the sprite be painted on the screen, the upper screen line, or the bottom screen line of that room line? If it's the bottom screen line (which I'm not sure but I think it's probably the case), then it would be misaligned if the bottom-most line of the sprite was grabbed from the original picture at an even coordinate (as the bottom screen line of a room line is of odd coordinate).
Argh, stop confusing me! :P
Quotethe safest way is still "make sure both of the X and Y coordinates of the upper left corner are both even AND the width and height are both even pixel too."
True. :)
Quotethe safest way is still "make sure both of the X and Y coordinates of the upper left corner are both even AND the width and height are both even pixel too."
Very well, I will do this from now on. Many thanks to everyone.
I thought that figuring out the even X and Y coordinates every time I create an object was a little time consuming. (Not terrible but still...yes, I'm lazy) So I was trying to find a shortcut that would speed up the process and lo and behold, I had quite an ingenious idea if I may say so myselfÃ, ;)
So, my game is at 640*480 res, and AGS works thinking like if it was 320*240.Ã, Welly welly well, 640*480 divided by 2 is 320*240. All I need to do is make my selection around the object with the zoom set to 50% on Photoshop. this way I'm sure to select only even pixels. I've already tried this with about five examples, they all worked. I hope it wasn't just luck (or bad luck depending on the situation)
Hope this helps other people in the same situation.
Thanks again.
BFAQ'ed: http://bfaq.terran-x.com/#graphics33
Yeah, I REALLY have to re-organize the BFAQ with separate categories. :P
This is probably a stupid question. Was that on BFAQ all along, or did you just update it?Ã, ???
if he says BFAQ'ed, that means he just added it, and thats not such a stupid question, youre fine.
Hmm, maybe I should change that little saying... something like "Now BFAQ'ed:". Sorry for that. :P