Tuesday, November 2, 2010

Written Gems - Course Litterature post mortem

It has been a while since last time I wrote here. Real Life(tm) aka getting married and other stuff has meant I have been really busy and the time to write 10 page articles are kinda restricted. While I have a couple of articles being partially written I can't vouch for when they will be ready.

Instead I will try to produce a series of shorter less in-depth articles that focus more on individual tricks and tips and less on complexer systems and we'll see how this pans out. So first out today are some book recomendations.

While working at a game development school you quickly discovers the importance of good course literature. While of course you can teach the students everything they need to know yourself it takes a lot of time and effort and since these educations aren't 5 years educations you won't have time to give them all they need.

But if you got good literature as a base it saves a lot of time. Not only has someone sat down and worked really hard to put in a written format what you need to tell the students but they can also study the book interdependently of the lessons when they are looking for now information.

A good book also gives a great base to build a course around. The problem is that there are so much literature out there that are either crap, focused on a purely academic stand point or otherwise simply not targeted to game students. And a lot of the game books are just shameless cash in attempts or written by authors who lack the necessary skills as either a programmer or a writer or just simply out of date.

And some books  while great are more useful after a few years in the industry or simply not build in a way that you can base a course around them. But through the years we have started to build up quite a nice library of books here to use and I will try to go through them during the coming articles. This might not be the best idea from a competitive advantage point as a school as the books are really important. But my main goal is for as many people as possible to become competent programmers and good books really helps here.

So lets start with the basic courses and move our way upwards. (btw I don't use cash links or anything like that so I won't earn a penny if anyone purchases these books, even though blogger has support for this I feel it would only detract from my main goal which is to put these books into the hands of as many people as possible)

C++ Primer (4th Edition) [Paperback]
Stanley B. Lippman
Paperback: 912 pages
Publisher: Addison-Wesley Professional; 4 edition (February 24, 2005)
Language: English
ISBN-10: 0201721481
ISBN-13: 978-0201721485
Amazon link

This is our basic C++ book we use for our introductionary courses, but also refers people back to pretty much every time they have a question about C++ releated things. Picking a course litterature for C++ for this education was really hard since it was years since I read any such base books. But a good friend recommended this one and I am really grateful for it. Despite having spent my last 12 years programming C++ as my job I still found new information in this book that I didn't knew about earlier.

This is however not a "learn to program" style book. It's based on learning C++. This this well into our unique approach here where we run two parallel courses one about how to program and one about how to program in C++.

The book starts out slowly  walking though all the different parts of C++ syntax while quickly focusing on giving the reader enough knowledge to actually be able to program in C++. After that  it starts going in-depth though the language, with amazingly well detailed descriptions of how things work under the hood and why some things works while others don't. Pretty much every area of the C++ language is covered with detailed explanations while never loosing readability. Things like implicit casting and how it conflicts with operator overloading, How virtual functions works behind the hood etc are described in great details telling you what rules the compiler follows so that you easily can write good code that works. If you are pretty new to C++ this is a gold mine. If you are an experienced programmer there are some nice stuff in here but probably not enough to make it worth your while. However I will cover a few books that didn't make it to course litterature but are awesome anyway in later posts.

Conclusion:  This is an awesome learn C++ book with enough in depth information that unless you have been working with C++ actively for a couple of years you will still learn a lot of new stuff here it is also a good reference for more tricky parts of the language.

3D Math Primer for Graphics and Game Development
Fletcher Dunn, Ian Parberry
Paperback: 429 pages
Publisher: Jones & Bartlett Publishers; 1 edition (June 21, 2002)
Language: English
ISBN-10: 1556229119
ISBN-13: 978-1556229114
Amazon Link

The linear algebra for 3D math was a tough course to crack here. The first year we had in an algebra teacher with classic algebra knowledge and sat down with him and discussed what we wanted the students to know. This didn't work out however. Not due to a fault of the teacher the students were excellent at solving linear algebra with pen and paper but had problems transferring this to usable facts in 3D math and we had to spend a lot of time to work on this. For the second year we ditched the classical math texts and run the course completely based on lectures and compendiums. This worked out decently but I felt that with a good book as base we could have gotten further as there is only so much time you have to prepare a lecture. But all the books we looked at was either to academic or required to much prior knowledge until a student that was having some trouble with the course purchased and recommended this book.

When I got it in my hand I was amazed. Here was a book that tried to teach Linear Algebra in almost the exact same way as I wanted to. By focusing on approaching in not only from a purely mathematical stand point but also showing what it all means from a geometric standpoint. It also explains coordinate systems or spaces as they are often called as concept quite well and this is an area where in my experience students often have problems really grasping the basic ideas.

