![]() |
|
Spaces home LightSleeperProfileFriendsBlogMore ![]() | ![]() |
|
LightSleeperGood times!
June 12 Fine GemsAn exciting new package arrived on my doorstep this week: a copy of Best of Game Programming Gems, edited by my friend Mark DeLoura. I've contributed many gems to this series over the years, and I edited the networking and multiplayer section in Game Programming Gems 4. The new Best Of volume includes four of my gems. Mark did a good job on choosing the best ones:
There are dozens of other great gems covering math, physics, AI, graphics, networking and audio. Check it out!
June 05 Const input parameters and typedefsIn good API design, one specifies unchangeable data that's passed by pointer as const:
void foo( const Stuff* pConstantStuff );
The compiler will guarantee that the "Stuff" pointed to by pConstantStuff is not modified by foo(). This is goodness. Microsoft APIs have a habit of using typedefs for structures, ala:
void foo( const STUFF* pConstantStuff );
In fact, some people even use typedefs for pointers to structures:
typedef Stuff* PSTUFF;
And they write the API like this:
void foo( const PSTUFF pConstantStuff ); // Evil; this does not do what you expect!
That last version is not code you ever want to write! What it seems to promise is not what it actually promises. The compiler interprets it as:
void foo( Stuff* const pConstantStuff ); // weird but technically correct
This version guarantees that the pointer itself cannot be changed by the function. However, the contents of pConstantStuff are no longer constant. The code can change the contents and the compiler will happily oblige! There are two solutions. Solution one is to create a const version of the typedef and use it where appropriate. Here's how winnt.h does it for strings:
typedef char *LPSTR;
typedef const char* LPCSTR;
The preferable solution is to avoid typedefs for pointer types and use const directly whenever you need it. Use const whenever you possibly can. In return, you get readable code that clearly expresses the intent -- and the compiler properly enforces the intent.
May 29 BoostCon 2008I spent the week of May 5-9 in Aspen, Colorado attending BoostCon. BoostCon is all about Boost, a collection of free portable C++ source code libraries.
This is the second year of the conference. There were about 80 attendees, including C++ luminaries, Standards Committee members, Boost library authors and Boost library power users. The reason I attended is because the conference includes discussions on hardcore C++ usage plus future language and library features. Many of the Boost libraries (there are about 80) are already in the draft of the next version of the C++ Standard, and much of the work that happens in Boost libraries leads to new language features and new library components. Being at BoostCon is a bit like travelling to the future of C++.
Conference Takeaways
Here's one of my favorite new features of C++0x. I hate writing code like this:
Wouldn't it be nice if the compiler just knew what i was. It has to be the return type of v.begin(), right? C++0x allows you to avoid all that crazy typing:
That gives you a tantalizing glimpse of one of the many new features we have to look forward to in C++. May 01 Gamefest 2008 is ComingPut it on your calendar: July 22-23 in Seattle. Gamefest is coming! If you've been to Gamefest in the past, you already know it's the ultimate place to get the latest and greatest information on creating games for Microsoft platforms like Xbox 360 and Windows Vista. If you work on games and you haven't been to Gamefest, you're missing something really special. I've already seen some of the proposed talk abstracts, and you can expect some amazing content from excellent speakers.
April 18 I Hate to WaitI admit to a certain fondness for first person shooters. I got hooked on Half-Life, but it was the Halo series that really put me over the edge. I particularly enjoy multiplayer fragfests. Most session-based games these days follow a model where you search for a particular session and either join an existing one or start your own. Either way, players are left waiting for the game to start when the session fills up with a certain number of players.
Players hate to wait, so it's always a good idea to reduce or eliminate wait times. The wait times for sessions can be described fairly simply:
Wait times rise when:
Wait times decrease when:
Games that group players by skill (Halo 2 and Halo 3 are examples) add another factor. The more skill groups you have, the longer the wait times. These factors are mostly in your control as a game designer and developer. If you want to reduce wait times there are multiple knobs to tweak. If you add a new multiplayer game mode, be aware that it will impact session wait times. Keeping sessions short is a great way to minimize waits. There are other ways, too. For instance, allow players to do something while they're waiting: chat, practice their skills, or watch something interesting. Of course, the most important thing you can do is ensure your game is great, because that will improve the overall pool of available players :).
|
|||||||||||||||||
|
|