gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > 'Precision problem' with graphics display

#161337 - kbeckett - Fri Aug 01, 2008 7:22 pm

I have an interesting issue with an action-puzzle game that is almost complete. The game displays a scrolling window on a grid of objects, each 26x26 pixels. The problem is that objects that are partially visible around the edges of the screen are displayed 1-pixel out of alignment. Actually, as the screen scrolls, some rows and columns of objects are also displayed 1-pixel off.

The hard part of the problem: The development has been done by a good-sized shop, and I don't currently have access to the source code. I'm the original author of a game called Crystal Mines which I developed for the NES and Lynx, which this company has ported to the DS.

This large and professional development organization is claiming that they can't fix these drawing issues, because they are caused by "precision problems with the DS hardware". I'm pretty sure the problem is fixable, but can anyone on this list confirm it?

Unfortunately, I don't know what video mode is being used, but I'm sure people here can guess based on the layout as described above.

The slight jittering in different areas as the screen scrolls is very noticeable to me, and looks pretty bad. Unfortunately, I licensed the game to another company which sub-contracted to this shop, and they're not that concerned about the problem. I'm hoping that Nintendo's QA will pick up on it and request it to be fixed... Maybe I'm a perfectionist, but it's just wrong.
_________________
-Ken


Last edited by kbeckett on Wed Aug 06, 2008 6:52 am; edited 1 time in total

#161338 - Maxxie - Fri Aug 01, 2008 7:29 pm

There is a precission issue on the 3d hardware, but that can be worked around.

There were some threads about it here in the past, just search for them.

http://forum.gbadev.org/viewtopic.php?t=14478&highlight=texture is one of them.
_________________
Trying to bring more detail into understanding the wireless hardware

#161340 - kbeckett - Fri Aug 01, 2008 8:04 pm

Sorry, I should have specified - it's purely a 2D game. Just a 2D background composed of 26x26 pixel objects (max size 32x32 objects, plus some border area).
_________________
-Ken

#161349 - Maxxie - Fri Aug 01, 2008 9:29 pm

There is no accuracy issue on 2D that i am aware of.

Some of the elements "just" have pixel accuracy, others like extended rotation background have subpixel (fixed8.8) accuracy (important for zoomed in or rotated screens)

Altho 26x26 is not a tilesize that is natively supported by the DS (8x8), and they prolly made some dirty things to make that match

After thinking another time about it, the effect you describe could be caused by scaling the raw data up/down to match into a multiple of 8x8 and then have the extrot rescale it to match 26x26 pixels.
If they then use another non rotscale (i.e. text) layer to overlay something else over this map it might come to this glitch if they don't take the 8.8 format and its roundings in mind to calculate the needed offset.
_________________
Trying to bring more detail into understanding the wireless hardware

#161352 - silent_code - Fri Aug 01, 2008 9:47 pm

Are you sure they aren't emulating 2D with the 3D hardware?

I haven't encountered such problems with the 2D hardware, yet.

In case it is 2D, do you know, wheather these objects are blitted to a background layer or made via sprite objects?

Some image would help, but as I understand, that's not an option.
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#161355 - tepples - Fri Aug 01, 2008 10:06 pm

Crystal Mines was developed by Ken Beckett in 1989 for a company called Color Dreams. It is largely a clone of Boulder Dash, and it uses 16x16 pixel tiles. Two years later, Nina B., Dan Burke, Jim Treadway, and Vance K. of Wisdom Tree made an official Christian rom-hack of Crystal Mines called Exodus, and I played the heck out of Exodus on my NES.

For a port of a game in the Boulder Dash family, I'd almost recommend redrawing the graphics so that the tile grid is 24x24 pixels, then using a tiled background layer for the graphics.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#161375 - TwentySeven - Sat Aug 02, 2008 11:45 am

If they're emulating 2d with the 3d hardware.. then yes, there is some precision issues with doing that.

Take for example rendering a large screen-aligned quad that has one or more vertexes that needs clipping by the hardware (ie: off the screen)

Precision will cause a slight jitter (subpixel, but noticable in the interpolation of the texture) as the triangles are clipped to fit the screen.

Is that what you're seeing?

#161509 - M3d10n - Tue Aug 05, 2008 12:05 pm

Are you using 3D quads? If so, how are you setting up your projection and modelview matrix? Are you using scaling?

If you set pass integers to glOrtho() and set your vertex positions as integers (without using converting to the 20.12 format), you'll get pixel-perfect alignment. But if you're using scaling you might get precision errors.

#161514 - silent_code - Tue Aug 05, 2008 6:07 pm

@ M3d10n: He is not developing it. It's contract work by another company, who claim the issues with the visuals are the hardware's fault. Read it in the original post. ;^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#161548 - kbeckett - Wed Aug 06, 2008 6:32 am

Sorry, I was monitoring this post, but only got emails for the first 2 replies for some reason, so didn't know there were more posts....

First of all, I was wrong about 26x26 - it's 24x24 (makes a lot more sense). They also have a retro mode that uses the old Lynx 13x13 graphics scaled up... I got the 26x26 from that, but that's a whole 'nother thing.

