Showing posts with label Game Development. Show all posts
Showing posts with label Game Development. Show all posts

Thursday, January 10

First Day of Rules of the Game

6:00am - Woke up, as the information from yesterday flooded into my head. I set some water to boil for coffee while I head into the shower. I take my time and let the water drip down on me, brainstorming today's todo. (Create a point distribution spreadsheet, game synopsis, produce a 3D demo of a moveable object, RoG (Rules of the Game)).

6:30 am - I decide to forgo coffee, and instead move onto some cereal. I drop my recording of yesterday's lecture and begin to listen to them while eating.

7:00 am - After running through the syllabus, and reviewing everything from yesterday I begin to recreate the point distribution spread sheet for the team.

8:00 am - I head out to campus for our schedule group meeting.

9:00 am - Seeing a lot of familiar faces in SGP-2 I spend most of the time socializing until Casey shows up, followed by Charlie. We discuss the spread sheet, deciding that we will attempt many at many new boundaries. We intend to implement Shaders (vertex shaders, pixel shaders), particle effects, and even fluid dynamics most likely using D3D terrains. We also work out the game synopsis, thanks to Charlie's great creative writing skill which I will no doubt fall back on in the future.

12:00 pm - We split up and head for lunch, before I do I meet up with Dan who is part of the only group attempting 3D in the month ahead. I try to size up the scope and depth of his project, and it's quite impressive, at the same time I become very excited. After all it is much easier to follow someone's else's footsteps, and hopefully make some new ones along the way.

