• 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

150 Neutral

About Guns

  • Rank
  1. You will have to keep a list of all game entities somewhere, so processed entities can look them up and (non ideally) access them themselves. There is no other way. Use an abstract entity class to reference all different entity types and to encapsulate basic functionality shared between all of them. You can use messaging in a simple form of virtual methods to handle different entity types. This is how I would do it while keeping your simple entity structure (no systems, no components, etc.). // Could be global or passed to every entity as a pointer. // Use smart pointers to hold entities instead. std::list<Entity*> entities; // Base entity class. class Entity { /* ... */ public: void Update(float delta) { this->CheckCollisions(); this->OnUpdate(delta); } virtual void Draw() { // Drawing can be done in many ways. } void CheckCollision() { for(/* every entity on the list, but yourself */) { ? if(/* check if collides */) { this->OnCollision(other); } } } void Damage(int damage) { // Substract damage from health and call Destroy() if it's below zero. /* ... */ // Message itself about being damaged. this->OnDamage(damage); } void Destroy() { // Mark as dead, but don't remove from the list yet. /* ... */ // Message itself about being destroyed. this->OnDestroy(); } private: virtual void OnUpdate(float delta) { } virtual void OnCollision(Entity* other) { } virtual void OnDamage(int damage) { } virtual void OnDestroy() { } private: Enum type; // Player or a ball? bool alive; float position_x; float position_y; float radius; int health; } // Player entity class. class Player : public Entity { /* ... */ public: void Draw() { // Draw a player on the screen. } private: void OnUpdate(float delta) { // Control the player entity. // And fire bullets! } void OnDamage(int damage) { // Flash on damage. } void OnDestroy() { // Create an explosion (by creating a new entity?). } } // Bullet entity class. class Bullet : public Entity { /* ... */ public: void Draw() { // Draw a bullet on the screen. } private: void OnUpdate(float delta) { // Move the bullet forward. } void OnCollision(Entity* other) { // Check if we collided with the player. // Could be done via RTTI. if(other->GetType() == ENTITY_PLAYER) { // Damage the player entity for 10 HP. other->Damage(10); // Destroy itself. this->Destroy(); } } } // Create entities. // It's sometimes useful to save a pointer to the player's entity so it can be quickly retrieved. entities.push_back(new Player(/* ... */)); entities.push_back(new Bullet(/* ... */)); // Main loop. while(true) { /* ... */ for(/* every entity */) { entity->Update(delta); entity->Draw(); } for(/* every entity */) { // Remove dead entities from the list. } } Edit: If you don't want to hold a pointer to the player, you will have to go a bit beyond this. Create a system that will let you tag or name an entity as a "player", so you can later retrieve it without manually holding a pointer to it. Example: // At entity creation. Entity* entity = new Player(); entitySystem->TagEntity(entity, "player")); // Anywhere else. Entity* player = entitySystem->GetEntityByName("player");
  2. I am guessing DirectX headers used by MinGW have D3DXMATRIXA16 removed because it's alignment was in some way done specifically for MSVC or if you use the original headers it's definition could be between "#ifdef MSVC" braces. Use D3DXMATRIX and if you want to align it do it the GCC's way.   EDIT: Got beaten by mhagain.
  3. Looks almost like Survivor Squad. I would definitely play it if it had better game mechanics than that game.
  4. You can't. You will have to expand your lines into polygons to give them thickness, which is what ID3DXLine exactly does (and bit more).
  5. As BitMaster stated, it sounds like you are (unintentionally?) using/compiling wrong version of GLEW library that supports multiple rendering contexts (internally marked with "MX" suffix).
  6. Use headers for declarations only and define in source files.   Declare this way: // Keyword "extern" basically means "declare something that's defined somewhere else". extern float SCREEN_WIDTH; extern float SCREEN_HEIGHT; extern IDXGISwapChain *swapchain; extern ID3D11Device *dev; extern ID3D11DeviceContext *devcon; Define this way: float SCREEN_WIDTH = float(GetSystemMetrics(SM_CXSCREEN)); float SCREEN_HEIGHT = float(GetSystemMetrics(SM_CYSCREEN)); // Always initialize your variables, in this case a pointer to null. IDXGISwapChain *swapchain = nullptr; ID3D11Device *dev = nullptr; ID3D11DeviceContext *devcon = nullptr; Also, you forgot a header guard in the "Graphics.h".
  7. You are recreating your vertex layout, vertex buffer and shader every time you draw. You should create resources only once at the beginning of the program. If you want to draw different set of lines every frame, check dynamic buffers.
  8. [quote name='MadrMan' timestamp='1268311135' post='4617156'] Ugh. nevermind. I forgot Nvidia doesn't support dx10.1 Changing the featurelevel to D3D_FEATURE_LEVEL_10_0 worked.. [/quote] You need 10.1 hardware to run on 10.1 feature level (which 10.0 hardware is not capable of).
  9. [quote name='striker87' timestamp='1322804862' post='4889684'] I did some searching I think I might have found the answer but please correct me if I'm wrong but I think all I will need to do is set the feature level like this: D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0 }; and that should allow the programs to run on a D3D10 or 10.1 device without having to change any other code correct? [/quote] You will also have to change shader model version from 5.0 to 4.0 when compiling shaders ("pProfile" parameter).
  10. 1. [s]Yes[/s]. If you are using Effect Framework you can call OnLostDevice() and OnResetDevice(). 2. No. Edit: Not sure on #1. I've always used Effect Framework when dealing with shaders. MSDN says "In Direct3D 9, vertex shaders and pixel shaders don't need to be re-created after reset. They will be remembered. In previous versions of DirectX, a lost device required shaders to be re-created." so when dealing directly with interfaces acquired via CreateVertexShader() and CreatePixelShader() you don't have to recreate them.
  11. Ignore Dx10. On Dx11 You have something called "feature levels" that let you run on Dx10 and Dx9 hardware (the Dx9 level is a bit more limitied compared to original Dx9). If you want to write a 2D game or a relatively simple 3D game, I would go for Dx9. Otherwise Dx11.
  12. The problem is [color="#1C2837"][size="2"][color="#000088"]class[/color] [color="#660066"]CDxDraw[/color] [color="#660066"]DxDraw[/color][/size][/color][color="#1C2837"][size="2"][color="#666600"];[/color][/size][/color] [size="2"][color="#666600"] [/color][/size] in WinMain.cpp and [color="#1C2837"][size="2"][color="#000088"]class[/color] [color="#660066"]CDxDraw[/color] [color="#660066"]DrawGame[/color][/size][/color][color="#1C2837"][size="2"][color="#666600"];[/color][/size][/color] [size="2"][color="#666600"] [/color][/size] in Game.h are two different objects. You initialize the first one but you don't initialize the second one. That's why it can't draw anything (it crashes, doesn't it?). Quick solution: Remove the first one in WinMain.cpp and move initialization [color="#1C2837"][size="2"][color="#000088"]if[/color] [color="#666600"]([/color][color="#660066"]DxDraw[/color][color="#666600"].[/color][color="#000000"]DX3DInit[/color][color="#666600"]([/color][color="#000000"]wx[/color][color="#666600"],[/color][color="#000000"] wy[/color][color="#666600"])[/color] [color="#666600"]!=[/color][color="#000000"] S_OK[/color][color="#666600"])[/color] [color="#666600"]{[/color] [color="#660066"]MessageBox[/color][color="#666600"]([/color][color="#000000"]g_hWnd[/color][color="#666600"],[/color] [color="#008800"]"Initialization error."[/color][color="#666600"],[/color] [color="#008800"]"ERROR!"[/color][color="#666600"],[/color][color="#000000"] MB_OK[/color][color="#666600"]);[/color] [color="#000088"]return[/color] [color="#006666"]0[/color][color="#666600"];[/color] [/size][/color][color="#1C2837"][size="2"][color="#666600"]}[/color][/size][/color] [size="2"][color="#666600"] [/color][/size] to the CGame class. You are creating Direct3D device in CDxDraw class, so don't initialize both at the same time. Also, debugger. // I hate formatting on those forums. : P
  13. [color="#1C2837"][size="2"][color="#000000"][color="#000000"][color="#000000"][color="#000000"]D3DXMatrixPerspectiveFovLH[/color][/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"]([/color][/color][/color][/color][color="#000000"][color="#000000"][color="#000000"] [/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"]&[/color][/color][/color][/color][color="#000000"][color="#000000"][color="#000000"][color="#000000"]matProj[/color][/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"],[/color][/color][/color][/color][color="#000000"][color="#000000"][color="#000000"][color="#000000"] D3DX_PI [/color][/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"]/[/color][/color][/color][/color][color="#000000"][color="#000000"][color="#000000"] [/color][/color][/color][color="#006666"][color="#006666"][color="#006666"][color="#006666"]4[/color][/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"],[/color][/color][/color][/color][color="#000000"][color="#000000"][color="#000000"] [/color][/color][/color][color="#006666"][color="#006666"][color="#006666"][color="#006666"]16.0[/color][/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"]/[/color][/color][/color][/color][color="#006666"][color="#006666"][color="#006666"][color="#006666"]9.0f[/color][/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"],[/color][/color][/color][/color][color="#000000"][color="#000000"][color="#000000"] [/color][/color][/color][color="#006666"][color="#006666"][color="#006666"][color="#006666"]0.0f[/color][/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"],[/color][/color][/color][/color][color="#000000"][color="#000000"][color="#000000"] [/color][/color][/color][color="#006666"][color="#006666"][color="#006666"][color="#006666"]100.0f[/color][/color][/color][/color][color="#000000"][color="#000000"][color="#000000"] [/color][/color][/color][color="#666600"][color="#666600"][color="#666600"][color="#666600"]);[/color][/color][/color][/color][/size][/color] [size="2"]Change near plane to something small but non zero. For ex. 0.1f[/size]
  14. http://www.catalinzima.com/tutorials/deferred-rendering-in-xna/ Check it out. It's in C#/XNA which I've never used before (shaders are in HLSL), but I could easily port it to Directx9 and later Directx10.