It covers normal vector,matrix math of course and all kinds of operations on vector you would need to know about for 3D math again with geometric explanations of things like the dot product and cross product.I can't vouch for it's sample code since I never used it. But then again sample code is not really relevant you want to learn things not just copy them. It gives a sensible explanation of matrixes using the Affine Transform vs Linear transform to explain things I myself always had been using other terms for but basically derived the same idea independantly.

It contains a good discussion of the different ways to contain an orientation in 3d with advantages and disadvantages and covers quaternions in the process. After that it covers collision detection with a diverse set of geometric primitives working with basic 3d meshes and discussing and showing how the math applies to basic 3d operations like lightning fog and culling. If finishes of with discussing spatial representations for culling and occlusion.

Conclusion : This really is a complete 3d primer from the first step to actually applying it in game. This is an absolute gold mine of information for anyone getting into 3D math and I simply can't recommend this book enough I simply love it.

It seems these posts are gonna be a bit longer than I thought when I started this one so I will have to split it up over a couple of posts to make it manageable. So I will continue in the next posts.

Monday, June 28, 2010

The Wonders of Fixed Point Math - Or how I got XNA to cull thousnands of objects fast

So what is fixed point math ? Well you could say that it's an old technique to approximate decimal numbers on computers without floating point processors.

So why should we care about it then ?

A good questions there are multiple instances where using a fixed point representation can help you considerably. One is if you are running into the problems of the inconsistencies that are at the core of how we handle floating point math on modern computers. Or if you are simply running on a platform where the floating point performance is way to low and you don't need 6-7 decimals of accuracy.

For me while working professionally it has been along time since I had to use fixed point. But then again there has been plenty of cases it has been under serious discussion to resolve issues with floating point inconsistencies and I know of numerous companies that have used them to battle the problems.

Tuesday, May 18, 2010

Auto balancing Decision trees aka Resource Trees II

Just continuing from last time.

So after we called Act on the economy node it checks that it isn't a leaf node and therefore it checks it resources.

Monday, May 10, 2010

Auto balancing Decision trees aka Resource Trees I

Today were gonna talk about a process for decision making that you can use for higher level Ai functions in games. Basically this method can handle purchases, tech level up. In some case even goal selection for a computer opponent. I will discuss this in the context of trying to make an Ai for an RTS game but the same principles will hold for a turn based strategy game and depending on context in a lot of other games too.
So the basic idea here is the following. Computers are really good at managing tree structures we have tons of efficient algorithms that works well with them and we can search in them easily. This however is not just limited to existing algorithms, basically any kinda of data is normally easy to analyze if you can represent it as a tree.

This comes from the fact that when you represent data as a tree you have already performed a divide and conquer on that data to divide it into smaller parts. Those making the code to crunch the data for each node of the tree a lot simpler than if you had to crunch all that data in one piece.

Monday, May 3, 2010

Still alive here


Shadow Maps
This is pretty much the standards for doing shadows in games nowdays, and the dafacto standard for doing them for movies, Shadow buffers in difference form shadow volumes is image based and can therefore handle alpha masked polygons like a fence, It also allows techniques for blurring or otherwise distorting the shadows.

Percentage Closer Filtering 
A problem with shadow maps is that they easily get pixelized even with the best intentions. Percentage closer filtering is a technique to combat those jaggies and making your shadow edges soft, We will look at different implementations for example randomised kernel rotation with a poisson disc.

Percentage Closer Soft Shadows
In the real world shadows become softer and softer the further they come from the object casting the shadow. This is how to do the same in games using a technique that builds on the Percentage Closer Filtering technique.

Monday, April 12, 2010

Slight hiatus

Due to me getting married and going on my honey moon game school gems will have a short 3 week hiatus until I return.

Wish me luck :)

Monday, April 5, 2010

Code Standards - Why we need them

It might be a bit far fetched to call this a gem, at the same time for those who have never worked in a team before or are trying to organize one this might be life saving. I also feel that I need to add some more articles that cater more to the beginning programmer, while these sorts of articles won't become the standard for the site they will appear from time to time.

So what is important about code standards you may ask ? There are two main cases, one is when working with other people and the other is when you are working with code you haven't touched in a along time. The problem with a lot of code you find on the net and tutorials are that they are inconsistent in how the code looks or hard to read, obviously that lats part is subjective when you are used to it any way of coding might be easy to read. But when you are working with code you haven't touched in a long time you are unlikely to remember all the details of that code so any code standard that makes the code easier to read and understand helps.