Pages

Sunday, 22 December 2013

Packt

I have reviewed one or two books that have been published by Packt publishing, and I have to be honest, the content, while normally accurate, has been a little thin on the ground. I am pleased to say, not with this book!
I am pleased to say this as I have known the author for a number of years. As is the case with on line communities, I have never met him physically, but I have known Michael for many years.

Chr0n1x

I first encountered him when I started to get into XNA on a well know community board called the Hazy Mind, he went by the name Chr0n1x then, board was ran by another XNA/DX guru Micael Schuld. Chr0n1x was one of the main go to guys on that board after the admin, and he helped me a great deal, not just in the early days but even today with various GPU related issues I have. At that time I don’t think Michael was even in college/Uni then but his understanding and knowledge of the GPU and it’s pipeline was hard to beat.

The Book

So, enough of all that, what about this book, we know it’s rich in content, but is it any good? I think it is, it takes you right from the basics of setting up your project and creating a simple game loop along with a graphics device, drawing sprites and using input devices and accelerometers to live tiles, networking publishing to the store and monetization. Now, I know, this all sounds a bit 2D, but in the appendix Michael quickly covers some of the basics of 3D too, but to be honest, you really need the first lot of tools and can create a great 2D game, but you still need the skills from the previous chapters to get your game together whether its 2D or 3D.

Should I buy this book?

If you are not new to C++, but new to DirectX and/or game development and want a great book to get you into it, and take you to an intermediate level then, yes, this is the book for you. If you know C++ and have done some game development, then yes, there is some great stuff in here for building games for Windows 8, personally I am going to find it very useful for padding out a lot of holes in my C++ and DX knowledge.

Anything Missing?

The only thing I would have liked to have seen in this book was audio, it gets a mention, but there is no implementation shown, which is a shame, but you know what, the amount of stuff that’s in here, you can find this out somewhere else anyway.

Friday, 2 August 2013

A number of weeks ago, I was asked by Packt Publishing to review this book, they gave me access to the eBook version of the book. Normally I am not to keen on reviewing books, but as this was based on a topic close to my heart (HLSL) I thought I would give it a go.

The book is made up of six chapters, which for a book priced at (hard back) £30.99 seems steep, I guess you can get the eBook for £16.14. The books tag line is “Quick answers to common problems”, and I guess it sort of does provide this from forward rendering, deferred lighting, shadow mapping, post processing and SSAO, and all for DirectX 11.

I am going to go over each of the chapters and tell you what I thought of each.

Chapter 1: Forward Lighting

Chapter 1 starts of where I guess we all do with HLSL, with forward rendering. Covering Hemispherical ambient light, directional light, point, spot and capsule light, it then goes on to cover projected textures as well as multiple lights. The last part of this chapter I found odd to cover as the next chapter covers deferred lighting, for those of you who are un aware of the difference, with forward render having more than 3 lights tends to kill your GPU, where as deferred lighting allows you to render lots and lots of lights at comparatively little cost. I did however like the solution given for the multiple lights for a forward render :)

Chapter 2: Deferred Shading

A topic close to my heart, this is not done how I would have done it, but still gives a good effect, this chapter covers the creation of the GBuffer, but does not cover how you would go about creating the render targets for it in ode, other than giving the types of targets to use for each RT (You can download the source code for this once you have bought the book though, C++ only though) The chapter then goes onto cover a number of light types, point, capsule and spot lights, but again thought a cone light could have also been added.

Chapter 3: Shadow Mapping

I quite liked the shadow mapping technique given in this book, it uses a PCF (Percentage Closer Filtering) technique, as with most of the chapters in this book, it would have benefitted more if there were more screen shots of the effect being implemented, might just be me, but I like books with pictures, I am not the sharpest tool in the box :S. The chapter only covers shadows generated by spot and point lights based on the techniques used in Chapter 1, the chapter then goes onto cascading shadows and visualizing shadow maps.

Chapter 4: Postprocessing

Another HLS topic close to my heart, but I am not sure I enjoyed this chapter, covering HDR it also went on to a process called Adaption for smoothing HDR transitions, which I think should really just be part of the HDR chapter again, no images showing the effect. The chapter then covers bloom, always a nice post processing effect. Depth of Field is next, but again let down not having an image of the effect. An effect called Bokeh is then give, now I have never heard of this technique (probably should have) so it was good to learn something new, and it even has a nice image of the effect too, and I like the look of it :)

Chapter 5: Screen Space Effects

Onto chapter 5 and screen space effects, I think I would have had all this in chapter 4, but then I guess they only have a five chapter book then. In this chapter SSAO, lens flare, crepuscular (God) rays and screen space reflections are covered. Again, with the SSAO technique, it could have done with an image or two to show you what you will be getting for your effort, there is a good description of how it works though, which helps. Screen space reflections is a nice article and again has a good description of how it works. The God rays are nice too and has (as well as the SSAO article) given me food for thought on how I go about rendering mine :)

Chapter 6: Environment Effects

Covered here are Dynamic Decals, Fog and Rain. Having little experience of DX10/11 this was new to me, and was nice to read something that I didn’t have a clue about. The fog is technique here is also a technique I quite like, rather than just lerping the distance to pixel a helper function is created to do the calculation. The rain is also a nice technique with collision detection also included.

Summary

Throughout the book I do like how the info is presented, having a description of what’s to be covered, followed by a “Get ready” section telling you the things you are going to need, then a “How to do it” section giving a breakdown of how to go about writing the shaders, then a “How it works” section breaking down the How to.

