• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

Draxis

What IS a DWORD?

10 posts in this topic

Yeah, I''m sure it''s a newb question, but what exactly IS a DWORD? I know it''s some sort of crazy MS typedef, but other than that, I dunno. I looked it up on MSDN but only got it''s general usage, not exactly what it is and what makes it up.
1

Share this post


Link to post
Share on other sites
bit = ...1 bit...
nybble = 4 bits = 1/2 byte
byte = 8 bits = 2 nybbles
WORD = 2 bytes = 4 nybbles = 16 bits
DWORD = 2 WORDs = 4 bytes = 8 nybbles = 32 bits
QWORD = 2 DWORDs = 4 WORDS = ..... = 64 bits
There might be more; if there are, I don't know of them.


EDIT: DWORD stands for Double Word, QWORD for Quad (prefix meaning 4). I suppose the next would be Oct (prefix meaning 8).

"I've learned something today: It doesn't matter if you're white, or if you're black...the only color that REALLY matters is green"
-Peter Griffin

Edited by - matrix2113 on February 17, 2002 7:04:27 PM
0

Share this post


Link to post
Share on other sites
Thankya!
But here''s question 2.
How can DWORDs take statements like:
  
DWORD dwBlah;
dwBlah = STATEMENT1 | STATEMENT2 | STATEMENT3;

What''s with the pipes and the multiple option thing?
How exactly does the compiler interpret that?
0

Share this post


Link to post
Share on other sites
Its a binary OR operation. Eg - 0 OR 0 = 0, 0 OR 1 = 1, 1 OR 0 = 1 and 1 OR 1 = 1.
In cases like your example its usually used to implement flags. You can then check for whether a flag is set like this:
  
if ( dwBlah & aFlag != 0 )
doSomething();

0

Share this post


Link to post
Share on other sites
Ok, now, what are the flags?
They obviously have to hold some value (0 or 1?).
How exactly is that assigned?
Thanks again for your patience!
0

Share this post


Link to post
Share on other sites
Each flag has a different bit set. A DWORD is 8 bits long therefore there are a maximum of 8 different flags that can be used.

eg.

Flag1 = 00000001
Flag2 = 00000010
Flag3 = 00000100
Flag4 = 00001000

and so on

therefore if dwSomething = Flag1 | Flag2 | Flag3
then dwSomething = 00000001 | 00000010 | 00000100
= 00000111.

0

Share this post


Link to post
Share on other sites
A flag is a value that a function looks at to determine what it should be doing. Arild Fines showed how a function checks to see if a flag is set in the function.

Flags are defined by whoever writes the function, usually they are assigned powers of two because when you OR them together powers of two wont affect each other.

For example, if we defined some flags with decimal values

EX_1 = 1; //00000001 in binary
EX_2 = 2; //00000010 in binary
EX_3 = 4; //00000100 in binary
EX_4 = 8; //00001000 in binary

When we OR them together their values will be superimposed.

EX_1 | EX_2 will be 3, or 00000011 in binary
EX_8 | EX_4 | EX_1 will be 13, or 00001101 in binary

Extracting a specific flag from a dword uses the AND (&) operator. For AND, both bits must be 1 to return 1 or it will return 0.

Suppose you have value 00001101 and you want to see if the flag EX_2 is in it, using 00001101 AND EX_2 would return 0 (flag EX_2 is not included) because

00001101
& 00000010
----------
00000000

00001101 AND EX_8 will return EX_8 (the flag is included) because

00001101
& 00001000
----------
00001000

by the way, I''ve been using single bytes to explain the use of flags and AND and OR so that you could see the individual 0''s and 1''s without me having to type out 32 of them out to represent a double word. I''m sure you already figured that though

Invader X
Invader''s Realm
0

Share this post


Link to post
Share on other sites
DWORD is a typedef from the Windows API. Most such typedefs are anachronisms. For example, a WORD is 16 bits and a DWORD is 32 bits (as has been said), but those names are currently misnomers. You see, a "word" refers the the addressing size of the target processor. When the Windows API was first devised, a word was 16 bits, hence the 16-bit size for the WORD type. But most processors these days address 32 bits at a time, so they have 32-bit words. For backwards compatibility, WORD stayed the same, even though—from the name—it should be 32-bits. Other types like LPARAM and WPARAM have become the same size (32 bits), even though WPARAM used to be 16-bits as is indicated by the W prefix (which stands for WORD). So, it''s confusing, especially since Intel parlence has followed the same trend of backwards compatibility with naming. But don''t forget what a real word is—that it''s dependent on the processor.
0

Share this post


Link to post
Share on other sites
Thankyou everyone, I get it now
Sorry about the multitude of questions though.
I just like to understand something inside out and it drives me nuts when I don''t.
0

Share this post


Link to post
Share on other sites