XNA Essentials

Game Programming for Xbox 360, PC + Windows Phone

NAVIGATION - SEARCH

Errors i found while reading

Hi Chad,


Good to see you finally made that forum. I have been trying to find a wya to reach you, but without succes until know. The only contact method this site was offering was through xbox live, but being one of those developers without an xbox, it was useless to me. I tried sending you a private message through ziggyware, but I don't think you received it.


Either way, i been reading the book, and discovered a few errors. I'm far from wone with it however, so chances are i'll probably discover more, but here goes:


 


Page 42,43 - benchmarking:


Method TransformVectorByReference(), TransformVectorByReferenceAndOut(), TransformVectorByReferenceAndOutVectorAdd() have the same content. Also, TransformVectorByReferenceAndOut() and TransformVectorByReferenceAndOutVectorAdd() have a ">" behind the () brackets.


Page 57:


You wrote LoadGraphicsContent, while this should be LoadContent. This error was already mentioned by Alvin however.


Page 61:


Not a real mistake, but a question: Usually, when you make Vectors, you use floats for the 3 values. However, on page 61 you use integers. Nothing wrong with this, but i wonder if there's a performance difference?


Page 75:


The VertexBuffer() method parameters are wrong. For example "ResourceManagementMode" can't be added.


XELibrary input:


While building the keyboard input, you start the program, and say "we can now quit the game by pressing escape". However, you only add the input component to the game after you're done with the cameraYaw.


Page 91:


Again, more a question then an error, but you write "return (keyboardState);". Why do you put keyboardState between brackets?


 


 


I'm only at page 135 atm, so i'll probably discover more errors as I progress, and let you know about them. Though it will go slowly as i lack time currently. I also think i found a few more errors but stopped writing them down because i had no way of letting you know about them. I'll post them on here from now on.


Thanks for the great book!

Myth - Thursday, May 7, 2009 @ 1:42 PM

Re: Errors i found while reading

Sorry, I didn't get the message through Ziggy's site.


Thanks for pointing out the extra > in the book.


Regarding passing integers to the Vector constructor ... it is not for any kind of performance gain. The compiler will convert that to a float for me so I don't have to append the "f" on the end. 


Thanks for pointing out code that was left over from the earlier book on page 75!


The code should be:


vertexBuffer = new VertexBuffer(graphics.GraphicsDevice,
VertexPositionNormalTexture.SizeInBytes * vertices.Length,
BufferUsage.WriteOnly);

The comment about exiting the game by pressing escape wasn't actually instructing the user to run the game that instant. It definitely could have been worded better.


I typically use parenthesis when calling return or throwing errors. It is not required by the compiler, but it is something I do for consistency. 


Thanks for pointing out the issues, please feel free to post more as you find them.


Happy Hunting!


Chad


 

Chad Carter - Friday, May 8, 2009 @ 11:56 AM

Re: Errors i found while reading

[quote user="Myth"]


Page 42,43 - benchmarking:


Method TransformVectorByReference(), TransformVectorByReferenceAndOut(), TransformVectorByReferenceAndOutVectorAdd() have the same content. Also, TransformVectorByReferenceAndOut() and TransformVectorByReferenceAndOutVectorAdd() have a ">" behind the () brackets.


[/quote]


 


Myth, you're correct that TransformVectorByReference() and TransformVectorByReferenceAndOut() appear to have identical code, however, TransformVectorByReferenceAndOutVectorAdd() includes a second argument to the MathHelper.ToRadians() call:


            Matrix.CreateRotationY(MathHelper.ToRadians(45.0f), out rotationMatrix);


I'm not sure what difference, if any, should exist between the two identical but differently  named methods.


 

Kitheri - Tuesday, November 24, 2009 @ 11:30 PM