30.Jan.07 Lecture 1.
Course overview. Creating games in C using Win32.

Welcome.

Who is Wood. How to reach me.

Who are you, what is your favorite game. Tell me something you have programmed and something you want to program.

Syllabus

What do you want to get out of this class?

What sort of games do you want to write?

What sort of games would be best for this class?

I don't think you should give up your dream of writing an open ended massively multi player world war three simulation with fifteen hundred different weapons and fifty thousand different missions, but for this class I would like you to be realistic. For this class, and your own portfolio, it would be much better to have five complete simple and fun games than it would be to have one giant very incomplete game. Save that one for later. For this class, think puzzle or video games that you (or a prospective employer) could play in 5 minutes.

Even the biggest games are still just expansions of much smaller games. If you don't master small, quick fun games then your big games will be much more difficult.

If you still want to do an expansive game for this class I ask that you first write a much smaller game and get it nearly complete. That way you will have something to fall back on if your larger project runs into scheduling problems.

What can Wood teach you?

I can't teach you how to program. I can only lead you on a path to learning how to learn. All the lectures, talk and assignments I can create will not teach you to program games. The real learning will come when you spend hundreds of hours to create something that only takes a few minutes to play. I cannot force you to spend the time to learn, YOU are in control of your own destiny. I can only try and guide you towards the learning process and answer questions when you get stuck. If you choose to spend your time doing something other than the homework or reading, then you will not be a game programmer no matter how hard I work at making you one. Stay focused, get the homework done.

What is the best programming language for games?

C/C++, Java, Python, Unreal Script, Torque Script? The Answer: none of them.

As yourself a question. Do you know as a definite fact what language your favorite game is written in?

Would you be able to look at a new game on the market and know what language it is written in?

Do you think Unreal is written in C or C++?

Do you think someone playing a game really cares what language it is in if it is fun?

So, what is the best programming language for games?

The answer: The choice of language does not make a game fun or popular. There are games written in every language that are fun and popular. It is more important to choose a language based on the goals of the game and your own skills than just because someone tells you one is better than the other.

Should you learn one language or another?

You should learn as many languages as possible, but it has been my observation that they are all pretty much the same in terms of learning them. Once you know one really well, you basically know them all. The difference is in that some are better for different tasks and knowing which language to choose at the beginning of the project can make all the difference between success and failure. The biggest barrier to learning a new language is learning the quirks of the tools and error messages. It's more about getting used to a language than actually learning it.

Class prerequisites

The prerequisites for this class are C/C++ or Java expertise. If you have not written a significant application in at least one language you will have difficulty in this class. I'm not telling you to drop the class, I have had student's with zero programming experience in my class go on to get an A in the class and become very successful programmers (it had nothing to do with me, they had talent and spent the time), but it will take a lot of extra time and effort to gain the experience required.

Final project contest

Your final project will have the potential to win a $100 EB Gift card. The May 8th class will be dedicated to showing off your 'final project' games and deciding on a winner. I am working on bringing in outside judges from a couple of local game companies. This will not only be an opportunity to win the gift card, but an opportunity to show your game to people that are in the industry and always on the lookout for talent. Write a great game, make some great contacts in the industry.

Torque as a platform

For this class we will be using the Torque Game Engine which is a full feature 3D and networked engine that has a number of top titles hosted on it.

Programming Toque (as is also the case for Unreal) is not done in C or C++. You can create a complete game without ever writing a line of C or C++. These engines all have their own programming languages which layer on top of the engine itself. In the case of Torque, Torque Script does have a lot of similarity to C++ so experience with C++ will have a benefit.

Torque also includes a 2D engine which we will us in the early part of the semester to become familiar with Torque Script. It will be much easier to learn Torque Script in a 2D environment and take that knowledge into the 3D engine. The Torque Game Builder is the 2D engine we will start with. The Torque Game Engine is the 3D engine we will do most of our real games in.

To C++ or not to C++? This class will cover C/C++ in gaming, but it will not be the main focus. One of the main reasons we chose the Torque engine is because it includes source code. I am hoping to put together an assignment to change the engine in some way using C/C++, but do not yet have it ready. This is a high priority, but should not stop anyone from writing a great game.

Discount Torque Licenses

Torque is offering $25 discounts on Torque licenses. We will use the Game Builder for a few weeks, but the majority of the class will use the Torque Game Engine. You an buy both, but if you buy one, buy the Torque Game Engine. The cost is only $125 for a very robust game engine. All the machines in the lab have both Torque products installed so a purchash is not required. It is only required if you want to install on a laptop or home machine.

Details on the Torque discount are outlined on the Blackboard site.

We will not be using Torque for the first week. You should be prepared for a Torque lecture, a few tutorials and assignment the second week of class.

