• 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.

Anders2

Members
  • Content count

    16
  • Joined

  • Last visited

Community Reputation

127 Neutral

About Anders2

  • Rank
    Member
  1. The nHeight isn't really how tall the font should be if it is a positive value, it's how tall the cell of the font is, which is slightly different. Mostly I guess people who use the Truetype fonts negate it to use the actual height in pixels of the font. The most common thing is to use other methods to write text, I guess. If you want to use "flashier" Truetype fonts in your game you can include your own in your game and load it from memory with a few calls, without bothering to have to install it on the target system. For that you can check out the "article" section on my site: http://http://www.hypermotion.se/articles.html
  2. Capture a replayable stream from your application for a short time and analyze that you're getting the expected results.
  3. Another good tool that may be useful to search for misc problems with your (or another) application is Microsofts Application Verifier (AppVerifier). You can download it here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c4a25ab9-649d-4a1b-b4a7-c9d8b095df18 A quick how to (for xp) can be found here (maybe not up to date): http://support.microsoft.com/kb/286568 I think there's a good help file included as well. Start with basic tests, this app has some quite complex tests that can bring your computer to the cpu speed of a stone :-) (If I remember correct the memory tests (at least heap) is included in basic tests)
  4. Yes, my opinion is that you should ignore it.
  5. I'm going to stick out my nose and post some code here, I hope I won't regret it as I might have to try to explain it :-) What the.......I have just released my first DirectX game and most game graphics (tiles) as public domain so I can post some code as well :-) This is how I draw the tile map in my game, but there are some stuff declared outside this function so you'll have to think a bit anyway....See it as some kind of pseudo code......Post if you need additional info. From the beginning my intention was to post the source code as well, but it simply grew too big, and if I would start over today with the experience I got after this game I'd change some stuff in the code for sure......Enough, lets jump to the exiting part.... [code] // The function below writes the tile map (if one exists) to // the back buffer. There might be situations where no tile map // is present, for example if only an animation is played. // We only check for top and left tile clipping where we set // negative display coordinates so they are partly or totally // clipped by the viewport we set up. The right and bottom tiles // are clipped automagically by our viewport. void Gfx_PresentMap (void) { int iScreenX=0; //Screen X offset for writing tile map int iScreenY=0; //Screen Y offset for writing tile map UINT uiTileNumber; //Tile number to write to screen int iTileDivX, iTileDivY; //X and Y divisions for tile map number calc int iTileModX, iTileModY; //X and Y modulo for rect calc within tile int iScreenDivX, iScreenDivY; //Tile to write within screen position int iTotalX, iTotalY; //Calculate total tile offset BOOL bFirstX=TRUE; //TRUE if writing first tile row in X position BOOL bFirstY=TRUE; //TRUE if writing first tile row in Y position // Return if no tile map exist for this level if (g_LevelInfo.uiTileSizeX==0 && g_LevelInfo.uiTileSizeY==0) return; iTileDivX=World.uiMinX/TILESIZE; //Calculate X offset within tile map iTileModX=World.uiMinX%TILESIZE; //Calculate X modulo offset within tile map iTileDivY=World.uiMinY/TILESIZE; //Calculate Y offset within tile map iTileModY=World.uiMinY%TILESIZE; //Calculate Y modulo offset within tile map while (iScreenX<HSIZE) //Write all tiles in X position { iScreenDivX=iScreenX/TILESIZE; //Calculate X offset within screen offset iTotalX=iTileDivX+iScreenDivX; //Calculate total X offset within tile map iScreenY=0; //Reset Y screen offset bFirstY=TRUE; //We are writing first tile row in Y position while (iScreenY<VSIZE) //Write all tiles in Y position { iScreenDivY=iScreenY/TILESIZE; //Calculate Y offset within screen offset iTotalY=iTileDivY+iScreenDivY; //Calculate total Y offset within tile map uiTileNumber=(UINT)iTotalY+(g_LevelInfo.uiTileSizeY*(UINT)iTotalX); //Index within tile map // Correct tile number if we have clipped the first tile in // X or Y position. if (iTileModX && !bFirstX) uiTileNumber+=g_LevelInfo.uiTileSizeY; if (iTileModY && !bFirstY) uiTileNumber++; // Calculate out of screen top tile clipping if (iTileModY && bFirstY) iScreenY=0-iTileModY; // Calculate out of screen left tile clipping if (iTileModX && bFirstX) iScreenX=0-iTileModX; // Write the tile on screen, skip space tile, which is hard-coded by // design at tile map value == 0. if (g_LevelInfo.byTileMap[uiTileNumber]!=0) Gfx_WriteTile (iScreenX,iScreenY,g_LevelInfo.byTileMap[uiTileNumber],NULL); iScreenY+=TILESIZE; //Increase Y offset bFirstY=FALSE; //We are not writing clipped Y tile anymore } iScreenX+=TILESIZE; //Increase X offset bFirstX=FALSE; //We are not writing clipped X tile anymore } } [/code]
  6. Well, I can't claim to be an expert in the area but I don't think you should worry about page faults. Page faults / sec is the sum of hard and soft page faults. Soft page faults are where the data is found elsewhere in RAM. Hard page faults are generated whenever the VMM has to fetch data from the pagefile on the disk. And the page faults / sec is a system wide counter so you'll still have them without running your application.
  7. As I now have released my first game I am releasing most of the graphics used in the game as public domain, and some of the graphics was never used in the game I released. In total it's more then 700 files, most of them are tiles/animated tiles (64*64). Their quality differ, after all I'm not a graphics artist, but I hope that they can be useful to folks out there anyway. These files are released to public domain. You're free to use these for any purpose, free or commercial. Please drop me a mail if you plan to use them, it would be fun to see what they are used for! (use the email button on the site) You can preview some of them pasted in a picture by clicking here: http://www.hypermotion.se/download/TileExamples.png The zip file with the graphics is available here, check the download section: http://www.hypermotion.se
  8. Wow, it's looking great! Keep it up!
  9. [quote name='dtntr' timestamp='1304234086' post='4804961'] Good work for first game. Keep up working! [/quote] Thanks! You really learn a lot doing your own game, so I just want to send a "Keep going" to all out there struggling with your first one.
  10. After spending a lot of my spare time I've released my first game! It's a tile-based 2D platformer named Alexander where you have to find his cap to move to the next level. It didn't turn out as polished as I wanted from the beginning but it is still playable. It's intended as a game for children so it's not too hard too complete. Walk with the arrow keys, jump with space and use return to view/use inventory. (configurable) To run the game you will need DirectX 9 and the Visual Studio 2008 SP1 redistributables. The game is available at [url="http://www.hypermotion.se"]http://www.hypermotion.se[/url] under the download section. Screenshot: [url="http://www.hypermotion.se/Game1_alpha_screenshot2.png"]http://www.hypermoti...screenshot2.png[/url]
  11. I would use PIX to hunt it down. Check out the article link below (a bit down on page for DirectX debugging): http://www.hypermotion.se/articles.html
  12. Quote:Original post by Evil Steve Quote:Original post by TaeKwonDo hi all, I've just started using direct inputStop there. You should only be using DirectInput for joystick input. There's no reason to use it for keyboard or mouse input, and it's actually recommended that you DON'T use it by Microsoft; Link: "Overall, using DirectInput offers no advantages when reading data from mouse or keyboard devices, and the use of DirectInput in these scenarios is discouraged.". You should be using plain windows messages, or raw input if you need high-DPI mouse input. Thanks for the info Evil Steve. I'm trying to use DirectInput with actionmapping on keyboard/mouse/joystick but can not get the hang on it as written in an earlier post. I'm going to drop the actionmapping part and handle the keyboard/mouse as suggested too.
  13. Reposting the callback with source tags, they were added automatically earlier: // The callback function below receives DirectInput devices when they are enumerated with the // EnumDevicesBySemantics call. It tries to map applicable actions to the found object and // returns continue code if more devices are left to enumerate. BOOL CALLBACK Input_EnumDevicesCallback //Callback function that receive DirectInput devices (LPCDIDEVICEINSTANCE lpddi, //Adress of structure describing device instance LPDIRECTINPUTDEVICE8 lpdid, //Pointer to device interface DWORD dwFlags, //Flags telling why being enumerated DWORD dwRemaining, //Number of devices remaining to be enumerated LPVOID pvRef) //Application defined value. Always NULL here { HRESULT hr; //Result returned from calls if (lpdid!=NULL) //Check for valid pointer first { hr=lpdid->SetCooperativeLevel //Assign exclusive control of this device (Init.hwnd, //Top level window DISCL_EXCLUSIVE | DISCL_FOREGROUND); //Require exclusive foreground access if (FAILED (hr)) return (DIENUM_CONTINUE); //Continue enumeration if failure hr=lpdid->BuildActionMap (&g_ActionFormat, //Map applicable actions to current object NULL, //User string name, NULL=login name DIDBAM_DEFAULT); //Overwrite mappings except application-specified mappings if (FAILED (hr)) return (DIENUM_CONTINUE); //AppError (29,hr); //Call error function if failure if (g_iDevices>DI_MAXDEVICES-1) //If maximum enumerated deices reached return (DIENUM_STOP); //Stop enumerating devices g_lpDevices[g_iDevices]=lpdid; //Store device interface into array hr=g_lpDevices[g_iDevices]->SetActionMap //Apply map configuration to devices (&g_ActionFormat, //Adress to ActionFormat structure NULL, //User string name, NULL=login name DIDSAM_DEFAULT); //Set action map for this user, save it if differs if (FAILED (hr)) return (DIENUM_CONTINUE); //AppError (28,hr); //Call error function if failed lpdid->AddRef(); //Add a reference to this device g_iDevices++; //Increase number of enumerated devices // if (g_iDevices>DI_MAXDEVICES-1) //If maximum enumerated deices reached // AppError (30,0); //Call error function } // If there still are devices to enumerate return continue code, // else send stop code. return (dwRemaining ? DIENUM_CONTINUE:DIENUM_STOP); }
  14. Oh, noticed that I forgot to post the callback! Here it is: // The callback function below receives DirectInput devices when they are enumerated with the // EnumDevicesBySemantics call. It tries to map applicable actions to the found object and // returns continue code if more devices are left to enumerate. BOOL CALLBACK Input_EnumDevicesCallback //Callback function that receive DirectInput devices (LPCDIDEVICEINSTANCE lpddi, //Adress of structure describing device instance LPDIRECTINPUTDEVICE8 lpdid, //Pointer to device interface DWORD dwFlags, //Flags telling why being enumerated DWORD dwRemaining, //Number of devices remaining to be enumerated LPVOID pvRef) //Application defined value. Always NULL here { HRESULT hr; //Result returned from calls if (lpdid!=NULL) //Check for valid pointer first { hr=lpdid->SetCooperativeLevel //Assign exclusive control of this device (Init.hwnd, //Top level window DISCL_EXCLUSIVE | DISCL_FOREGROUND); //Require exclusive foreground access if (FAILED (hr)) return (DIENUM_CONTINUE); //Continue enumeration if failure hr=lpdid->BuildActionMap (&g_ActionFormat, //Map applicable actions to current object NULL, //User string name, NULL=login name DIDBAM_DEFAULT); //Overwrite mappings except application-specified mappings if (FAILED (hr)) return (DIENUM_CONTINUE); //AppError (29,hr); //Call error function if failure if (g_iDevices>DI_MAXDEVICES-1) //If maximum enumerated deices reached return (DIENUM_STOP); //Stop enumerating devices g_lpDevices[g_iDevices]=lpdid; //Store device interface into array hr=g_lpDevices[g_iDevices]->SetActionMap //Apply map configuration to devices (&g_ActionFormat, //Adress to ActionFormat structure NULL, //User string name, NULL=login name DIDSAM_DEFAULT); //Set action map for this user, save it if differs if (FAILED (hr)) return (DIENUM_CONTINUE); //AppError (28,hr); //Call error function if failed lpdid->AddRef(); //Add a reference to this device g_iDevices++; //Increase number of enumerated devices // if (g_iDevices>DI_MAXDEVICES-1) //If maximum enumerated deices reached // AppError (30,0); //Call error function } // If there still are devices to enumerate return continue code, // else send stop code. return (dwRemaining ? DIENUM_CONTINUE:DIENUM_STOP); }
  15. Hi all! As a DirectX newbie I've trying to get DirectInput actionmapping working. My code fails at the EnumDevicesBySemantics call returning E_INVALIDARG. After checking with other source code, MS and running in debug mode to check the values I still can't pinpoint where the error is. I hope anyone here can guide me in the right direction... First the header file: // This header file sets different values returned by the input functions. // The guidActionMap is a unique GUID for every application. This one is // generated from within Visual Studio using Tools | Create GUID. Select // static const struct GUID and generate. This GUID is unique, so create a new // one if copying/pasting this code to another application. // {8E38161D-F56C-4f9f-96E1-68D53EA54CCA} static const GUID ACTIONMAP_GUID = { 0x8e38161d, 0xf56c, 0x4f9f, { 0x96, 0xe1, 0x68, 0xd5, 0x3e, 0xa5, 0x4c, 0xca } }; // Below are different game actions defined. They define the different actions the // player can take. These actions are later mapped using action mapping. #define INPUT_XAXIS 1L //Movement in the X axis #define INPUT_LEFT 2L //Move left #define INPUT_RIGHT 3L //Move right #define INPUT_YAXIS 4L //Movement in the Y axis #define INPUT_UP 5L //Move up #define INPUT_DOWN 6L //Move down #define INPUT_SHOOT 7L //Well, guess what... #define INPUT_SELECT 8L //Used for something? //#define INPUT_SHIELD 9L //Activate shields #define INPUT_JUMP 10L //Jumping... #define INPUT_BOOST 11L //Speed up! #define INPUT_PAUSE 12L //Pause game #define INPUT_MUTE 13L //Mute sound/music #define INPUT_SOUNDUP 14L //Raise volume #define INPUT_SOUNDDOWN 15L //Lower volume #define INPUT_QUIT 16L //Quit game #define INPUT_NACTIONS 25L //Number of defined actions in action map #define DI_BUFSIZE 16 //Directinput input buffer size #define DI_MAXDEVICES 10 //Maximum number of detected DirectInput devices LPDIRECTINPUT8 gp_DI=NULL; //Pointer to DirectInput object LPDIRECTINPUTDEVICE8 g_lpDevices[DI_MAXDEVICES]; //Array of pointers to enumerated devices int g_iDevices=0; //Holds numer of enumerated devices for array static DIACTIONFORMAT g_ActionFormat; //Structure with genre, buffer size axis scaling etc // The data below sets up the action map for DirectInput. Each game action is // assigned to at least one virtual control or device object. The controls are defined // as action-mapping constants and are defined by genre and sub-genre. DIACTION g_GameAction [INPUT_NACTIONS]= { // Assign actions with controls, these are set up by DirectInput { INPUT_XAXIS, DIAXIS_ARCADEP_LATERAL, 0, (LPCSTR)"Left/Right", }, { INPUT_YAXIS, DIAXIS_ARCADEP_MOVE, 0, (LPCSTR)"Up/Down", }, { INPUT_SHOOT, DIBUTTON_ARCADEP_FIRE, 0, (LPCSTR)"Shoot", }, { INPUT_SELECT, DIBUTTON_ARCADEP_SELECT, 0, (LPCSTR)"Select", }, { INPUT_JUMP, DIBUTTON_ARCADEP_JUMP, 0, (LPCSTR)"Jump", }, { INPUT_BOOST, DIBUTTON_ARCADEP_FIRESECONDARY, 0, (LPCSTR)"Boost", }, { INPUT_PAUSE, DIBUTTON_ARCADEP_PAUSE, 0, (LPCSTR)"Pause Game", }, { INPUT_QUIT, DIBUTTON_ARCADEP_MENU, 0, (LPCSTR)"Quit Game", }, // Assign actions for keyboard { INPUT_LEFT, DIK_LEFT, 0, (LPCSTR)"Left", }, { INPUT_RIGHT, DIK_RIGHT, 0, (LPCSTR)"Right", }, { INPUT_UP, DIK_UP, 0, (LPCSTR)"Up", }, { INPUT_DOWN, DIK_DOWN, 0, (LPCSTR)"Down", }, { INPUT_SHOOT, DIK_F, 0, (LPCSTR)"Shoot", }, { INPUT_JUMP, DIK_J, 0, (LPCSTR)"Jump", }, { INPUT_BOOST, DIK_B, 0, (LPCSTR)"Boost", }, { INPUT_SELECT, DIK_S, 0, (LPCSTR)"Select", }, { INPUT_PAUSE, DIK_SPACE, 0, (LPCSTR)"Pause Game", }, { INPUT_MUTE,DIK_MUTE, 0, (LPCSTR)"Mute Sound", }, { INPUT_SOUNDUP,DIK_VOLUMEUP, 0, (LPCSTR)"Increase Volume", }, { INPUT_SOUNDDOWN,DIK_VOLUMEDOWN, 0, (LPCSTR)"Decrease Volume", }, { INPUT_QUIT, DIK_ESCAPE, 0, (LPCSTR)"Quit Game", }, // Assign actions for mouse { INPUT_XAXIS, DIMOUSE_XAXIS, 0, (LPCSTR)"Left/Right", }, { INPUT_YAXIS, DIMOUSE_YAXIS, 0, (LPCSTR)"Up/Down", }, { INPUT_SHOOT, DIMOUSE_BUTTON0, 0, (LPCSTR)"Shoot", }, { INPUT_JUMP, DIMOUSE_BUTTON1, 0, (LPCSTR)"Jump", }, }; and after the header some code: HRESULT hr; //Result returned from calls hr=DirectInput8Create //Get DirectInput pointer interface (GetModuleHandle (NULL), //Module handle for this application DIRECTINPUT_VERSION, //Version of DirectInput application designed for IID_IDirectInput8A, //Use ANSI version of the interface (VOID**)&gp_DI, //Address of ptr to receive interface ptr NULL); //Do not use COM aggregated interface if (FAILED (hr)) AppError (26,hr); //If failed to create DirectInput interface pointer ZeroMemory (&g_ActionFormat, sizeof (DIACTIONFORMAT)); //Clear the structure first g_ActionFormat.dwSize=sizeof (DIACTIONFORMAT); //Size of structure g_ActionFormat.dwActionSize=sizeof (DIACTION); //Size of action structure // Calculate size of action map and number of entries g_ActionFormat.dwDataSize=INPUT_NACTIONS * sizeof (DWORD); g_ActionFormat.dwNumActions=INPUT_NACTIONS; // The guidActionMap is a unique GUID for every application. This one is // generated from within Visual Studio using Tools | Create GUID. Select // static const struct GUID and generate. This GUID is unique, so create a new // one if copying/pasting this code to another application. g_ActionFormat.guidActionMap=ACTIONMAP_GUID; //Setting GUID for the actionmap g_ActionFormat.dwGenre=DIVIRTUAL_ARCADE_PLATFORM; //Set genre g_ActionFormat.rgoAction=g_GameAction; //Array with actions g_ActionFormat.dwBufferSize=DI_BUFSIZE; //Size of input buffer g_ActionFormat.lAxisMax=100; //Axis max value g_ActionFormat.lAxisMin=-100; //Axis min value strcpy_s (g_ActionFormat.tszActionMap,"Game Controls\0"); //Friendly name of action map g_ActionFormat.hInstString=NULL; //String action names are defined with actions hr=gp_DI-&gt;EnumDevicesBySemantics //Apply the mappings to physical devices (NULL, //User string name, NULL=login name &g_ActionFormat, //Adress to ActionFormat structure Input_EnumDevicesCallback, //Callback function for each found device NULL, //Value to send to callback function DIEDBSFL_ATTACHEDONLY); //Scan attached and installed devices only if (FAILED (hr)) AppError (27,hr); //Call error function if failed And that's pretty much it. My application fails calling the AppError above. /Anders EDIT: Please remember 'source' tags in future.