Advertisement

Tricks of the Windows Game Programming gurus question

Started by January 23, 2001 10:59 PM
17 comments, last by dashworth 24 years ago
I love Andre Lamothe''s book, but I have run into a stumbling block: I am in chapter 7, and the examples from 7_10 to 7_16 do not work properly, if at all. At first I thought it may be because of my video card or something like that, so I tested the demo''s on an ATI card on my laptop and a Voodoo 5 card on my computer, and the result is the same. The exe''s and the .cpp files both dont work. The .cpp files compile, and I make an exclusive directory with the project .cpp file and the used images. I think my problem may be this: His book unfortunately is for DirectX 6.0, and I''m running win2k on both machines. I''m afraid chapter 7 may give me problems due to DirectX 6.0 and Win2k issues. This is only a guess presently. I have emailed Andre Lamothe twice now with no response, which is disappointing, but understandable. I had a problem in Chapter 4 with the line draw, and the example wouldnt compile. I altered a line of code and it worked fine, but trying to debug 7 examples of code I am just learning is killin me. Funny thing is, on 7_10, I can place a message box at a certain point right before Andre locks the back buffer, and the image that is supposed to show up, shows up after i hit the ok button. Otherwise, the image flashes and the screen returns to black. If there is anyone out there with these problems with solutions, I''d appreciate any advice. I am using Visual C++ 6.0 on Windows 2000. I have tested the examples in DirectX 7.0a and DirectX 8.0. Voodoo5 on DX 7.0a and ATI on DX 8.0. Both yield the same result. On 7_13 and 7_14, the sprites show up as a blocks of graphic fuzz. That is the only difference in my issues. The others just flash the bmp and return to black quickly. I know the 24 bit examples wont compile on my voodoo card since it is not capable of 24 bit graphics (16 or 32 is my only option), but most of these are 8 bit or 16 bit and the ATI card is more than capable of 24 bit graphics. If you have experienced any of these issues and can offer me any solutions, I''d appreciate it. Thanks. Dave
Dave_________________There are three kinds of people in this world: Those who can count, and those who cant.
There were some issues with the book when it first came out. The major issue being that there was a corrupt CD. Which created problems similar to the ones your experiancing. If you purchased the book and accidentaly got a corrupt cd you can email SAMS (the publisher of the book) requesting a replacement CD.
Joseph FernaldSoftware EngineerRed Storm Entertainment.------------------------The opinions expressed are that of the person postingand not that of Red Storm Entertainment.
Advertisement
If the CD were corrupt, would i be able to open the CPP files? or run the exe''s? I thought the corrupt issue made it to where the files couldnt be read. I''ll check his site and see if i can find any more info.

Thanks.



Dave
Dave_________________There are three kinds of people in this world: Those who can count, and those who cant.
No! I just bought that book like yesterday and have been reading it ever since. Haven''t tried compiling any of the examples yet, though. So if I just bought that book, would I have these problems, too? After all evaclear did say there were issues with EARLY releases of the book. What about the most recent?
I may find out I''m a dufus or something, or that win2k doesnt like directx 6.0. I''m not sure. My book is pretty new. If you would like, open up the source folder, go to chapter 7 and run demo 7_10.exe thru 7_16.exe and see if you see the bitmaps Mr. LaMothe is trying to post. Two of those have aliens walking across the screen, but mine look like fuzzy boxes. If you do that, and you see pictures and aliens when you run it, I''d like to know what you are running on your machine (OS, vid card, compiler) to see if I can find out what''s causing my problem.

Thanks for any information,

David
Dave_________________There are three kinds of people in this world: Those who can count, and those who cant.
It''s alright if you''re using DirectX 6.0 with Win2k. Win2k ships with DX 7 and that will have the DX 6 interfaces with it, so there should be no problem there.

If you installed the SDK that was shipped with the CD, you might run into problems. When I did that (sometime last year) it really messed my system up. I could only flip the primary surface ONCE each time the program was run. After that, subsequent calls to the Flip function didn''t do anything. At first, I thought it had to do with my Drivers, so I downloaded the latest drivers and tried my program. No go. I ended up having to reinstall Windows. And everything worked fine, until I installed the SDK again. So that''s how I managed to pinpoint it to the SDK.

Most of Andre''s examples write directly to the primary surface (i.e. memory that''s currently displayed on the screen). Win2K doesn''t like this. You''ll need to do all your rendering to the back buffer, then flip/blit it to the primary surface.

Hope that helped.


==========================================
In a team, you either lead, follow or GET OUT OF THE WAY.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Advertisement
I might have the solution for the fuzzy boxes instead of aliens. In scan_image_bitmap() change ddsd.dwWidth to ddsd.lPitch.

Hope this helps

Just my thoughts take them as you will.

"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
As far as the block of graphics fuzz, I found some errors in his code in chapter 17 that only crop up if you have certain graphics cards. I fixed it about half a year ago when I read the book, but I dont recall exactly what the problem is. It has to do with running the program in 16 bit mode, and having a 565 graphics adapter (or was it 555?)there are two errors, first when he shifts his bits to get red green and blue i think he uses >> 3 >> 3 and >>3 when it should be >>3 >>2 >>3, and his equation for _RGB16BIT565(r,g,b) is wrong... again he shifts the wrong number of bit.

hth
Lep
I am running the examples on DirectX 7.0a, and DirectX 8.0. I got 8.0 off of Microsoft''s web site. Going to test the fuzzy thing. I have Ian Parberry''s book as well, and his code loads a bitmap to the screen fine. I''m probably going to start it until I can find some answers to Andre LaMothe''s book. Chapter 8 and on seem to work fine in Andre''s book as far as the exe''s go. I tested alot of them to see if there was going to be anymore hang ups like this. I''ll read it, ignore the code till I can find out why it doesnt work, or move on and use other resources.

I''m going to try and mess with the fuzzy sprite thing in his book and try some of the suggestions mentioned here. I had a problem in chapter 4, example 4_2, but I got it working:
Mine wouldnt compile on WIN2k..

The line:

HPEN old_hpen = SelectObject(hdc,hpen);

change to:

HPEN old_hpen = (HPEN)SelectObject(hdc,hpen);

4_2 wouldnt compile for me until I changed this line. Just thought I''d throw that out to anyone using this book having problems.



Dave
Dave_________________There are three kinds of people in this world: Those who can count, and those who cant.
Having to use (HPEN)SelectObject...

Older versions of MS VC++ were less anal about type casting than the most recent versions. Code from TOTWGPG was written using one of these older versions (because the book was written x (?) years ago).

I'm not sure about VC++ 5.0 but I know you have to perform proper type casting when using VC++ 6.0. Andre mentioned this in the later editions of WGP for Dummies (decent book for a beginner GAME PROGRAMMER not a beginner programmer, don't let the name throw you).

L8r,
Murph

--------------------------------
Screw you guys! I'm going home.

Edited by - murph on January 24, 2001 10:24:06 AM
--------------------------------Screw you guys! I'm going home.

This topic is closed to new replies.

Advertisement