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

TheResolute

Members
  • Content count

    31
  • Joined

  • Last visited

Community Reputation

187 Neutral

About TheResolute

  • Rank
    Member
  1. Thank you for your help, I realized that I never called PSSetConstantBuffers(), so I fixed that and now everything is fine
  2. I am using a constant buffer to transfer data to my pixel shader The problem is that the buffer contains 0s in the shader during runtime for x, y, z, and w of the float4 member, regardless of what data is updated to the buffer Structure definitions are as follows:   // (C++) struct Buffer {     XMMATRIX mvp_;     XMFLOAT4 rgba_;     int usemvp_; }; // HLSL cbuffer Buffer : register( b0 ) {     matrix mvp_;     float4 rgba_;     int usemvp_; };      Any help is much appreciated
  3. Thank you for these clarifications so far, and I would like to note that I asked this exact question on Stack Overflow and watched it be mocked and closed within minutes. Kudos to the GameDev.net community!
  4. I see a lot of comments about how writing code in something like C# is faster than C++, and I fail to understand why. This has nothing to do with performance of applications; simply the difference in taking say 3 weeks to develop in a certain language and 6 in another. Also, I am really just concerned with mainstream languages such as C#, C++, VB, Java, Lua, Python, etc. Is it just about compile time, which seems to be the reason that developing in a scripting language is faster than a compiled one? Does it have to do with memory management and garbage collection, because it just takes forever to remember to delete your pointers? Possibly it involves inherent access to libraries or functions such as the printf("") in Python as compared to cout << "" in C++, is that the case? Basically, I am trying to understand why the general consensus seems to be that writing code in C# (for example) is better than writing code in C++ (for example), but the performance of that running code is worse.
  5. [quote name='EngineProgrammer' timestamp='1346358883' post='4974911'] Won't work. So you have 30 enemies. Let us say I have killed the 2nd, 4th, 6th one. So 27 enemies left. the rand() seeder will only give me a number from 0-27. Meaning, if I get the number 0, 4, 6 those enemies will try to shoot but they are dead.. Also means the last 3 enemies will never be able to shoot a bullet. [/quote] You must have misread the code or I made a mistake, but it is not accessing the array using the random number as an index, it is iterating through the array and every time an enemy is alive, it decrements its counter and if the counter is zero, meaning that this enemy is the nth living one, it will then have it shoot
  6. EngineProgrammer provided a nice solution Something far more simple would be to: keep track of how many enemies are alive (variable initialized with number of enemies and decremented each time one dies); using the same process he described to do this at certain intervals: generate a random number using the number of living enemies as your cap, and iterate through your enemies array, skipping dead ones, while decrementing the random number, and have the enemy shoot when your random number is 0 Hope that makes sense [img]http://public.gamedev.net//public/style_emoticons/default/biggrin.png[/img] Some pseudo code could help: [CODE]int totalEnemies = 30; int livingEnemies = totalEnemies; Enemy[30] enemies; // in code region dealing with enemy death livingEnemies--; // // on iterval for enemy to shoot if(livingEnemies > 0) { int randNum = Math.Rand(0, livingEnemies); // generates a random integer between bounds, lower exclusive, upper inclusive for(int i = 0; i < totalEnemies; i++) { if(enemies[i].isAlive) { randNum--; if(randNum == 0) { // Enemy shoots } } } } // [/CODE]
  7. Please include some more detail about your problem to be clear However, I will attempt to help at this point based on what I think is happening If your sprite normally moves around by player input or AI or something like that, all you would have to do is: add a isPlayingAnimation variable to your code an relate it to your sprite somehow; add a statement to the code that begins an animation to set that variable to true; and include a condition in its movement code that checks whether it is playing an animation, and doesn't execute movement if it is Another thing that occurred to me is that your is constantly on an animation loop, and you want to stop it during a certain part of that animation; in that case, you would add a counter to its movement code that increments every frame, is reset when the animation restarts, and then a condition to the code that prevents movement when the counter is in a certain range Hopefully you will find at least some of that helpful
  8. It really depends on what level of "computer gaming creation" you are interested in Being able to make your ideas a reality can be fairly straightforward, depending on how complex they are, here are a few options: Downloading a copy of [url="http://www.yoyogames.com/"]GameMaker[/url] (you will probably want the Lite version, it's free) and tinkering with that. It will produce 2D games only and has a graphical user interface, as well some scripting capacity, which you can but likely will not need to take advantage of. This is the best option in, in my opinion, to create games quickly and easily Acquiring a more powerful engine like Unity you mentioned. This would allow you to create 3D games but requires more time and energy to learn and use Learning a programming language like Python and finding some sort of graphics library to use with it (I believe Python has one built in or at least readily available). This will require a significant amount of effort to do a limited amount of creating. Although it will give you the most power and control over your games, and you may prefer if you don't like dealing with the user interfaces of the graphical environments However; if you want a career in the industry, then you have a much more complicated process ahead of you that will probably involve some college In that case, you should acquaint yourself with programming by learning a simpler language like Python, and then learn C++ probably followed by DirectX or OpenGL For this point, I am not really certain about my suggestions so you should consult other sources
  9. [color=#000000][font=Arial,] Turns out, and you'll notice this with those code samples, that I (in my infinite incompetence) do not set the correct vertex shader or buffer for drawing the entire texture2d to the back buffer[/font][/color][color=#000000][font=Arial,] So, it used the last set vertex buffer (the one used to to draw the last thing rendered to the texture XD ) when it rendered the texture to the back buffer. This created the effect that I believed to be the texture2d being replaced by whatever was rendered to it[/font][/color][color=#000000][font=Arial,] There you have it, just some silly little semantic error[/font][/color][color=#000000][font=Arial,] Thank you all for trying to help[/font][/color]
  10. [quote name='DJTN' timestamp='1336077544' post='4937205'] Off the top of my head: You could be clearing the target before rendering the next iteration. Your blending operations could be wrong. If you're using shaders, the shader might not be updated with the new data on the next draw call. Or there is an issue with your loop that draws. Use PIX to debug so you can pin point where the issue is happening in code. [/quote] That PIX piece is an excellent suggestion I'll have to figure that out and it might just be awesome so thank you
  11. Here's the setup: [CODE] // Lighting ZeroMemory( &blendDesc, sizeof( blendDesc ) ); blendDesc.RenderTarget[0].BlendEnable = TRUE; blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_DEST_COLOR; blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_ZERO; blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; d3dDevice_->CreateBlendState( &blendDesc, &lightingBlendState_ ); float blendFactor[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; // Light map and render target view DXGI_SAMPLE_DESC sampleDesc = { 1, 0 }; D3D11_TEXTURE2D_DESC texDesc = { 1024, 768, 1, 1, DXGI_FORMAT_R32G32B32A32_FLOAT, sampleDesc, D3D11_USAGE_DEFAULT, D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE, NULL, NULL }; d3dDevice_->CreateTexture2D( &texDesc, NULL, ( ID3D11Texture2D** )&lightMap_ ); D3D11_RENDER_TARGET_VIEW_DESC renderDesc = { DXGI_FORMAT_R32G32B32A32_FLOAT, D3D11_RTV_DIMENSION_TEXTURE2D, { 0 }, }; d3dDevice_->CreateRenderTargetView( lightMap_, &renderDesc, &lightMapTarget_ ); D3D11_SHADER_RESOURCE_VIEW_DESC resourceDesc = { DXGI_FORMAT_R32G32B32A32_FLOAT, D3D11_SRV_DIMENSION_TEXTURE2D, 0, 1 }; d3dDevice_->CreateShaderResourceView( lightMap_, &resourceDesc, &lightMapResource_ ); [/CODE] And here's the render: [CODE] d3dContext_->OMSetRenderTargets( 1, &lightMapTarget_, NULL ); colorMap = dxiSprites_[kBlackSprite].GetShaderResourceView( ); d3dContext_->PSSetShaderResources( 0, 1, &colorMap ); spritePtr = 0; HRESULT d3dResult = d3dContext_->Map( vertexBufferText_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapResource ); spritePtr = ( VertexPos* )mapResource.pData; spritePtr[0].pos = XMFLOAT3( 1, -1, 0 ); spritePtr[1].pos = XMFLOAT3( -1, -1, 0 ); spritePtr[2].pos = XMFLOAT3( -1, 1, 0 ); spritePtr[3].pos = XMFLOAT3( -1, 1, 0 ); spritePtr[4].pos = XMFLOAT3( 1, 1, 0 ); spritePtr[5].pos = XMFLOAT3( 1, -1, 0 ); spritePtr[0].tex0 = XMFLOAT2( 1, 0 ); spritePtr[1].tex0 = XMFLOAT2( 0, 0 ); spritePtr[2].tex0 = XMFLOAT2( 0, 1 ); spritePtr[3].tex0 = XMFLOAT2( 0, 1 ); spritePtr[4].tex0 = XMFLOAT2( 1, 1 ); spritePtr[5].tex0 = XMFLOAT2( 1, 0 ); d3dContext_->Unmap( vertexBufferText_, 0 ); d3dContext_->Draw( 6, 0 ); stride = sizeof( VertexPos ); offset = 0; d3dContext_->IASetInputLayout( inputLayout_ ); d3dContext_->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST ); d3dContext_->VSSetShader( solidColorVS_, 0, 0 ); d3dContext_->PSSetShader( solidColorPS_, 0, 0 ); d3dContext_->PSSetSamplers( 0, 1, &colorMapSampler_ ); for( int i = kNumberOfSprites; i < kNumberOfLights + kNumberOfSprites; i++ ) { ID3D11Buffer* vertexBuffer = dxiSprites_[i].GetVertexBuffer( ); ID3D11ShaderResourceView* colorMap = dxiSprites_[i].GetShaderResourceView( ); d3dContext_->IASetVertexBuffers( 0, 1, &vertexBuffer, &stride, &offset ); d3dContext_->PSSetShaderResources( 0, 1, &colorMap ); if( i == kDarknessLight ) { XMFLOAT2 pos = XMFLOAT2( 0.0f, 0.0f ); XMMATRIX world = dxiSprites_[i].CreateAWorldMatrix( pos, ( 360.0f - 0 ) * 0.0174532925f, XMFLOAT2( 1, 1 ) ); XMMATRIX mvp = XMMatrixMultiply( world, vpMatrix_ ); mvp = XMMatrixMultiply( mvp, XMMatrixTranslation( 512 / ( kWindowWidth / 2 ), 384 / ( kWindowHeight / 2 ), 0.0f ) ); mvp = XMMatrixTranspose( mvp ); d3dContext_->UpdateSubresource( mvpCB_, 0, 0, &mvp, 0, 0 ); d3dContext_->VSSetConstantBuffers( 0, 1, &mvpCB_ ); d3dContext_->Draw( 6, 0 ); } for( int j = 0; j < drawData->spriteDataLength; j++ ) { if( drawData->spriteData[j].index == kFlagshipSprite ) { XMFLOAT2 pos = XMFLOAT2( 0.0f, 0.0f ); XMMATRIX world = dxiSprites_[i].CreateAWorldMatrix( pos, ( 360.0f - drawData->spriteData[j].rotation ) * 0.0174532925f, drawData->spriteData[j].scale ); XMMATRIX mvp = XMMatrixMultiply( world, vpMatrix_ ); mvp = XMMatrixMultiply( mvp, XMMatrixTranslation( drawData->spriteData[j].position.x / ( kWindowWidth / 2 ), drawData->spriteData[j].position.y / ( kWindowHeight / 2 ), 0.0f ) ); mvp = XMMatrixTranspose( mvp ); d3dContext_->UpdateSubresource( mvpCB_, 0, 0, &mvp, 0, 0 ); d3dContext_->VSSetConstantBuffers( 0, 1, &mvpCB_ ); d3dContext_->Draw( 6, 0 ); } } } d3dContext_->OMSetRenderTargets( 1, &backBufferTarget_, NULL ); d3dContext_->OMSetBlendState( lightingBlendState_, blendfactor, 0xFFFFFFFF ); d3dContext_->PSSetShaderResources( 0, 1, &lightMapResource_ ); d3dContext_->Draw( 6, 0 ); [/CODE] The first chunk of that fills the texture with darkness (black) Then the second bit draws all the lighting sprites (usually white circles), and a darkness sprite Darkness is drawn twice for debugging reasons, indicating that regardless of what's in the texture, it's replaced when a new Draw call is made And the last piece draws the texture to the existing rendered frame with the correct blend state Thanks in advance for any help
  12. Any help at all would be greatly appreciated
  13. You would need to have some type of hardware device capable of that in the first place, which is by far the most challenging aspect of your design If you are unable to find such a device you might be able to substitute a microphone, which has been done to detect the player blowing on something It would probably be supported by DirectX if it did exist, in which case you could check out the documentation as to how to collect input from it The process is not terribly complicated, as you can see here: [url="http://msdn.microsoft.com/en-us/library/windows/desktop/ee416842(v=vs.85).aspx"]http://msdn.microsoft.com/en-us/library/windows/desktop/ee416842(v=vs.85).aspx[/url]
  14. Hello there, I have a 2D lighting engine that renders the game scene to the back buffer, renders the lighting map to a texture, and then renders the texture to the back buffer with a blend state The issue I'm encountering is that every time I make a Draw call when rendering a light to be added to the light map, it completely replaces all data in the texture including its width and height For example, let's say I make Draw call that will fill the entire light map texture with black, when I make another Draw call to render a light sprite to the texture, the entire texture is replaced by that single sprite and it also resizes as well There is the possibly that this is not actually what is occurring, but all evidence from a fair amount of testing indicates this What I'd like to do is render my lighting sprites to my light map texture just like I would render my object sprites to the back buffer, in that each successive Draw call only adds the new sprite on top of whatever else was there and only replaces certain pixels I do not believe this is a blend state issue because I use the same one for rendering to the back buffer and the light map, and the back buffer rendering works just fine Please provide an explanation as to what is going on and how to make this process function as I've described Thanks
  15. Microsoft did not document certain aspects of DirectX very well, apparently this was one of them That is an absolutely brilliant explanation, it made a world of difference And no one else offered it, not the DX documentation or even a Google search for "D3D11 blend state" I am good to go now, knowing that tiny piece that the blend state [i]multiplies [/i]those things by their corresponding assignments I was under the impression that those BlendSrc and BlendDest values [i]were the data themselves [/i]XD Thank you so much for you help, I really appreciate it