It would have been nice to have had a few more pictures displaying the effects, as a visual art, it’s always nice to see what the effect should be like. Also, the book is source code neutral, I kind of see why that was done, but would have been good to have seen how the source code from C++ and C# would be used to implement the effects, but I guess you can download the source once you have purchased the book, but again, this is all in C++. It would have been nice to have C# samples too. On the whole I think it’s an expensive book for what you get, but the content seems sound and would help to get you started writing your own render engine using HLSL under DirectX 11. Which reminds me, I really need to get a decent development machine so I can play with DX11 more :P

Wednesday, 30 January 2013

So, I have been quite for a long time, life has a habit of getting in the way like that though, I am sure if you are a regular follower of my blog(s), you know I have a tendency to pop in and out.

That said, I am doing a few things, still working on an XNA game (Killer Core) with Mark, have also been participating in an 8WeekGame competition, as well as try and port my existing XNA engine to MonoGame, and I hope this year to, again, be contributing to the fantastic Star Trek fan project ST:Excalibur.

So, where does that leave my C++ stuff, well on the back burner to be honest, but that said, it’s not dead, back in November last year, I mailed someone the source for the engine (warts and all), have not heard if they have found it of much use, but it was nice to know people still have an interest in it. This year my good friend Ed has asked if I would post about what I have done with it so far, and so that’s what I intend to do.

If you are interested in accessing my code directly then let me know I currently have it set up on Assembla.com, so if you are a member, let me know and I can add you and you can get the latest code as it changes.

What am I going to post about then?

Well, I thought I would tell you about the classes I have created in the engine, and explain a little about what they are trying to do. As you probably know, my background for graphics engines is in XNA, so I have tried to create an engine that reflects XNA so it’s easy for me to transition to C++ and DX11, and also means that a lot of the work I have done in my XNA engine I can bring with me to C++.

We have covered the creation of devices and a window in earlier posts, so I am going to skip over that here and just go to the classes. I’ll probably do a post for each class that way I can put a bit more detail into the posts (hope enough for you).

Monday, 24 December 2012

Just wanted to drop you all a note with some festive cheer, also so you know I have not totally dropped off the grid. I seem to go through times when I just stop posting, then Ill go mad again and put a load of stuff out, I guess it’s all down to the ebb and flow of my life. At the moment I have been evolved in the 3rd 8 Week Game Competition and I’m having a load of fun creating my game for it called Road Rumble. I have posted a few vids of progress, you can see my first few weeks here:

Week 1

This is my first weeks progress writing a game for the 8 Week Game competition. This is there 3rd competition, but my first time entering.

I thought with the time span,a 2D game would be nice and quick to do, so that's what I have gone with. I have used Farseer for the physics & collision detection, also in their samples I have taken there 2D camera too :S

Week 2

This is my second weeks development update, as you can see now have a bit of a HUD, fuel and damage, some explosions and a particle system.

Week 3 (rushed as it’s Xmas)

So, this is my third week update, it's a bit rushed as it's not really a full third weeks work, I put it up quick so I had something to show for the third week seeing as it was Xmas I really didn't think I would get anything done that holiday week.

So we have a better HUD and some more explosive stuff :D Oh, and a crappy story line I knocked up in about 5 minutes, was at the time of the Mayan Apocalypse so made sense to me at the time :P

Friday, 21 September 2012

So, I have been quiet for a bit, and this is why, Killer Core. Way back when I was first getting into XNA I started this game, based on an old classic ZX Spectrum game called Starquake and I loved that old game.

I have to say a big thanks to Mark Neale as he has taken on the mantle of Physic programmer on this project and without his input, I/we would be no where near this stage.

We are still a long, long way off making this a game, but I just wanted to post what we are up to and where we are with it. I just hope this time around the game gets finished :)

Wednesday, 8 August 2012

Exactly what the title of this post is eluding to, a Rectangle structure that can be used to detect collision like the one we have in XNA. I have kept it Axis Aligned just like the intrinsic XNA one. If you don’t know what I mean by Axis Aligned, then have a Google or a Bing for it, it basically means that the collision detection is done based on the rectangle not being rotated.

In the clip we see RED rectangles, these show up when two rectangles intersect, a BLUE rectangle is the Union rectangle that holds both of the colliding rectangles, the GREEN rectangle is shown when a rectangle is Contained by another and the WHITE rectangle is the Intersect rectangle.

I have been working on trying to get a C++ framework together so I can start writing about some GPU elements, ad realize that I am skimping on the code snippets, so, here is how I have constructed the RCRectangle structure.

So, we have an X and Y to give us our top left corner and a Width and a Height to give us the opposing corner.

I have also put in the same methods we have in XNA, so Intersect to get the rectangle where the two rectangles overlap, Intersects to detect rectangle intersection, Contains for when a rectangle contains another and Union used to create a rectangle that will contain the two rectangles.

The RCRectangle.cpp file has the function bodies and they look like this:

Friday, 3 August 2012

So, done a bit more on my library, not only do I have a working SpriteBatch class, I have also given the option to be rendered instanced :), so once I got that all working, I decided the next thing for me to look at are Render Targets.

As you can see from the clip, I have it working, but there is an issue in there that I want to get sorted before I move on, I am not totally sure why it’s doing what it’s doing, but I hope to get to the bottom of it..

Good news for me, is once I have this sorted I can look at post processing and deferred lighting, which if you have followed any of my posts in the past, I love playing with both those elements.