Just found out today that they're using 3D - I think they're using an internal game engine that uses the 3D hardware. The graphics are simple 2D bitmaps - no actual 3D in the game, but they're using the 3D graphics mode to render. Seems like such a waste, and it's producing this nasty result. Looks terrible to me, but the game might just get submitted to Nintendo this way, because I can't convince anyone that this is a serious enough problem. :-(

They're not using scaling - at least not for the new graphics set, so I'm sure it's fixable.
_________________
-Ken

#161549 - kbeckett - Wed Aug 06, 2008 6:42 am

tepples wrote:
Crystal Mines was developed by Ken Beckett in 1989 for a company called Color Dreams. It is largely a clone of Boulder Dash, and it uses 16x16 pixel tiles. Two years later, Nina B., Dan Burke, Jim Treadway, and Vance K. of Wisdom Tree made an official Christian rom-hack of Crystal Mines called Exodus, and I played the heck out of Exodus on my NES.


Wow - somebody that played the old game, or at least the Wisdom Tree re-write ;-) There was a much-improved Lynx version in 1991 (13x13 graphics) that added tons of new game objects and 181 new levels. Some friends actually produced add-ons for that in 1998 and a new Lynx cart in 2004 with 130 new levels. The DS version will have 311 levels (from those 2 earlier releases plus a few more). It's also coming on other platforms - might be next year before you see any of these in the U.S., however.
_________________
-Ken

#161551 - Sweater Fish Deluxe - Wed Aug 06, 2008 7:08 am

I remember your game very well, too, and I'm glad to hear that it's coming back again. I actually own the expansion CD that Songbird productions released for the Lynx version; even though I've since sold my Lynx and copy of the game, I held on to the CD. That ability to add new levels via upload directly to RAM was great. Well ahead of its time like so many features on the Lynx, though they were rarely taken advantage of.

I've played the NES version, too, but only via a plug & play clone system released some years ago called them Rumble Station that has all the Color dreams games built into it. I always wished I could find the Wisdom Tree version of that same system, but never managed to find one.

Back on topic: I've experience this pixel deformity issue when using the 3D engine for 2D myself and always knew there must be a fix, but never put the time into investigating the cause. Thanks for bringing it up. I hope you can get the developer to fix it before releasing the game. Ultimately it may not be a big issue, but it affects how th e player will perceive the game. There's not enough attention paid to quality of presentation in games these days.


...word is bondage...

#161555 - DekuTree64 - Wed Aug 06, 2008 8:04 am

Yeah, you can get an ortho matrix to match pixel to pixel. I can't remember if it's supposed to be 255x191 or 256x192, but it's pretty easy to figure out by experimentation. Just render a screen-sized quad textured with some pattern where it's easy to see if it's off, and fiddle with all the values. Also make sure all your render positions are clamped to integers. The 3D hardware works in fixed point, but for 2D you always want things to be on exact pixel boundaries.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#161593 - kbeckett - Wed Aug 06, 2008 9:59 pm

Sweater Fish Deluxe wrote:
I remember your game very well, too, and I'm glad to hear that it's coming back again. I actually own the expansion CD that Songbird productions released for the Lynx version; even though I've since sold my Lynx and copy of the game, I held on to the CD. That ability to add new levels via upload directly to RAM was great. Well ahead of its time like so many features on the Lynx, though they were rarely taken advantage of.

I've played the NES version, too, but only via a plug & play clone system released some years ago called them Rumble Station that has all the Color dreams games built into it. I always wished I could find the Wisdom Tree version of that same system, but never managed to find one.


Yeah, using the COM Lynx to download levels was actually something I created for testing levels, since creating an image to burn in an EEPROM Lynx cart took time, and Atari wouldn't do it often because of the process. I had to upload it to a BBS, and somebody at Atari had to run it down the street to Epyx, where they kept the private RSA key locked up.

So, I made some cables with little clips on the end, and you had to open up your PC and clip them onto the UART for the COM port, since the Lynx used 5V instead of 12V. This way, the level designers and testers could download and play levels. Somebody helped with the necessary circuit to enable plugging right into the COM port later, and Carl Forhan sold these with the BT expansion pack that he created with Scott Davis (the master level designer for CM). That wasn't something I had planned for, but it was cool. Scott just told me that somebody else started making cables just recently, because Carl is out of stock. Talk about die-hard fans ;-)

Yeah, I bought one of those Rumble Stations when I found out. Takes up a lot less space than keeping an old NES around. I keep in touch with Dan Lawton & company, but they didn't bother to tell me, or pay me, for that matter. But, with 16 games, and a very low wholesale price, my royalty would have been a few pennies per unit. I didn't know there was a Wisdom Tree version of that thing...

Anyway, you can look forward to a DS version of Crystal Mines, which is looking pretty good despite some minor issues, and there are plans for a downloadable version for Xbox and PS3 (PSN), plus a PC version. Those should be out within a year, and will be significantly improved over the DS version - plans are for a level designer, multi-player mode, etc.
_________________
-Ken