• 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

284 Neutral

About littletray26

  • Rank

Personal Information

  • Location
  1. I'm not sure I would even know where to begin with that. I wouldn't know how to interact with hardware without using Direct3D functions.   I think that would be putting me way over my head for now, and that I should probably just stick with trying to learn how to use Direct3D properly.    What do you think?
  2. Hi GameDev community, it's been a while!   I've been doing hobby game programming for a few years now, but I feel like considering how long I've been doing it for, I am nowhere near as fluent with it as I should be.   I learned all that I know about DirectX 9 programming from www.directxtutorial.com and while I feel that was a decent start, I feel like I've missed learning a lot of things that is therefore limiting my ability to program. I've been able to make basic games in the past with not much of an issue, but now I decided to take on my biggest personal project so far, which is nothing huge, just a Doom-style FPS, and I'm quickly finding that I'm on the internet looking for help on things that I feel I should already know how to do.   That said, I'm wondering if anyone here can point me to a good resource (website/book/anything) on learning to program in DirectX properly. I had a look through the documentation that ships with the DXSDK but it doesn't make a lot of sense to me.  I need something that will start with the basics again, and not only tell me what to do but explain /why/ it works that way so that I can retain the information without it just being a bunch of jargon.   I'm still using Direct3D 9 functions, I've been meaning to learn Direct3D 11 functions but looking over it briefly it seems a lot more complex and I've been putting it off because of that.   So my questions are as follows:   -Do I need to learn to use 9 effectively before migrating to 11? -What is a good resource to start learning to program in DirectX effectively and know what I'm actually doing?   Thanks in advance.
  3. Hey GameDev   I'm trying to lock an LPD3DXMESH's vertex buffer so as I can fiddle with the vertices. My problem is that as follows:   When you manually create a mesh in code, you have your own CUSTOMVERTEX kind of struct, and then when you lock the vertex buffer, you can hand it a void pointer to your CUSTOMVERTEX type. EG CUSTOMVERTEX* vert; vb->Lock(0, 0, (void**)&vert, NULL); But when I need to lock the meshs vertex buffer, I don't have a vertex class to lock it with.   So my question is, how do I lock the mesh vertex buffer when I don't have a vertex struct? Is there a kind of default vertex stuct I can use?
  4. I'm not sure I understand the question to begin with
  5. Yeah, I know how to do bounding sphere collision detection, sorry if my question wasn't worded right. I was just wondering why this may be preferrable to a bounding box or cylinder which could be closer to the size of the player then a sphere
  6. Hey Gamedev    I will shortly be making up some terrain for my game. How I do this, I'm yet to decide between a static mesh, or a heightmap.   I have 2 questions;   First of all, what is the best/the simplest/easiest/whatever gets the job done/ way to detect collision between the character, and the terrain. I don't want the player "snapped" onto the terrain, so I don't want him to glide up massive slopes. How would I go about doing this? Detecting the collision and offsetting the characters y position accordingly?   My second question is, I constantly hear people using bounding spheres for player collision. Why is this? It seems to me that a bounding box or cylinder would be more accurate (unless the player was a fatty) why use a sphere?
  7. I was able to fix the issue by using D3DXMatrixRotationY instead of D3DXMatrixRotationAxis in the Yaw function. Thanks, guys.
  8. Hey GameDev :)   My first person camera is rolling when I move the mouse in circles. I don't know what's wrong with it, please help me. void Pitch(float angle) { D3DXMATRIX T; D3DXMatrixRotationAxis(&T, &right, angle); D3DXVec3TransformCoord(&up, &up, &T); D3DXVec3TransformCoord(&lookDirection, &lookDirection, &T); } void Yaw(float angle) { D3DXMATRIX T; D3DXMatrixRotationAxis(&T, &up, angle); D3DXVec3TransformCoord(&lookDirection, &lookDirection, &T); D3DXVec3TransformCoord(&right, &right, &T); }
  9. Thank you so much. I don't know why I didn't think of this, I just assumed that because I didn't have to do it in 3D transformations, I wouldn't have to for this.    Thank you :)
  10. Hey GameDev   I've 2 sprites, an enemy and a guy, and I'm trying to rotate guy, but not enemy:   void Draw(LPD3DXSPRITE sprite, LPDIRECT3DDEVICE9 d3dDevice) { sprite->Draw(texture, &enemy, &D3DXVECTOR3(0, 0, 0), &D3DXVECTOR3(400, 400, 0), D3DCOLOR_ARGB(255,255,255,255)); sprite->SetTransform(&matrix); sprite->Draw(texture, &guy, &D3DXVECTOR3(0, 0, 0), &guyPosition, D3DCOLOR_ARGB(255,255,255,255)); }     Problem is it rotates both of them, and I don't know why. Help?
  11. So I've been looking for a way to get a sprite to rotate and face my cursor, and I came across this:     Now I understand that it works, but I'm wondering if one of you fine people can help me understand why it works. I'm not that great at  math, but I take every chance I can to improve. I need to understand the concept behind tan, and inverse tan, so I can apply it to any other problems I might face that would require it.   Thanks   Just to clarify, I know what tan is. Tan = opposite / adjacent. I know you feed tan the angle, and it returns o/a but why is o/a needed? What is it used for? and I don't know what inverse tan is at all.
  12. Ah thank you so much! 
  13.   Thank you very much. If it helps I can post the full source code;   main.h   #include <Windows.h> #include <d3d9.h> #include <d3dx9.h> #include <ctime> #include <iostream>   #pragma comment (lib, "d3d9.lib") #pragma comment (lib, "d3dx9.lib") #pragma comment (lib, "winmm.lib")   #ifndef once   const int WINDOWWIDTH = 800; const int WINDOWHEIGHT = 600;   int Clamp(int value, int min, int max) { if (value < min) return min; else if (value > max) return max;   else return value; }   bool IsCollide(RECT a, RECT b) { if (a.left < b.right && a.right > b.left) if (a.top < b.bottom && a.bottom > b.top) return true; return false; }   class Player { private: int points; int paddleSpeed; int paddleWidth; int paddleHeight; D3DXVECTOR3 position; RECT collisionBox; RECT textureBox;   public: void Draw(LPD3DXSPRITE sprite, LPDIRECT3DTEXTURE9 texture); void Update(); void GivePoints(int p); int GetPoints(); RECT GetCollisionBox();   Player(int x, int y, int xx, int yy) { textureBox.left = x; textureBox.bottom = yy; textureBox.right = xx; textureBox.top = y; paddleWidth = xx - x; paddleHeight = yy - y; points = 0; paddleSpeed = 8; position = D3DXVECTOR3((WINDOWWIDTH / 2) - (paddleWidth /2), (WINDOWHEIGHT - paddleHeight - 10), 0); } };   int Player::GetPoints() { return points; }   RECT Player::GetCollisionBox() { return collisionBox; }   void Player::Draw(LPD3DXSPRITE sprite, LPDIRECT3DTEXTURE9 texture) { sprite->Draw(texture, &textureBox, &D3DXVECTOR3(0, 0, 0), &position, D3DCOLOR_ARGB(255, 255, 255, 255)); }   void Player::Update() { collisionBox.bottom = position.y + paddleHeight; collisionBox.left = position.x; collisionBox.right = position.x + paddleWidth; collisionBox.top = position.y;   if(GetAsyncKeyState(VK_LEFT)) position.x -= paddleSpeed; else if(GetAsyncKeyState(VK_RIGHT)) position.x += paddleSpeed;   position.x = Clamp(position.x, 0, WINDOWWIDTH - paddleWidth); }   void Player::GivePoints(int p) { points += p; }   class Ball { private: RECT collisionBox; RECT textureBox; D3DXVECTOR3 position; D3DXVECTOR2 velocity; int ballSpeed; int ballWidth; int ballHeight;   public: RECT GetCollisionBox(); void Draw(LPD3DXSPRITE sprite, LPDIRECT3DTEXTURE9 texture); void Update(RECT* playerCollision, int players);   Ball(int x, int y, int xx, int yy) { textureBox.bottom = yy; textureBox.left = x; textureBox.right = xx; textureBox.top = y; ballSpeed = 2; ballWidth = xx - x; ballHeight = yy - y; position.x = (WINDOWWIDTH / 2) - (ballWidth / 2); position.y = (WINDOWHEIGHT / 2) - (ballHeight / 2); //velocity = D3DXVECTOR2(rand() % ballSpeed + -ballSpeed, ballSpeed); } };   RECT Ball::GetCollisionBox() { return collisionBox; }   void Ball::Draw(LPD3DXSPRITE sprite, LPDIRECT3DTEXTURE9 texture) { sprite->Draw(texture, &textureBox, &D3DXVECTOR3(0, 0, 0), &position, D3DCOLOR_ARGB(255,255,255,255)); }   void Ball::Update(RECT* playerCollision, int players) { //position.x += velocity.x; //position.y += velocity.y;   collisionBox.bottom = position.y + ballHeight; collisionBox.left = position.x; collisionBox.right = position.x + ballWidth; collisionBox.top = position.y;   for (int i = 0; i < players; i++) { if (IsCollide(playerCollision[i], collisionBox)) velocity.y *= -1; }   if (position.x < 0) velocity.x *= -1; else if (position.x > WINDOWWIDTH - ballWidth) velocity.x *= -1;   if (position.y < 0) velocity.y *= -1; }   class Brick { };   #define once #endif   gameskel.h   #include "main.h"   LPDIRECT3DTEXTURE9 sprites; Player* players; Ball* balls;   void LoadContent(LPDIRECT3DDEVICE9* d3dDevice) { D3DXCreateTextureFromFile(*d3dDevice, L"resources\\graphics\\sprites.png", &sprites); players = new Player(0, 0, 114, 13); balls = new Ball(116, 0, 128, 13); }   void Update(DWORD delta) { players->Update(); balls->Update(&players->GetCollisionBox(), 1); }   void Draw(LPD3DXSPRITE sprite) { balls->Draw(sprite, sprites); players->Draw(sprite, sprites); }   void Cleanup() { sprites->Release(); delete[] players; delete[] balls; }   WinMain.cpp   //Winmain cpp #include "main.h" #include "gameskel.h"   LPDIRECT3D9 d3d; LPDIRECT3DDEVICE9 d3dDevice; LPD3DXSPRITE spriteMachine;   LPARAM CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); void InitializeD3D(HWND hWnd); void Pulse(DWORD delta); void KillD3D();   int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { srand(time(0));   HWND hWnd; WNDCLASSEX wc; DWORD delta = 0; DWORD prevFrameTime = 0; DWORD thisFrameTime = 0;   ZeroMemory(&wc, sizeof(WNDCLASSEX)); wc.cbSize = sizeof(WNDCLASSEX); wc.hbrBackground = (HBRUSH)COLOR_WINDOW; wc.hCursor = LoadCursor(0, IDC_ARROW); wc.lpfnWndProc = WndProc; wc.hInstance = hInstance; wc.lpszClassName = L"WINDOW"; wc.style = CS_HREDRAW | CS_VREDRAW;   RegisterClassEx(&wc);   hWnd = CreateWindowEx( NULL, L"WINDOW", L"Smashout!", WS_OVERLAPPED | WS_CAPTION | WS_MINIMIZEBOX | WS_SYSMENU, 400, 300, WINDOWWIDTH, WINDOWHEIGHT, NULL, NULL, hInstance, NULL);   ShowWindow(hWnd, nShowCmd);   MSG msg = {0}; InitializeD3D(hWnd);   while (true) { thisFrameTime = timeGetTime();   if(prevFrameTime != 0) delta = thisFrameTime - prevFrameTime; else delta = 0;   prevFrameTime = thisFrameTime;   if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg);   if (msg.message == WM_QUIT) break; }   Pulse(delta); }   KillD3D(); return msg.wParam; }   LPARAM CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_DESTROY: { PostQuitMessage(0); return 0; break; } }   return DefWindowProc(hWnd, msg, wParam, lParam); }   void InitializeD3D(HWND hWnd) { d3d = Direct3DCreate9(D3D_SDK_VERSION); D3DPRESENT_PARAMETERS d3dPP;   ZeroMemory(&d3dPP, sizeof(D3DPRESENT_PARAMETERS)); d3dPP.BackBufferWidth = WINDOWWIDTH; d3dPP.BackBufferHeight = WINDOWHEIGHT; d3dPP.BackBufferCount = 1; d3dPP.hDeviceWindow = hWnd; d3dPP.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dPP.Windowed = true;   d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dPP, &d3dDevice); D3DXCreateSprite(d3dDevice, &spriteMachine);   LoadContent(&d3dDevice); }   void Pulse(DWORD delta) { Update(delta); d3dDevice->Clear(0, 0, D3DCLEAR_TARGET, 0x427AFF, 1, 0); d3dDevice->BeginScene(); spriteMachine->Begin(D3DXSPRITE_ALPHABLEND);   Draw(spriteMachine);   spriteMachine->End(); d3dDevice->EndScene(); d3dDevice->Present(NULL, NULL, NULL, NULL); }   void KillD3D() { Cleanup(); spriteMachine->Release(); d3dDevice->Release(); d3d->Release(); }
  14.   DirectX is indeed running in Debug mode, and the ball is not behind anything. I'm only drawing 2 things to the screen at the moment; the paddle, and the ball. The paddle is at the bottom of the screen, whereas the ball SHOULD be drawing to the middle. There is nothing in the way. As I said in the first post as well, if I change the code to  LPDIRECT3DTEXTURE9 sprites; Player* players; Ball ball1(116, 0, 128, 13); //changed   void LoadContent(LPDIRECT3DDEVICE9* d3dDevice) { D3DXCreateTextureFromFile(*d3dDevice, L"resources\\graphics\\sprites.png", &sprites); players = new Player(0, 0, 114, 13); }   void Update(DWORD delta) { players[0].Update(); ball1.Update(&players[0].GetCollisionBox(), 1); //changed }   void Draw(LPD3DXSPRITE sprite) { players[0].Draw(sprite, sprites); ball1.Draw(sprite, sprites); //changed }   void Cleanup() { sprites->Release(); delete[] players; }    It draws fine. So I'm confident it's not a depth issue