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


  • Content count

  • Joined

  • Last visited

Community Reputation

146 Neutral

About MartinSmith160

  • Rank
  1. maybe, maybe. for some scenarios in the game a video wont wok but i guess that's more to do with the game design than a directx issue.   Chees for the advice tho. 
  2. Hi Tom   I have tried this approach before but with the big animations (some have full screen frames)  the graphics card fails to load them because they have a maximum texture size.    For example I have an animation which has 60 fames and each frame is 1027x768. If I tied to put that into a sprite sheet it wold be huge and from past memory most graphics cards have a max size of something like 2024 x 2024 or something like that.   When using this approach before directx just renders a white box the size of a single frame. Am I looking at this in the wrong way.   Cheers.
  3. I wrote a test program that created 500 textures. all the textures were mixed, so different file types and directories. I used the standard load from file method and then used the load from single binary file and measured the durations.   its still faster to use the load from file method. The binary file takes longer. Not really sure what im going to do now. might have to look into getting flash video into the game instead of using all the big animations. I started off tying to get flash in but i could get the transparency of a video to show through which meant it was hard to mix the videos in with the other game graphics.    I will keep trying tho.   Cheers mate.
  4. Ok cheers for making that code. I ran it and I used one of my graphics. After some testing i think .tga is better than .png. They seem to load faster. Anyway, I made some changes to my code to reflect you feedback and now files are loading faster. I ran the 3000 test in your program and then I ran it it in mine and they were pretty much the same. Around 4 seconds to load 3000 textures which seems great.    but...   I added the time measuring between start and end of loading to my application and then tested the time it would take to load 3000 textures via the old method. Using the D3DXCreateTextureFromFileEx function and they wern't very far apart at all.    I will however start using this loading technique with my game and see if i start to see faster results.   Thanks again for the help, your a true legend.   Ill let you know how I get on.
  5. Hi Belfegor,   I have done what you said and its working. I have wrote the code to do the following:   Pack data into one big binary file Extract the data in a usable form load a LPDIRECT3DTEXTURE9 using that data   My question is now, i think my extraction must be poor because loading now takes longer.   This Is my header code: struct TextureInfo { std::string name; // file name/path (dds, tga...) D3DXIMAGE_INFO ii; }; struct Texture_Item { std::string name; std::vector<char> info_buffer; std::vector<char> buffer; }; std::vector<std::string> texture_filenames; std::vector<TextureInfo> vTextureNames; std::vector<Texture_Item> vTextureItems; void CreateBinaryFile(); void ExtractBinaryData(); ST_Texture test_bulk_textures[3000]; ST_Sprite *test_bulk_sprites[3000];   Here is my Pack data function: void GameApp::CreateBinaryFile() { texture_filenames.clear(); vTextureNames.clear(); for(int i = 0; i < 3000; i++) texture_filenames.push_back("Graphics/cloud-day-3.tga"); TextureInfo temp_texture_info; for(int i = 0; i < texture_filenames.size(); i++) { temp_texture_info.name = texture_filenames[i]; D3DXGetImageInfoFromFile(temp_texture_info.name.c_str(), &temp_texture_info.ii); vTextureNames.push_back(temp_texture_info); } std::ofstream os("packed_textures.bin", ios::binary); UINT texFilesCount = vTextureNames.size(); os.write( (const char*)&texFilesCount, sizeof(UINT) ); for(size_t i = 0; i < vTextureNames.size(); ++i) { UINT nameLen = vTextureNames[i].name.size(); os.write( (const char*)&nameLen, sizeof(size_t) ); // to know how much to read it later os.write( vTextureNames[i].name.c_str(), vTextureNames[i].name.size() ); os.write( (const char*)&vTextureNames[i].ii, sizeof(D3DXIMAGE_INFO) ); // opening texture file to copy it to our binary ifstream is(vTextureNames[i].name, ios::binary); is.seekg (0, is.end); UINT length = is.tellg(); is.seekg (0, is.beg); std::vector<char> vFile(length); is.read((char*)&vFile[0], vFile.size()); is.close(); os.write( (const char*)&length, sizeof(UINT) ); // to know how much to read it later os.write( (const char*)&vFile[0], vFile.size() ); } os.close(); }   This is my Unpack function:   void GameApp::ExtractBinaryData() { vTextureItems.clear(); Texture_Item temp_item; UINT total_texture_count = 0; size_t name_length = 0; UINT texture_byte_length = 0; ifstream is("packed_textures.bin", ios::binary); is.seekg (0, is.end); UINT length = is.tellg(); is.seekg (0, is.beg); //Read total number of texture is.read( (char*) &total_texture_count, sizeof(UINT) ); for(int i = 0; i < total_texture_count; i++) { temp_item.name = ""; temp_item.info_buffer.clear(); temp_item.buffer.clear(); is.read( (char*) &name_length, sizeof(size_t) ); temp_item.name.resize(name_length); is.read( (char*) &temp_item.name[0], temp_item.name.size() * sizeof(char)); temp_item.info_buffer.resize(sizeof(D3DXIMAGE_INFO)); is.read( (char*) &temp_item.info_buffer[0], sizeof(D3DXIMAGE_INFO) ); is.read( (char*) &texture_byte_length, sizeof(UINT) ); temp_item.buffer.resize(texture_byte_length); is.read( (char*) &temp_item.buffer[0], texture_byte_length); vTextureItems.push_back(temp_item); } is.close(); }     and this is my new load function to use that data:   bool ST_Texture::Load(LPDIRECT3DDEVICE9 d3dDevice,std::string filename, std::vector<char> d3d_info_buffer, std::vector<char> graphic_buffer, D3DCOLOR transcolor) { //standard Windows return value HRESULT result; //get width and height from bitmap file /*result = D3DXGetImageInfoFromFileInMemory((LPCVOID)&d3d_info_buffer[0], d3d_info_buffer.size(), &info); if (result != D3D_OK) { st_engine->LogError("Failed to load graphics file: INFO BUFFER",false,"ENGINE_ERRORS.txt"); texture = NULL; return 0; }*/ //get width and height from bitmap file result = D3DXGetImageInfoFromFile(filename.c_str(), &info); if (result != D3D_OK) { st_engine->LogError("Failed to load graphics file: " + filename,false,"ENGINE_ERRORS.txt"); texture = NULL; return 0; } result = D3DXCreateTextureFromFileInMemoryEx( d3dDevice, (LPCVOID)&graphic_buffer[0], graphic_buffer.size(), info.Width, info.Height, 1, //mip-map levels (1 for no chain) D3DPOOL_DEFAULT, //the type of surface (standard) D3DFMT_UNKNOWN, //surface format (default) D3DPOOL_DEFAULT, //memory class for the texture D3DX_DEFAULT, //image filter D3DX_DEFAULT, //mip filter transcolor, //color key for transparency &info, //bitmap file info (from loaded file) NULL, //color palette &texture ); //destination texture if (result != D3D_OK) { st_engine->LogError("Failed to load graphics file: FROM BUFFER",false,"ENGINE_ERRORS.txt"); texture = NULL; return 0; } return 1; }     As you can see from the load function, i couldnt get the loading of the D3DXIMAGE_INFO from memory working. im not sure why. so I tried it with the standard way and it worked. so atleast i know the graphic binary data load is working.   My question is, am i doing something obviously wrong because my load time is huge now. The ExtractBinaryData() takes ages and so does the actual load.   it worked great for one file, but then i tried your example of using 3000 items. now its takes ages.   Sorry i know that was a lot.
  6. Thanks a lot, you have been a great help. 
  7. Hi Belfegor,   Just a quick question, each graphic file will have binary data for the D3DXIMAGE_INFO and the actual graphic data from the source graphic file. For a specific item, i will extract the binary data from the packed file and put that into a buffer. I was just wandering does the data have to be in a specific order. So first I add the D3DXIMAGE_INFO bytes in and then the graphic data in and then use that buffer in the D3DXCreateTextureFromFileInMemory function.   Thanks again for the help. Martin    
  8. ok this is making sense now. Thanks for being patient.        
  9. Hi Belfegor,   Thanks for the code, that really helps. I fully understand the first section of code. I just don't get a few things regarding the second. When there is more than one texture in the binary file, im not sure how to search through the file to pick out each individual texture information.    This might be related to the previous question, I'm not sure how you actually "Pack" the textures into one binary file. All my Graphics are .tga files. Would I have to write a program to convert .tga in the .dds file and then save each one into one full file. I have never used a .dds file before so im not really sure how to use them.
  10. I dont suppose you could show me the code to load this kind of data in could you.
  11. Ok so this is the load function. Could I just save out the ST_texture objects amd then load them back in. Im worried about the directx contexts not being right. bool ST_Texture::Load(LPDIRECT3DDEVICE9 d3dDevice, std::string filename, D3DCOLOR transcolor) { //standard Windows return value HRESULT result; //get width and height from bitmap file result = D3DXGetImageInfoFromFile(filename.c_str(), &info); if (result != D3D_OK) { st_engine->LogError("Failed to load graphics file: " + filename,false,"ENGINE_ERRORS.txt"); texture = NULL; return 0; } //create the new texture by loading a bitmap image file D3DXCreateTextureFromFileEx( d3dDevice, //Direct3D device object filename.c_str(), //bitmap filename info.Width, //bitmap image width info.Height, //bitmap image height 1, //mip-map levels (1 for no chain) D3DPOOL_DEFAULT, //the type of surface (standard) D3DFMT_UNKNOWN, //surface format (default) D3DPOOL_DEFAULT, //memory class for the texture D3DX_DEFAULT, //image filter D3DX_DEFAULT, //mip filter transcolor, //color key for transparency &info, //bitmap file info (from loaded file) NULL, //color palette &texture ); //destination texture //make sure the bitmap textre was loaded correctly if (result != D3D_OK) { st_engine->LogError("Failed to load graphics file: " + filename,false,"ENGINE_ERRORS.txt"); texture = NULL; return 0; } return 1; }
  12. Is this along the lines you you mentioned:   - Create a struct which contains a set of D3DXIMAGE_INFO items - I would then open my binary data file and initialize all the D3DXIMAGE_INFO items in the struct - I would then pass these items into my sprite objects load instead of a filename.   Therefore cutting out all the individual creations of the D3DXIMAGE_INFO objects, which is what happens now.
  13. Hi belfegor, thanks for the reply.   This sounds along the right lines. I dont really understand how you mean tho. could go explain a little further. I will save all the data of the graphics into one binary file and then use that to load into the directx textures.
  14. Hi Guys,   I was wandering if you could help me. I have a 2D game built using directx 9 and its all working fine. I would however like to reduce the load time for the game as there is a substantial amount of graphics to load. My sprite class uses LPDIRECT3DTEXTURE9 for the images and an image is loaded using D3DXGetImageInfoFromFile().   This approach works perfectly its just I have some animations that have a large number of large individual frames to load. This increases the load time and the size of the overall game by quite a bit. I was looking at a way to replace these animations with some form of flash animation sequence but i cant find a way to maintain the transparency of a flash animation in directx.    Any help of this would be greatly appreciated,   All the best, Martin
  15. Hi Overdrive, thanks for the response. I changed the d3dpp.PresentationInterval to D3DPRESENT_INTERVAL_ONE and it solved the tearing. It did however make the movement look slightly jerky. Strange. The frame rate didnt seem to drop so im not sure what this could be. Ill look into it. Thanks for the help.