The use of Tutorials and online documentation

Tutorials are one of the best ways to quickly come up to speed on a product or API. I use them frequently when learning some new API, tool or language. Torque has a number of great tutorials and our books come with them as well. We will do a number of these tutorials in class and have assignments that require some changes or extensions to the results of a tutorial.

Procrastination Study

Why do we procrastinate?

How does Wood procrastinate?

E-mail Games, Writing quick little games, Teaching classes, Food (yes eating is much more rewarding than long term goals)

All of these things take me away from my long term goals of writing significant and large scale software projects.

How do you procrastinate?

Procrastinus - A study of the causes of procrastination.

Discount Expectancy Theory - The Procrastinus study's best theory.

That equation says that we are more inclined to procrastinate on things the farther out the reward is.

This has two benefits for us. First, we may use this to live life better and not procrastinate on important thing. For me that is side projects like games, for you that might be school work. When given an assignment on a Tuesday, it is much easier (and rewarding) to socialize or play games than it is to work on the assignment that is due in 7 days. As the reward day (getting points for turning it in) approaches, the more likely you are to work on it. But the fact is you would have a much bigger reward if you worked on it consistently over the course of the week since the reward would be more than just the points, you would be a much better game developer.

Second, can you see how this theory relates to the most popular (addictive) games? How about World Of Warcraft. Why would someone rather play Wow instead of doing actual work? In Wow, you are given small tasks, deliver something or scout some area. That is a medium term goal in the game, but a very short goal in the scheme of life, meaning the reward is still very close. On your way to the mine you run across a bandit that attacks you. After about 30 seconds you defeat the bandit and are given a reward. This process repeats over and over and over, only the numbers and the graphics change. The encounters don't get any more difficult, it just makes you think they do as all battles (you can win) take about 30 seconds. This scheme actually shows how powerful Discount Expectancy Theory is. Many people are caught in this very quick goal/reward cycle which their mind craves, while missing the point that the most rewarding goals are much more important and rewarding and farther out in time.

Can you think of other popular games that use similar tactics (quick rewards leading to longer term goals)? Can you think of any that don't?

What can you do to fight procrastination in this class? If lecture ends 30 minutes early, use that time to work on your homework or project. Don't run out the door. This is a great opportunity to use the information you have received and ask questions if you are stuck.

What is one way you can use procrastination to your advantage in this class? Put short term goals and rewards in your games.

Code Slog

Programming is not hard, it's tedious. You will find yourself stuck on the simplest problems for days at a time. This is normal. You have to find a way to keep interested in a project even when it seems to fight you every step of the way.

Ask other students for help.

All students in this class are expected to help other students on their projects. If you were a student in the previous Game Development class (Jess, Michael, Noah, Jean-Eric and Thane), you are required to help another student that has a question. If you are not on that list, please use them as a resource when you get stuck. This will be one of the best ways to make sure the class keeps an adequate pace and we all learn how to create great games.

Someone else will see the problem immediately.

The sooner you learn to ask someone else to look at a problem, the sooner you will learn that continuing to stare at a line of code with a compile problem will not increase your chances of finding the error. Someone else who looks at it will probably discover the problem in about 10 seconds. If not, you only wasted a minute or two of their time.

Development focus

One of the most important aspects we will be focusing on is what I call a full circle application. You need to make sure the game (or application) can go full circle. This means it starts with a splash screen and stops at a main menu. Then there is some game event that ends that game and brings it back to the main menu. Within the game there needs to be a scoring mechanism that measures the progress. Once you have all those elements, the game is a game. If it just jumps into the middle of a mechanic and has no beginning or end, then it is just a mechanic, not a game. We are writing games. This should make it clear where your focus should be, fun games.

Repeating processes

One of the best ways to retain information is to use repetition. I would like to see us create the full game loop a couple of different times over the semester. The more times you create a full circle game, the easier it will become. If that is easier, it will leave a lot more time to create better mechanics and better games.

 

C/C++ Windows Game

For our first assignment we will be using pure C to create a game. I have created two different examples using pure Win32 code to create a couple of games.

f12 sample

A simple Win32 animated square display. Download.

f13 sample

f12 with characters instead of blocks. Download.

f15 sample

The twiddle game written in C using Win32 API. Shows full circle games. Download. This will be the best starting point for your homework assignment.

f16 sample

A block dropping game sample using simple squares. Download.

Notes on code formatting

Always line up your brackets and code

Tabs are very very evil. Always reset your editor to insert spaces instead of tabs.

 

 

CPSC240 - Games Development
Chapman University
Instructor: W. Wood Harter
(c) copyright 2006-2007 - W. Wood Harter - All Rights Reserved
Screen shots on banner (c) copyright their resprective owners