• 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

13428 Excellent

About mhagain

  • Rank
  1. OpenGL

    You're still making a call to GetDC each frame though - that's a resource leak. You need to fix that first because otherwise you've two potential problems going on and you won't know whether any issues you have are coming from either.
  2. OpenGL

    I mean ReleaseDC after each GetDC; as it stands now you call GetDC each frame so eventually you're going to run out of DCs. Use something like this instead: HDC hDC; if ((hDC = GetDC (window_handle)) != NULL) { SwapBuffers (hDC); ReleaseDC (hDC); }
  3. Best of luck calling D3DX11CompileFromFileW with DirectXMath. I'm only being half-facetious here; there is a tendency to say "don't use D3DX, use DirectXMath" which totally overlooks the fact that D3DX contained a lot of other functionality too. It's far more useful to the OP to point them at this page instead: https://blogs.msdn.microsoft.com/chuckw/2013/08/20/living-without-d3dx/
  4. OpenGL

    SwapBuffers(GetDC(window_handle)); This is a resource leak; you need to call ReleaseDC to match your GetDC. You should also create your window class with CS_OWNDC if you use this pattern (otherwise store the window DC once only at startup in a global of some kind).
  5. gl_FragColor has been deprecated since GLSL 130; use an out vec4 instead. Your GLSL compilation should be giving you an error for this.
  6. Why is present so slow? Read the rest of the post linked above for more info. It's really good stuff that might seem non-obvious sometimes.
  7. 2D

    There is no "raw" OpenGL. The task of creating a context, irrespective of platform, has never been part of the OpenGL API, but is instead delegated to the operating system. By learning context creation all you are learning is a few OS-level calls with the appropriate flags. This is of absolutely no benefit to your eventual usage of OpenGL itself. Regarding GL versions, you'll sometimes see buffers and shaders discussed as though they were modern features. This is completely untrue. Vertex arrays date back to OpenGL 1.1, buffer objects to 1.5 and shaders to 2.0, and all are available as extensions to even earlier versions. These "modern" features are actually 15 years (or more) old. Don't be concerned about any risk of using them, these are mature, stable features.
  8. 2D

    It's actually all legacy; GL 1.1 using client-side vertex arrays and fixed function vertex attribs to be precise.
  9. DX11

    Validation. Because different states can be specified in isolation from each other, part of an API's job is to validate the current combination of states in order to ensure that it's OK to draw with them. Traditionally this could only be done at run time because older API's had no way of knowing what the final combination of states used for a draw call would be until the draw call is made. Direct3D 10 moved a lot of validation from run time to object creation time, and Direct3D 11 continued with this. One place you see it is in the use of immutable state objects, gathering groups of related states used at different parts of the pipeline together. Another place you see it is in the tight coupling of input layouts with vertex shaders. Think back to Direct3D 9 and try to imagine how vertex declarations might work. What happens if the vertex declaration provides an input that the vertex shader doesn't consume? What happens if the vertex shader consumes an input that the declaration doesn't provide? How are format conversions worked out? There are rules for all of these things, but because the API doesn't have a way to know which combination of declaration and shader will be used together it can't work things out until run time, typically when you make a draw call. Under Direct3D 10+ because they're linked at creation time the validation can also be done at creation time, meaning that this step can be skipped at run time and run time gets faster.
  10. The major advantage of packaging everything into an archive is for distribution. Users only need to download a single file and so long as that file is intact and it's checksums match then you can have a good degree of expectation that they have the correct content. A simple collapse of a directory structure to a single file, with the inclusion of a table of contents, can satisfy this requirement. After that it depends on how fancy you wish to go. One example here is that you might place resources that are loaded together - such as a map and it's textures - contiguous in the file so that they can load with less jumping around the disk. That kind of very specific fine-tuning is something that no format will give you; you need to do this yourself. Another thing that a package can give is the ability to override content. To use the example of ID's old PAK system, a file in pak1.pak will override the same file in pak0.pak. Again, this isn't something you get from the format, you code this up in your file loading subsystem. Some food for thought there, but again it highlights that the format is not the important thing, it's what you do with it, how you use it, that matters.
  11. Things you need to consider when choosing one? Have a think about the reasons why you want compression. Depending on your platform, saving disk space may not be as important a consideration as it would have been 10 or even 5 years ago. You might place more importance on how quick it is to read the archive off the disk and how quick it is to decompress the file - both of these will factor into the load times your users experience. Do you want any kind of encryption, perhaps as a deterrent to casual meddling? Does the format come with any IP encumberance regarding distribution? What is the licensing like in general anyway? Can you statically link to the library or does it have to be dynamic, and does that even matter to you? Does it come with good sample code that matches well with your use case(s)? What about support facilities - is there an active end-user forum, for example? That's a sampling of things that should be going through your head as you weigh up the options.
  12. For NVIDIA Optimus use the following: extern "C" { _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; } For AMD use the following: extern "C" { __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; } Reference (for AMD): https://community.amd.com/thread/169965
  13. It's instructive in cases such as this to examine how the compilation process actually works. Under D3D compiling a shader is a two-stage process. Stage 1 compiles the text-based HLSL code to hardware-independent binary blobs and this is the stage that is carried out by fxc.exe or D3DCompile (which are actually the same thing but I'll get to that in a moment). Stage 2 always happens in your program and this stage takes the hardware-independent binary blobs and converts them to actual shader objects (i.e. ID3D11VertexShader, etc); this stage is exposed by the ID3D11Device::CreateVertexShader/etc API calls. The point I made above is that fxc.exe and D3DCompile are actually the same thing; fxc.exe actually calls D3DCompile to compile it's shaders, and this is something you can confirm by using a tool such as e.g. Dependency Walker. You can also infer that D3DCompile and D3DCompile2 are hardware-independent by the fact that they don't take an ID3D11Device as a parameter (in other words Direct3D doesn't even need to be initialized in order to compile a shader; this is a pure software stage). Microsoft's own advice on this matter is given at the page titled HLSL, FXC, and D3DCompile and I'll quote: This page then goes on to discuss scenarios in which you may, despite this advice, still wish to compile at runtime, such as for development purposes; runtime compilation is particularly useful for shader development if you're able to quickly reload and recompile your shaders while the program is running, and see the effects of code changes immediately. Finally, and this may not be immediately obvious, but you can actually compile your shaders for a lower target than the D3D device you end up creating and ship a single set of precompiled shaders that way. For example, if you set a minimum of D3D10 class hardware, you can compile your shaders for SM4 and set up your feature levels appropriate, and they'll work on D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_11_0 or higher.
  14. What might not be obvious is that you can make this an error even without bumping your warning level to 4 (although you should be compiling with warning level 2 or 3 at least, as well as with warnings-as-errors, anyway).
  15. Rather than testing for NULL after CreateDevice you really should be testing the HRESULT it returns, using the SUCCEEDED and FAILED macros, with failure HRESULTs giving you some more info on why it failed. You also have a nasty memory leak in that code - you need a surface->Release for each GetBackBuffer call. In this case it won't destroy the backbuffer because GetBackBuffer will increment the reference count for it, so Release will just decrement it; it doesn't get destroyed until the reference count goes to 0.