• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Guest Anonymous Poster

16-bit hell

9 posts in this topic

Helloy...
Don't know what your problem is but you should check out the ddutil.h /.cpp files included with the sdk. In there you have functions who is loading bitmapps directly into dx-surfaces.
It is more fun to do it yourself but atleast you could use them to see if it is your bitmapreading-algorithm that is messing with ya.

/Derwiath

0

Share this post


Link to post
Share on other sites
uhh what the hell is this?

UCHAR
blue=bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
green=bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
red=bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];

mmmm i seriously doubt you wanted all three colors to have the same (y*IMAGE_HEIGHT*2+x*2)in it

0

Share this post


Link to post
Share on other sites
Thanks for the suggestion. I really wanted to do it myself, but I'm getting to the point that I don't care anymore . I'll have a look at the stuff that comes with the SDK.

No, I don't want each color to be the same, but that is as close as I can get it to being normal. Since I don't move any bits, the image is in black and white. If I try to ajust the colors, they totally bug out and give me things that people see when they take too much acid.

0

Share this post


Link to post
Share on other sites
Have you tried replacing:

UCHAR blue = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
green = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
red = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];
USHORT pixel = _RGB16BIT565(red,green,blue);

with:

USHORT pixel = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];

0

Share this post


Link to post
Share on other sites
Try replacing this:

UCHAR
b = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
g = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
r = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];

with this:

b = bitmap.buffer[(i*3)+0] >> 3);
g = bitmap.buffer[(i*3)+1] >> 3);
r = bitmat.buffer[(i*3)+2] >> 3);

however, I used that to convert 24bit bitmaps to 16bit bitmaps, so if something weird happens, try saving your bitmap as 24bit and then loading it using that.

also, the macro I used is:

#define _RGB16BIT(r,g,b) ((b%32) + ((g%32) << 5) + ((r%32) << 10))

hope that's useful... later!

------------------
Luis Sempe
visuallr@netscape.net
http://www.geocities.com/SiliconValley/6276

0

Share this post


Link to post
Share on other sites
It looks like you are using 6 bits for blue. Can someone tell me if I'm wrong? The macro right above me looks more like it.

------------------
Still Learning...

0

Share this post


Link to post
Share on other sites
I think you get wrong input data from the bitmap.buffer .
You get an greyscale image with the
UCHAR blue = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];
green = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];
red = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];

because the RGB values are all the same, so I think the program has loaded the right data. (Because, you get a grey value when R,G,B values are the same.
Extracting the value from the buffer seems to be the problem. I don't know how the data is distributed in the "buffer", but this is essential to solving the problem.

VisualLR has introduced another problem to the 16-bit hell. He transforms his 888, RGB value to a 555-bit value with 5-bits for red, 5 for green and 5 for blue. This isn't mostly right(it depends on the graphic card), so many cards use the 565-bit style.

->Aidan

0

Share this post


Link to post
Share on other sites
Hehehehe, got it.

I ended up using a cheapo color-scaling algorithm to load 24-bit images and dither them down to 16. The pics still look pretty good, but it only works on images where the height and width are divisible by 4, 400, 64, 256, etc. That's really not a problem, so I'm pretty damn satisfied.

Now it's time for the hard stuff .

Thanks to all who posted

0

Share this post


Link to post
Share on other sites
Ok, I've been writing some framework for a game, but I haven't gotten very far due to the fact that I can't load a 16-bitmap correctly. If the macro and code look weird, yell at Andre LaMothe, it's his book I'm reading

#define _RGB16BIT565(r,g,b) ((r%32) + ((g%64)<<6) + ((b%32)<<11)) //This is the macro to smash the bytes together
///////////////////////////////////////////
lpddsprimary->Lock(NULL,&ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
USHORT *vidbuffer = (USHORT *)ddsd.lpSurface;
for(int y=0;y{
for(int x=0;x{
UCHAR blue = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
green = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)],
red = bitmap.buffer[(y*IMAGE_HEIGHT*2+x*2)];
USHORT pixel = _RGB16BIT565(red,green,blue);
vidbuffer[x+y*(ddsd.lPitch/2)] = pixel;
}
}
///////////////////////////////////////////

The bitmaps being loaded are actual 16-bit, not 24. The above code makes a wonderful greyscale picture of whatever bitmap I've loaded. If I shift a few bits here or there, I manage to get some rather 'interesting' effects, but I just can't get the actual bitmap with the right colors to display.

Oh, and if it matters, the bitmaps were created in Ulead Video Paint and saved as 16-bit bitmaps.

Thanks in advance...

0

Share this post


Link to post
Share on other sites
Oh yah, here's the code if you wanna see it. It uses the same macro as the one above:

lpddsprimary->Lock(NULL,&ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT,NULL);
USHORT *primary_buffer = (USHORT *)ddsd.lpSurface;
for (int index_y = 0; index_y < bitmap.bitmapinfoheader.biHeight; index_y++)
{
for (int index_x = 0; index_x < bitmap.bitmapinfoheader.biWidth; index_x++)
{
UCHAR blue = (bitmap.buffer[index_y*bitmap.bitmapinfoheader.biWidth*3 + index_x*3+0])>>3,
green = (bitmap.buffer[index_y*bitmap.bitmapinfoheader.biWidth*3 + index_x*3+1])>>3,
red = (bitmap.buffer[index_y*bitmap.bitmapinfoheader.biWidth*3 + index_x*3+2])>>3;
USHORT pixel = _RGB16BIT565(red,green,blue);
primary_buffer[index_x + (index_y*ddsd.lPitch >> 1)] = pixel;
}
}

0

Share this post


Link to post
Share on other sites