1:00 pm - ROG begins.
1:15 pm - Apparently this class is being taught by a new instructor, and not Dave the creator of Dungeons and Dragons. I do not mind. Steve VanZandt comes off as well informed, and a well organized instructor. In fact I would go as far as to say that he is a good example of a college level teacher (by normal standards). On that note, when role was called I was rather unoptimistic in saying 'here'. He replied back saying, 'awe you must be the invisible type'. While maybe those weren't his exact words, and they were said in such a way that I may be the only one that heard them. I noticed he did not pay very much attention to me for the duration of the class, except for several glances to make sure I'm paying attention (I'm a little worried about my GPS).
3:00pm - On that note we began lab early, being told that we will continue lecture after lunch break. So based on my first impression to the teacher, or at least my assumption to that impression, I decided to make a point to stand out. I raised my hand several times, and when we broke out in order to play board games ( a supposedly education process ), I choose to persue the simpler board game (Blokus). While it was my first time playing this game, I decided I could do much better in this game compared to the other games which had either intricate rules, or a rather large luck factor. In short, I wanted to win.

5:00pm - By the time lunch time came around we had played five games. My first game, I feel I got rather lucky and made correct decisions. Everyone at the table had been a first timer. I managed to win with 25 points ( a perfect score ). After winning the first game, and also sharing several of strategies, I did not fair nearly as well in the second game and had got -18 still coming in a far second. For the third game I managed to pull a not perfect victory with -7, this time beating our past DirectX teacher Chuck. Chuck is a great guy, and was pretty good at the game, so I really enjoyed it. With each consecutive game, it became harder and harder to win, and the competition became more and more fierce. By this point everyone was keeping track of the number of pieces left over, blocking others, and quickly making aggressive cuts into territory. Being experienced in both spatial tactics of chess, and go I was well aware in the idea of over expanding and being too passive. The fifth game was incredibly dominating. I managed to squeeze off a third of the board to myself, completely blocking any and all crosses using the double eye strategy common in GO. I ended up being able to take all my turns without waiting as no one really could cross into my territory. I won with a -4.

6:00pm - Lunch was brief, ate Chinese, and was pretty relaxing. Spending time not working on the SGP game became incredibly daunting. In fact by this point that's all I could think about. After lunch I spent the time drawing enemies, and thinking of game mechanics. This made the following lecture even more so daunting. I simply was not interested in the fluff. Game Design? Please, that's not what I'm paying the money for, and as shallow as that may sound I can not feel like this is yet another repeat of something I've already experienced, partially or totally. ECG, Behavioral Science, HAM, and the two day GameDesign track at last year's GDC have been plenty. I can make a card board game, all I care about now is how to make it render.

9:27pm - I'm home, I've finished my green tea, and wrapping up this blog post. Going to shower and begin working DXUTMesh which is by no means straight forward. I also intended to write about 3D Fundamentals, but I think I will leave that for a later post.

Wednesday, January 2

DXUT Game Architecture Part One

Understanding *.VSPROJ

I’m of course referring to a standard Visual Studio Project. In order to understand DXUT and for that any API integration, it is quite vital to understand project dependencies and settings. So this first tutorial will focus on just that with emphasis on DXUT project settings.

On quick thing to make a note of is that a visual studio project are the multiple project builds. Most books on this topic already assume you understand this, but for those with less experience in this area due to one reason or another I’ll quickly explain this concept.

A project build are unique project settings often to do with the compiler, and the linker. The most common three types of builds are the Debug, Release, and the Profile build.

The Debug build is usually the configuration you use while trying to test, solve problems, or quite simply debug. This includes enabling things like symbolic debug information, and disabling any form of code optimization such as inline functions for example.

The release build is by far the easiest one to understand because it is what you’ll be providing the end user with. With that being said you want to omit any unnecessary debug information, and include any form of code optimization.

The debug and release builds are what is defaulted during development using Visual Studio. You will then be expected to make any additional builds on your own (doing so is easy, just do some research). The question would than arise, as to what the purpose of these extra builds might be, and this is what I believe a Profile build that is often regarded as in programming books. The profile build or whatever you choose to call it, may be a build specifically designed to run a specific piece of hardware; such as a cell phone, a PlayStation, a different operating system, or it may quite simply act as a midpoint between a Debug and a Release build for testers etc. As long as you understand this, than choosing the appropriate settings for a Profile build or choosing to omit it entirely becomes a simple mater.

Now that’s out of the way, in Visual Studio switching configurations is as simple as choosing one from the drop down list above. Make sure to note the “All Configurations” option which will allow you to make consistent changes to all current builds.

Next you must decide on how you wish for your project to be organized. There is nothing wrong with using the default directory structure that Visual Studio sets up for you, but after reading Mike McShaffry’s Game Coding Complete, I feel in love with his design which you can find on page 93 of his publication. This is roughly what it looks like:

  • Project Code Name
    • Docs
      • Documentation, game concepts, etc.
      • Media
        • Folder belongs to the artists, raw .psd, and high res textures
      • Source
        • The source code, .sln and .vproj belong here
      • Obj
        • The junk, SCC, OBJ, SBR, ILK, and PCH files.
        • Deleting the contents of this folder will cause a complete rebuild
      • Bin
        • Game files only.
        • Executables
        • Zipping up this folder should contain everything necessary to play your game.
      • Test
        • Debug and Profile targets of the game, and any utilities useful for the test team.

[Configuration Properties]

[General]

  • Output Directory, your output directory is where you can expect to find your .exe
  • Intermediate Directory, compiler specific files, this should probably be configured to point inside your Obj folder if you choose to follow the advised dir structure.
  • Extensions to Delete on Clean, during the rebuild step the following are the file extensions you would like to be deleted. If you’re confident in what you’re doing this is a great opportunity to delete unwanted logs etc…
  • Build Log File, I have never utilized the following log file, but it should be clear as to what to expect here.
  • Inherited Project Property Sheets, this is important if you are setting up your project from an empty project with absolutely no defaulted settings. Feel free to read more on this topic if you wish, but for a DXUT project set it to
    • $(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops
  • Configuration Type, the following drop down list determines exactly what your project is built to do. If your building an application (*.exe), a static library(*.lib), a dynamic library (*.dll).
  • Use of MFC, set the following to Use Standard Windows Libraries
  • Use of ATL, set the following to Not Using ATL
  • Minimize CRT Use in ATL, think about this for a sec. Are we using ATL? Then set this to No.
  • Character Set, DXUT is infamous to using Unicode and not Multibyte which is more common to hand written DirectX. Remember a character set is not something that can’t be changed if you wish by using prefixes such as L, or T.
  • Common Language Runtime support, No Common Language Runtime support.
  • Whole Program Optimization, No Whole Program Optimization. Remember what we discussed earlier with various build types.

I’ve went into a lot of detail when it comes to General Configuration, from here on out I will not spend the time to explain settings that are build specific, or that have nothing to do with enabling DXUT. Remember that it is important to learn how to do your research here, and I believe I’ve provided you with the stepping stones to do so.

After creating your project and going through the steps of configuring your $(IntDir), $(OutDir), and various build options you should install the latest DirectX Distribution. Each distribution should come with the latest DXUT files usually located in (C:\Program Files\Microsoft DirectX SDK (November 2007)\Samples\C++\DXUT). A good way to find it is to perform a search for dxut.h on your entire computer. Eventually you will two folders, [Core] and [Optional]. What is this you might be wondering? The core folder is where you’ll find dxut.h and other essential header files involved with successfully compiling DXUT code. In other words you’ll defiantly need these files. On the other hand Optional contains the majority of the DirectX wrappers for game development. Please be aware that DXUT does not document the optional wrappers and is not truly part of the API but are provided as sample code for producing your own wrappers to do the same. With that being said, I don’t copy both folders directly, but instead make a new folder in my project source directory called DXUT and paste the appropriate header and cpp files.

Now you’re going to want to right click on your project and add existing files that you just copied into your project. Second, you want to go back into Project Properties and navigate to Configuration Properties -> C/C++ -> Additional Include Directories. Than point once again to the DXUT folder w/ respect to your *.vsproj file. Assuming it is inside your Source folder, simply typing in DXUT; is sufficient.

* If you don’t see the C/C++ tab inside your Configuration File it is most likely due to the fact that Visual Studio has not yet identified your project as a C++ project. To do this simply create a .cpp file such as WinMain.cpp. And open up properties again.

This concludes Part 1 of the tutorial. If you would like to continue without waiting for my next update, feel free to purchase Game Coding Complete or you could simply navigate to Mike McShaffry’s forums at http://www.mcshaffry.com/GameCode/board.php. Something to note about the way Mike sets up his DXUT is by building a separate project with its own precompiled header, and outputting a *.lib. He then sets up his next project that being the Game Architecture project and set’s it to be dependent on the DXUT build. He also does his #include for DXUT files inside his Game Architecture project and not the DXUT project. Hopefully you’ll figure it out. Or feel free to wait for my next update where I’ll try to take this tutorial all the way to rendering a blue screen via the DXUT function calls.


Monday, November 12

The Devil and David Webster

The Devil and David Webster

by Chris R. Lunt.

Heaven's donuts are jelly donuts. The blend of texture, from the cool, sweet ooze of the jelly, mined with tiny rasberry seeds, to the firm, spongy cake, so lightly encrusted in a thin glaze of sugar, that cracks and flakes as you gingerly tear off small pieces of delight, is certainly the greatest experience a humble man can afford.
I was eating a jelly donut when he first appeared in my office, smelling slightly of gunpowder. He was tall and gaunt, with deep-set eyes and crooked teeth, long, delicate fingers, and sloped shoulders. He wore a black Ozzy Osborne concert t-shirt, frayed black jeans, and dusty black high-tops, unlaced. He smiled at me in an ugly way. I put down my donut and glanced at my watch. 7:00 PM.
"You're David Webster."
I nodded.
"You're a programmer for Core."
I nodded again. Not only was I a programmer for Core--I was the best damn programmer this group had ever or would ever see. I suppose I should introduce myself. I am David Elijah Webster, master programmer. I'm not just blowing smoke here either. I'm the best damn programmer to come out of MIT since code was constructed one bit at a time. I can do it all: C, LISP, assembly--even the languages no self-respecting programmer would deign to look at. I can do it all in no time flat, with the most elegant of style. Code sprinkled with glistening semicolons and flowing rivers of indentation. Lesser programmers avert their eyes when I enter the room.
"They say you're the best, and I'm here to challenge you."
I sized this guy up again. He had the right shape. The pot-belly, the greasy hair, parted with percision. The fingers. And the funny smell.
I told him I didn't have time.
"I'll make it worth your while," he said. "I have something you might be interested in. Follow me."
I grabbed my box of donuts, and followed him down the hall and into the elevator. He pressed a button and the elevator descended into the basement. I'd never been in the basement before. For that matter, I didn't even recall that the building had a basement. Nonetheless, the elevator chimed, the doors opened, and we stepped out into a wide room that was entirely featureless. That is, except for the fog on the floor and two workstations that were set up, side by side. One of the workstations was mine. The other was a workstation like none other that I had seen before. It was magnificent.
It was matte black. More than an object, it looked like a hole in space. The monitor it sported was the biggest I had ever seen, and the keyboard was a flow of liquid lines, containing a field of keys of different sizes and shapes, packed in like cobblestones. The mouse floated above the table, and had no wire. Next to the computer was a box with a small chute coming out of one side, and a large red button on the top. The monitor was flanked by two gigantic speakers, and I could see a sub-woofer poking up out of the fog. It hummed. It steamed. It was the most beautiful computer I had ever seen.
"You approve," said the stranger.
I swallowed and said, "It is beyond description."
"It's a custom job. And it's yours. If," he said, "If you can beat me in a coding contest."
I looked at him incredulously. "What's in it for you?"
"I will have defeated the greatest coder in the world, and thus, I can claim that title. AND, I get to keep your immortal soul."
He smiled the ugly smile again.
Here was a dilemma. I was dealing with the Devil. There was no doubt about that. And he was no doubt very good. I am somewhat attached to my soul, but oh, the prizes. The glory. I can easily claim to be the best coder in the company, in the Bay Area, probably on the whole planet, but if I pulled this off, I will have shown myself to be the best coder in this entire theology! Vanity got the better part of me.
"What's the contest?" I asked.
I won't bore you with the details, but it was seriously ugly. Ugly in a way that makes the most arrogant of coders cringe and causes managers to pad development schedules into the next century. It had to run in any language, including the nasty chicken-scratch ones. It had to be backward compatible all the way to the ENIAC. And it had to run on Windows. I cringed.
But vanity won. I signed the forms, agreed on a deadline of midnight, and we sat down at our machines and started to code.
My watch said 8:00 PM, and I started warming up. Class definitions flew off my fingertips like throwing stars. Structures and declarations grew like perfect crystals, and I didn't even break a sweat. True to the task, I soon lost myself in an endless cycle of postulate, create, instantiate and verify. Bits grew to bytes, to K, to Megs, and finally to Gigs. By 11:00 PM it had come to that crucial point. With an hour to go, I had to put all the peices together. It wasn't going to be easy. It was going to take all the concentration I had.
Then I hit the first bug.
At first, I wasn't sure where it was coming from, but then I spotted it. It wasn't mine. It was bug in Windows. Even worse, it was a bug in Windows that stemmed from a timing problem with the system clock itself. I couldn't see a workaround. I was stymied. I genuflected and called Microsoft support.
"Hello, and welcome to the Microsoft help line. Please enter your 64 digit user identification number, followed by your 32 digit password."
While I frantically typed number after number, trying to navigate through layer upon layer of phone menu, I heard him pick up his phone and call a number.
"Hello, is Bill in? ... I don't care, wake him up ... Tell him it's Mr. Black ... Hey Bill, what's shakin'? Listen, I needed to know a workaround to one of your bugs ... Yes, I know what time it is ... Yes, I know ... Bill ... Bill! You remember our little deal? ... That's right. Now be a dear and give me that workaround ... Mm-hm ... Right ... Thank you, Bill. I'll be seeing you."
I was shocked. It was obviously pointless continuing my desperate journey through Microsoft's Help line. I needed immediate genius! I scarfed down a grape jelly. Sugar shock engulfed me, and my vision tunneled. I shuddered once, something clicked, and I determined the answer I needed--I could use the clock on the sound chip to get my timings.
I dove back into the code, and was quickly integrating modules when I hit bug number two. It was even uglier than the first. In fact, it was the ugliest bug I had ever seen. It was a problem with C. With the language itself. There's no way fix a broken hammer using the same hammer.
I wracked my brains. I clenched and grunted and sweated and thought and Thought and THOUGHT, but to no avail. Over my shoulder, I could hear Him chime in, "Bugger, isn't it? I remember putting that one in back when I was working on the Unix kernal. Did you really think there was a Kernighan and Ritchie? Rearrange the letters in their names and you'll discover an interesting anagram."
I ignored him and continued thinking. My mind went deeper and deeper into the problem at hand--my senses dulled, my breathing grew shallow. My eyes rolled back and sweat beaded on my forehead. Clumsily, blindly, my hand pawed it's way to the box on my desk, containing my last jelly donut. It raised slowly to my lips, and I bit.
Pounding waves of sugar induced euphoria washed through my mind. I felt my brain hum and crackle. My hands trembled, my body shuddered, and I began to type. I was a man possessed. Complex topographical math equations formed on my screen. Klien bottles and hypercubes locked neatly into place like pieces of a puzzle. Beyond my control, a complex mathematical world formed in my computer, with additional dimensions unimaginable.
I felt a small pop, and I came to. I looked at my screen. I had worked around the bug.
My watch read 11:45. Frantically I continued putting all the modules into place. Glancing for a moment at my rival, I could see I had him worried. He was typing furiously. Smoke poured from his ears, and flames licked around his collar.
Then I hit the third bug.
It was not so much a bug, it was a limit. I only had 4 Gigabytes of memory, and I had used it all. There wasn't a bit left. I had compressed data to a point so fine that it was in danger of collapsing into a black hole. I was storing memory in every conceivable way, including keeping a chain of sound waves running between the speaker and the microphone. There was no memory left to be had.
Frantic, I reached into my box of donuts, and my heart sank into my stomach when I realized that I had eaten the last one. I glanced at my watch, but it was too late. I was sunk. I had done the best that I could, and I had nothing more to give.
The Devil laughed, and grinning cruelly, he reached over to the box with the chute and the button. Remember the box? Slowly, firmly, his hand pressed the red button, and a jelly donut slid down the chute and onto the table.
My jaw dropped. "What...is...that?" I asked.
He languorously chewed as he replied, "The Box of Eternal Donuts."
"The Box of Eternal Donuts!?"
"Yes," he said.
"It never runs out?"
"Never," he said.
"It's mine if I win?!?!"
"If you can win, it is entirely yours," he replied, grinning cockily. My mind reeled. The Box of Eternal Donuts. The Box of Eternal Donuts! My eyes darted everywhere, my jaw hung slack, and my throat emitted strange animal-like noises. Anything. I would do anything to win! I just needed the smallest amount of memory. But where could I get it from? I glanced at my watch again, and a plan came into my mind. A beautiful, devious plan.
I went quickly upstairs and retrieved the emergency toolkit that we keep in the medicine cabinet. I ripped the case off my computer, and quickly scanned for the right connections. I pulled two wires, and unscrewed the back of my watch. The Devil's eyes widened and he desparately started coding again, but it was too late. I got the last of the memory I needed out of my watch, and pressed the ENTER key seconds before he did.
The watch burst into flames. Sparks flew from the disk drives and the monitor glowed and throbbed, finally melting into a puddle of glass. The computer exploded in a shower of sparks, and then there was absolute silence.
There was a pause, and both of us turned as the printer started, slowly emitting a single sheet that wafted gently into the out bin. I nonchalantly strolled over, and held up to the Devil's scowling face, a sheet imprinted with two words. "Hello World".
Nothing more needs to be told, other than, as I write this, I am sitting in front of my new computer, munching on what is undoubtedly the best jelly donut I have ever eaten.
(c) Copyright Chris Lunt May 1995

Tuesday, September 19

One hundred ten

On January 8th I hope to walk through the doors of FullSail Real World Education institution for game design and development. Until January 8th there are one hundred ten days. In those one hundred and ten days there are roughly thirty weekends. During those weekends StrayStudios (the current delineation of Michael Alexander Kofman) will set out into the world of game development.

Step 1.
Send in an application to FullSail and fill out FASFA.

Step 2.
Get accepted to FullSail, take out loans, and apply for an apartment.

Step 3.
Review C++ and flex those programming muscles with a simple card game.

Step 4.

Get some coffee and count down till 2007!