• 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

374 Neutral

About DgekGD

  • Rank

Personal Information

  • Location
    Chelyabinsk, Russia
  1. Create separate classes for Shaders, Vertex Buffers etc.     For example i have the following class for vertex shader: class VertexShaderDX11 { protected: ID3D11VertexShader* m_pShader; InputAssemblerStateDX11* m_pState; public: VertexShaderDX11() { m_pState = new InputAssemblerStateDX11(); } ~VertexShaderDX11() { SAFE_RELEASE(m_pShader); SAFE_DELETE(m_pState); } ABOOL Create(BlobDX11 & shaderbuffer, INPUT_LAYOUT* layout, AUINT8 num, AUINT16 topology); AVOID Set() const; };   Note that it has pointer to the InputAssembler structure (it stores information about Input Assembler stage as for vertex shader you have to have right input topology).     In your sprite class you can reference shader for rendering and bind it to the pipeline before you render your sprite. Don't recompile shader all the time! Compile it one time and then just have a pointer to an object of your shader class which stores compiled shader.  Multiple sprites can use single shader for rendering just having pointer to it.
  2. I guess, you can use btRigidBody::setFlags method and set proper flags to configure behavior for your rigid body. Here is a list of all flags(line 117). 
  3.  Okay. Imagine you missile is going to the right (1, 0) - x and y coordinates accordingly. Currently it has position (200, 200). It's target lies in the point (300, 200), so target angle between missile direction and X axis is zero(targetOrientation = 0) and current angle of missile direction and X axis is zero(missile.orientation = 0)    Next frame your target moves to the position (200, 100), probably you won't have such a huge jumps in just a single frame, but i try to show you an idea. So your desired direction for a missile is (0,1) now which make angle of Pi/2 (90 degrees) with X axis. So you start to rotate your missile. Your maxAngularAcceleration value should be already is defined for each missile, so you increase its rotation :missile.rotation += missile.angularAcceleration * time  and than orientation (or angle between direction and X axis) :  missile.orientation += missile.rotation * time.    Than you use current angle to get movement direction. Start with creating Z axis rotation matrix (Z axis goes into your screen or out of your screen) and multiply vector (1, 0) with this matrix. As a result you will get rotated vector. That you can multiply it by speed scalar. You can read this small tutorial if you still have some questions regarding retrieving direction from current angle.    I hope it helps ;) Let me know if you still have some questions :)
  4. Yep, atan2 function will work, perhaps you have to swap deltaX and deltaY arguments to get an angle from X axis.      Orientation - is a desired angle or current angle ( position for movement )   Rotation - is a speed orientation is changed (velocity for movement )   angularAcceleration - is a speed rotation is changed (acceleration for movement)    I hope everything is clear now:)
  5. Basically, when your missile updates it's target position(it's not necessary to do every single frame) find target angle of rotation, so that missile points in right direction (with the help of atan2 function). And than update missile rotation as you update its position. Here is an example: missile.angularAcceleration = targetOrientation - missile.orientation; if (missile.angularAcceleration < 0) missile.angularAcceleration = -maxAngularAcceleration; else missile.angularAcceleration = maxAngularAcceleration; missile.orientation += missile.rotation * time; missile.rotation += missile.angularAcceleration * time; if (missile.rotation > maxRotation) missile.rotation = maxRotation; It's far not ideal implementation, just to give you an idea. Actually, you can make your rotation even smoother with the use of slow down radius for example(when angle to rotate remains small it starts to slow down a little bit). Also, maybe you fill need some radius of satisfaction(it's doubtful that your object will rotate EXACTLY at the angle you need and it will end up in flickering).
  6. Actually, there are a lot of things that can go wrong in your code and i don't see any explicit error here. In pixel shader try [CODE] return float4(1.0f, 1.0f, 1.0f, 1.0f); [/CODE] If you see your object white, probably problem lies in binding texture resource (DefaultTexture in your shader code). If still nothing appears, check that you update constant buffers with matrices correctly for the vertex shader and bind right render target for your pixel shader. Or maybe you placed vertices in the wrong order and rasterizer culls your geometry, try [b]D3D11_CULL_NONE.[/b]
  7. Hi! When using Bullet Physics in your game you implement some[b] BulletInternalTickCallback( btDynamicsWorld * const world, btScalar const timeStep )[/b] method bullet uses as internal callback. [CODE] dynamicsWorld->setInternalTickCallback( BulletInternalTickCallback ); [/CODE] dynamicsWorld declared as [b]btDynamicsWorld*[/b] In this method you want to make loop like that: [CODE] // look at all contacts btDispatcher * const pDispatcher = world->getDispatcher(); for ( int manifoldInd=0; manifoldIdx<pDispatcher->getNumManifolds(); manifoldInd++ ) { //get manifold btPersistentManifold const * const pManifold = pDispatcher->getManifoldByIndexInternal( manifoldInd ); assert( manifold ); // get colliding bodies btRigidBody const * const pBody0 = static_cast<btRigidBody const *>(pManifold->getBody0()); btRigidBody const * const pBody1 = static_cast<btRigidBody const *>(pManifold->getBody1()); ... [/CODE] So you acquired pointers to your colliding bodies. The next thing you want to do is: make an external list of colliding pairs of objects and update it every frame. So you can compare if the pair of colliding objects is already in the list, so you have continuous contact, otherwise they are just collided. Other data about collision you can get from [url="http://bulletphysics.com/Bullet/BulletFull/classbtPersistentManifold.html"]btPersistentManifold [/url]object. For keeping material data of the object you can create external wrapper for every physics body like: [CODE] struct PhysicsBody { btRigidBody const * const pBody; enum Material m_Mat; }; [/CODE]
  8. Usually every physics engine has full documentation how to use it. If you want to really know how physics engines work I would recommend [url="http://www.amazon.com/Game-Physics-Engine-Development-Second/dp/0123819768"]this book[/url].
  9. DX11

    I cannot see any problem right now, but you can check exact value of 'r' after executing this function. It contains value that can point you to an error. Take a look [url="http://msdn.microsoft.com/ru-ru/library/windows/desktop/aa378137(v=vs.85).aspx"]here[/url].
  10. You can download sdk from [url="http://www.microsoft.com/en-us/download/details.aspx?id=6812"]here[/url] . It includes everything you need for directx programming(9, 10, 11);
  11. One of the approaches is to make two more render passes for your scene. The first new one would render to texture everything from the camera which is located in the sky. In the second new render pass you render this texture to the place on the screen you want.
  12. Indeed, it would have helped to find error in my program faster. Now, i create device with debug layer enabled in debug mode;) I appreciate your explanation. By the way, i managed to rapair my shader to work correctly. It suffered the same problem, I didn't unbound first texture's RTV before binding resource as SRV in the Compute Shader
  13. Setting NULL UAV for the place of UAV of my texture helped! Before that, i tried to set the compute shader itself to NULL, it didn't help me. My gaussian filter still does't worked corretly, but I think I can handle it as the main problem solved:) Thanks for your help!
  14. Yep, I heard that to read and write simultaneously I need to cast format to D3D11_FORMAT_R32_UINT for UAV... But I don't read and write to the resource at the same time. 1)For the first render pass i don't use the second texture at all. 2)Than in Compute Shader I use the first texture for reading (shader resource view) and the second one for writing (unordered access view). 3)Final pass: I use the second texture for reading as shader resource view Or maybe i misunderstand something ...
  15. Hi, guys! I'm trying to implement Gaussian Filter using compute shader. I have two texture resources. Firstly, I render entire scene to the first texture. Then I apply gaussian filter for this texture using compute shader( which writes results to the second texture). And finally, i use shader resource view of the second texture in final render pass (pixel shader just executes texture.Sample). But as result i just get black screen:( Initialize textures and their resource views: [CODE] //Texture used for rendering ID3D11Texture2D* renderTargetTexture; ID3D11RenderTargetView* renderTargetTextureView; ID3D11ShaderResourceView* shaderRenderTextureView; //texture to which result of gaussian filter will be applied ID3D11Texture2D* gaussTexture; ID3D11UnorderedAccessView* gaussTextureUAView; ID3D11ShaderResourceView* gaussTextureSRView; ID3D11RenderTargetView* gaussTextureRTView; /***** Create Texture Render Target View *****/ D3D11_TEXTURE2D_DESC textureDesc; D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; D3D11_SHADER_RESOURCE_VIEW_DESC shaderResourceViewDesc; //create render texture ZeroMemory(&amp;textureDesc, sizeof(D3D11_TEXTURE2D_DESC)); textureDesc.Width = textureWidth; textureDesc.Height = textureHeight; textureDesc.MipLevels = 1; textureDesc.ArraySize = 1; textureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; textureDesc.SampleDesc.Count = 1; textureDesc.Usage = D3D11_USAGE_DEFAULT; textureDesc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE; textureDesc.CPUAccessFlags = 0; textureDesc.MiscFlags = 0; hr = d3d11Device->CreateTexture2D(&amp;textureDesc, NULL, &amp;renderTargetTexture); if (FAILED(hr)) return false; //create render target view renderTargetViewDesc.Format = textureDesc.Format; renderTargetViewDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; renderTargetViewDesc.Texture2D.MipSlice = 0; hr = d3d11Device->CreateRenderTargetView(renderTargetTexture, &amp;renderTargetViewDesc, &amp;renderTargetTextureView); if (FAILED(hr)) return false; //create shader resource view shaderResourceViewDesc.Format = textureDesc.Format; shaderResourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; shaderResourceViewDesc.Texture2D.MostDetailedMip = 0; shaderResourceViewDesc.Texture2D.MipLevels = 1; hr = d3d11Device->CreateShaderResourceView(renderTargetTexture, &amp;shaderResourceViewDesc, &amp;shaderRenderTextureView); if (FAILED(hr)) return false; /*** GAUSSIAN TEXTURE ***/ D3D11_TEXTURE2D_DESC gtDesc; D3D11_SHADER_RESOURCE_VIEW_DESC srView; D3D11_UNORDERED_ACCESS_VIEW_DESC uaDesc; D3D11_RENDER_TARGET_VIEW_DESC rtDesc; //create gauss texture ZeroMemory(&amp;gtDesc, sizeof(gtDesc)); gtDesc.Width = textureWidth; gtDesc.Height = textureHeight; gtDesc.MipLevels = 1; gtDesc.ArraySize = 1; gtDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; gtDesc.SampleDesc.Count = 1; gtDesc.Usage = D3D11_USAGE_DEFAULT; gtDesc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET; gtDesc.CPUAccessFlags = 0; gtDesc.MiscFlags = 0; hr = d3d11Device->CreateTexture2D(&amp;gtDesc, NULL, &amp;gaussTexture); if (FAILED(hr)) return false; //create render target view rtDesc.Format = gtDesc.Format; rtDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; rtDesc.Texture2D.MipSlice = 0; hr = d3d11Device->CreateRenderTargetView(gaussTexture, &amp;rtDesc, &amp;gaussTextureRTView); if (FAILED(hr)) return false; //create shader resource view srView.Format = gtDesc.Format; srView.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; srView.Texture2D.MostDetailedMip = 0; srView.Texture2D.MipLevels = 1; hr = d3d11Device->CreateShaderResourceView(gaussTexture, &amp;srView, &amp;gaussTextureSRView); if (FAILED(hr)) return false; //create unordered access view uaDesc.Format = gtDesc.Format; uaDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D; uaDesc.Texture2D.MipSlice = 0; hr = d3d11Device->CreateUnorderedAccessView(gaussTexture, &amp;uaDesc, &amp;gaussTextureUAView); if (FAILED(hr)) return false; [/CODE] Now render entire scene to the first texture: [CODE] float bgTexColor[4] = {(1.0f, 0.0f, 0.0f, 1.0f)}; //default color is red! d3d11DevCon->VSSetShader(VS, 0, 0); d3d11DevCon->PSSetShader(PS, 0, 0); d3d11DevCon->RSSetViewports(1, &amp;texViewport); d3d11DevCon->OMSetRenderTargets(1, &amp;renderTargetTextureView, NULL); d3d11DevCon->ClearRenderTargetView(renderTargetTextureView, bgTexColor); d3d11DevCon->Draw(36, 0); //draw the cube [/CODE] Apply gaussian filter: [CODE] d3d11DevCon->CSSetShader(CS, 0, 0); d3d11DevCon->CSSetShaderResources(0, 1, &amp;shaderRenderTextureView); //bind out rendered scene as shader resource view d3d11DevCon->CSSetUnorderedAccessViews(0, 1, &amp;gaussTextureUAView, NULL); //unordered access for resulting texture! UINT x = (UINT)( ceil( textureWidth / 32.0f ) ); UINT y = (UINT)( ceil( textureHeight / 32.0f ) ); d3d11DevCon->Dispatch(x, y, 1); [/CODE] Finally, render our final texture to the screen (in pixel shader i just use texture.Sample) : [CODE] d3d11DevCon->VSSetShader(textureVS, 0, 0); d3d11DevCon->PSSetShader(texturePS, 0, 0); d3d11DevCon->RSSetViewports(1, &amp;viewport); d3d11DevCon->OMSetRenderTargets(1, &amp;renderTargetView, NULL); //back buffer now is render target d3d11DevCon->PSSetShaderResources(0, 1, &amp;gaussTextureSRView); d3d11DevCon->Draw(6, 0); [/CODE] Oh, by the way, here is my compute shader: [CODE] //Resources Texture2D<float4> InputTex : register( t0 ); RWTexture2D<float4> OutputTex : register( u0 ); //filter kernel coefficients static const float kernel[7][7] = { 0.000904706, 0.003157733, 0.00668492, 0.008583607, 0.00668492, 0.003157733, 0.000904706, 0.003157733, 0.01102157, 0.023332663, 0.029959733, 0.023332663, 0.01102157, 0.003157733, 0.00668492, 0.023332663, 0.049395249, 0.063424755, 0.049395249, 0.023332663, 0.00668492, 0.008583607, 0.029959733, 0.063424755, 0.081438997, 0.063424755, 0.029959733, 0.008583607, 0.00668492, 0.023332663, 0.049395249, 0.063424755, 0.049395249, 0.023332663, 0.00668492, 0.003157733, 0.01102157, 0.023332663, 0.029959733, 0.023332663, 0.01102157, 0.003157733, 0.000904706, 0.003157733, 0.00668492, 0.008583607, 0.00668492, 0.003157733, 0.000904706 }; [numthreads(32, 32, 1)] void CS(uint3 DispatchThreadId : SV_DispatchThreadID) { //get coordinates of top left corner int3 textureCoords = DispatchThreadId - int3(3, 3, 0); //initialize final color float4 finalColor = (float4)0.0f; //loop through filter kernel getting final color for (int i = 0; i < 7; i++) for (int j = 0; j < 7; j++) finalColor += InputTex.Load(textureCoords + int3(i, j, 0) ) * kernel[i][j]; //assign new color value to the output image OutputTex[DispatchThreadId.xy] = finalColor; //OutputTex[DispatchThreadId.xy] = float4(1.0f, 1.0f, 1.0f, 1.0f); } [/CODE] Why I think that the problem is with Unordered Access View? I tried to clear gaussTexture with red color after the compute shader has executed: [CODE] float bgTexColor[4] = {(1.0f, 0.0f, 0.0f, 1.0f)}; d3d11DevCon->ClearRenderTargetView(gaussTextureRTView, bgTexColor); [/CODE] And i still get the black screen. But if I comment binding the unordered access to the compute shader I get what I should get - the red screen: [CODE] //d3d11DevCon->CSSetUnorderedAccessViews(0, 1, &amp;gaussTextureUAView, NULL); //unordered access for resulting texture! [/CODE] I'm pretty sure that compute shader itself works correctly as commenting Dispatch call without commenting CSSetUnorderedAccessViews still suffers the problem and I get only black screen. Where the problem can be? I would appreciate any help! Thanks in advance!