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

cloudpeter

Members
  • Content count

    14
  • Joined

  • Last visited

Community Reputation

122 Neutral

About cloudpeter

  • Rank
    Member
  1. cheers foxhunter. ill give these ago. yeah the inverse might be my problem, i wasent doing that. one other question though. i custom draw using the vertex buffer.. how can i keep the world view 0,0,0 my world is presently defined like this.. Vertex g_floorVertices[] = { // x y z tu tv { -5000.0f, 0.0f,-5000.0f, 0.0f, 0.0f,}, { -5000.0f, 0.0f, 5000.0f, 0.0f, 1000.0f,}, { 5000.0f, 0.0f,-5000.0f, 1000.0f, 0.0f,}, { 5000.0f, 0.0f, 5000.0f, 1000.0f, 1000.0f,}, }; and drawn like so g_pd3dDevice->SetTexture( 0, g_pTexture ); g_pd3dDevice->SetStreamSource( 0, g_pVertexBuffer, 0, sizeof(Vertex) ); g_pd3dDevice->SetFVF( Vertex::FVF_Flags ); g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2);
  2. hey. im trying to make a star fox clone.. how best should i approach this.. i was thinking of the following. (kind of a 3d version of the snes classic, not so much the great leap to starfox64, which is beyond my abilities at present) a) create a large quad grid, with a texture of grass for the ground (for starters). b) place a .X model as the ship. c) render some cuboid's as bulding within the world. d) then the ship would move at constant speed forward.. My main questions are the following: I can do step a+b+c but when I move the ship forward I find that either I get no movement, or possibly a flick\jerk. Or if I tweak with the code it looks like the grass plane and ship are moving foward and view(camera) is stationary.. This stems I think from a problem with the view and world matrix. I dont quite understand these in full, so most likely the prob. I thought I could just move the ship every frame along with the eye also. But this leads to the stationary effect correct? In star fox the camera works in the effect that it looks as tho the ground is streaming foward.. I was wondering can i create this effect by actually traveling this distance. Also am I correct in assuming by playing around with the far clip I can create the effect of new objects coming into view. like in star fox? this would be invisible until z=500 ex.. cuboid at 100,100,1000 if the far clip was only 500 Anyway please help.. i can also email my code if you can lend a hand, coz i dont think snippets will help..as i prob have a couple of errors.
  3. thanks for the help. yeah sorry about the organisation. im changing the code all the time, coz i cant get this part to work. hence reason code so un organised. ill move the camera etc stuff outside when i get this bit working. really only testing stuff. heres the view matrix stuff. basically i store all my game objects in a vector then run through it and call there render functions.. Appreciate the help so far void Game::render(void) { QueryPerformanceCounter(&gameTimeStart); dxLib.setViewMatrix(camera); dxLib.beginRender(); level->render(dxLib.getDevice()); for(unsigned int i=0;i<gameObjects.size();i++) { gameObjects[i]->render(dxLib.getDevice()); } hud->shipPos=pShip->getPosition(); hud->render(dxLib.getDevice()); dxLib.endRender(); QueryPerformanceCounter(&gameTimeEnd); anim_rate=((float)gameTimeEnd.QuadPart-gameTimeStart.QuadPart)/gameTimerFreq.QuadPart; }
  4. i have the following class but when i move the ship with the keys the camera just goes up and down but doesnt track the ship.. what i want to do is have a camera (3rd person) like in starfox which pans up and down smoothly with the ship up.. can anyone see the problem? i have the projection matrix setup at the beginning. and i adjust the view matrix b4 each render.. Also i have posted my camera class if it helps. please help if you can as this is the only thing holding back dev on my game. #include "Ship.h" #include "Resources.h" static DXSound& dxSound = DXSound::getInstance(); static DXLib& dxLib = DXLib::getInstance(); Ship::Ship(const std::string name) { vec.x=velocity; health=255; shields=255; weapon=0; filename=name; boostEnabled=false; radius = 50; } Ship::~Ship() { } bool Ship::create(LPDIRECT3DDEVICE9 device) { position.x = 0.0f; position.y = 0.0f; position.z = 0.0f; vec.x = 0.0f; vec.y = 180.0f; vec.z = 0.0f; objectModel = new Model(); /* for(unsigned int i=0;i<20;i++) { PulseCannon* c = new PulseCannon("cannonball.X"); c->create(DXLib::getInstance().getDevice()); float x = -9999; float y = -9999; float z = -9999; c->setPosition(D3DXVECTOR3(x,y,z)); bulletBuffer.push_back(c); } */ return objectModel->loadModel(device,filename); } void Ship::render(LPDIRECT3DDEVICE9 device) { D3DXMatrixTranslation(&transMatrix,position.x,position.y,position.z); D3DXMatrixRotationY(&rotMatrix,D3DXToRadian(vec.y)); D3DXMatrixMultiply(&transMatrix,&rotMatrix,&transMatrix); D3DXMatrixRotationZ(&rotMatrix,D3DXToRadian(vec.z)); D3DXMatrixMultiply(&transMatrix,&rotMatrix,&transMatrix); D3DXMatrixRotationX(&rotMatrix,D3DXToRadian(vec.x)); D3DXMatrixMultiply(&transMatrix,&rotMatrix,&transMatrix); device->SetTransform(D3DTS_WORLD,&transMatrix); objectModel->render(device); for(unsigned int i =0;i<cannon.size();i++) { if(cannon[i]!=NULL) { D3DXVECTOR3 pos = cannon[i]->getPosition(); if(pos.z>5000||pos.y<-5000) { freeBullet(i); } else { cannon[i]->move(); cannon[i]->render(device); } } } // dxLib.getDevice()->SetRenderState(D3DRS_LIGHTING,TRUE); vec.y=180; vec.x=0; } void Ship::moveShip(int dir,float a_rate) { // position.z+=(a_rate*0.1); if( dir==DIK_UP ) { D3DXVECTOR3 vel = camera->getCameraUp(); D3DXVECTOR3 eye = camera->getEye(); eye.y-=a_rate*2.5; position.y-=a_rate*2.5f; camera->setEye(eye); camera->setObjectInFocus(position); vec.x=-20; } if( dir==DIK_DOWN) { D3DXVECTOR3 vel = camera->getCameraUp(); D3DXVECTOR3 eye = camera->getEye(); eye.y+=a_rate*2.5; position.y+=a_rate*2.5f; camera->setEye(eye); camera->setObjectInFocus(position); vec.x=20; } if(dir == DIK_RIGHT) { D3DXVECTOR3 vel = camera->getCameraRight(); D3DXVECTOR3 eye = camera->getEye(); eye+=vel*a_rate*25; position+=vel*a_rate*2.5f; camera->setEye(eye); camera->setObjectInFocus(position); vec.y=200; } if(dir == DIK_LEFT) { D3DXVECTOR3 vel = camera->getCameraRight(); D3DXVECTOR3 eye = camera->getEye(); eye-=vel*a_rate*25; position-=vel*a_rate*2.5f; camera->setEye(eye); camera->setObjectInFocus(position); vec.y=160; } if(dir==DIK_X) { D3DXVECTOR3 vel = camera->getCameraUp(); D3DXVECTOR3 eye = camera->getEye(); eye.z+=a_rate*25; position.z+=a_rate*2.5f; camera->setEye(eye); camera->setObjectInFocus(position); } if(dir==DIK_Z) { D3DXVECTOR3 vel = camera->getCameraUp(); D3DXVECTOR3 eye = camera->getEye(); eye.z-=a_rate*25; position.z-=a_rate*2.5f; camera->setEye(eye); camera->setObjectInFocus(position); } if(dir==DIK_B) { boostEnabled=true; } if(dir==DIK_SPACE) { dxSound.loadWaveFile("pulse.wav"); dxSound.playWave(); int index = findFreeBullet(); if(index!=-1) { PulseCannon* c = bulletBuffer[index]; bulletBuffer.erase(bulletBuffer.begin()+index); float x = position.x; float y = position.y; float z = position.z; z+=50; c->setPosition(D3DXVECTOR3(x,y,z)); cannon.push_back((PulseCannon*)c); } } // dxLib.g_vEye -= tmpLook*-10*a_rate; /* if(boostEnabled) { position.z+=30; } else { position.z+=1; } */ // dxLib.g_vEye -= (tmpLook*-10); } int Ship::findFreeBullet() { for(unsigned int index=0;index<bulletBuffer.size();index++) { D3DXVECTOR3 pos =bulletBuffer[index]->getPosition(); if(pos.x==-9999) { bulletBuffer[index]->setPosition(D3DXVECTOR3(0,0,0)); return index; } } return -1; } void Ship::freeBullet(int index) { cannon[index]->setPosition(D3DXVECTOR3(-9999,-9999,-9999)); bulletBuffer.push_back(cannon[index]); cannon.erase(cannon.begin()+index); } void Ship::setPosition(D3DXVECTOR3 pos) { position.x=pos.x; position.y=pos.y; position.z=pos.z; } int Ship::getHealth() { return health; } int Ship::getShields() { return shields; } int Ship::getWeapon() { return weapon; } void Ship::setHealth(int h) { health=h; } void Ship::setShield(int s) { shields=s; } void Ship::setWeapon(int w) { weapon=w; } D3DXVECTOR3 Ship::getPosition() { return position; } #include "Camera.h" Camera::Camera() { right =D3DXVECTOR3(1.0f, 0.0f, 0.0f); up =D3DXVECTOR3 (0.0f, 1.0f, 0.0f); forward = D3DXVECTOR3 (0.0f, 0.0f, 1.0f); eye = D3DXVECTOR3(0.0f, 100.0f, 0.0); } Camera::~Camera() { } void Camera::rotateY(float angle,D3DXVECTOR3 pos) { float sinAngle = sinf(angle); float cosAngle = cosf(angle); eye-=pos; float x = eye.x; float z = eye.z; eye.x =x*cosAngle + z*sinAngle; eye.z =x*-sinAngle+ z*cosAngle; eye+=pos; setObjectInFocus(pos); } void Camera::pitch(float angle,D3DXVECTOR3 pos) { // Compute the sin and cos of the angle float sinAng = sinf(angle); float cosAng = cosf(angle); eye -= pos; // Translate to world's origin // Calculate new eye X component float xxx = (right.x * right.x * (1.0f - cosAng) + cosAng) * eye.x + (right.x * right.y * (1.0f - cosAng) + right.z * sinAng) * eye.y + (right.x * right.z * (1.0f - cosAng) - right.y * sinAng) * eye.z; // Calculate new Y component float yyy = (right.x * right.y * (1.0f - cosAng) - right.z * sinAng) * eye.x + (right.y * right.y * (1.0f - cosAng) + cosAng) * eye.y + (right.y * right.z * (1.0f - cosAng) + right.x * sinAng) * eye.z; // Calculate new Z component float zzz = (right.x * right.z * (1.0f - cosAng) + right.y * sinAng) * eye.x + (right.y * right.z * (1.0f - cosAng) - right.x * sinAng) * eye.y + (right.z * right.z * (1.0f - cosAng) + cosAng) * eye.z; eye = D3DXVECTOR3(xxx, yyy, zzz); // Set the eye eye += pos; // Translate back // Get vector from target to eye D3DXVECTOR3 v = eye - pos; D3DXVec3Normalize(&v,&v); // Position eye so that's always "kCamDist" from target eye = pos + (v * 2.5); this->setObjectInFocus(pos); // Build the camera's axes } void Camera::setEye(D3DXVECTOR3 theEye) { eye=theEye; } void Camera::setForward(D3DXVECTOR3 theForward) { forward=theForward; } void Camera::setRight(D3DXVECTOR3 theRight) { right=theRight; } void Camera::setObjectInFocus(D3DXVECTOR3 theObj) { forward = theObj-eye; D3DXVec3Normalize(&forward,&forward); D3DXVec3Cross( &right,&D3DXVECTOR3(0,1,0),&forward); D3DXVec3Normalize(&right,&right); D3DXVec3Cross(&up,&forward,&right); D3DXVec3Normalize(&up,&up); } D3DXVECTOR3 Camera::getCameraForward() { return forward; } D3DXVECTOR3 Camera::getCameraRight() { return right; } D3DXVECTOR3 Camera::getCameraUp() { return up; } D3DXVECTOR3 Camera::getEye() { return eye; } D3DXVECTOR3 Camera::getObjectInFocus() { return eye+(forward*2.5f); } Camera aCamera; Camera *camera = &aCamera;
  5. To be on the safe side try adding these to project\settings\link under section "object\module" d3dx9dt.lib d3d9.lib winmm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib should reduce most of these, if not all
  6. Hi, sorry about the format of the question before.. didnt realise i forgot the source tags. You asked about my projection matrix. i did define one but, i presume you mean that each time the ship moves I need to do something like this. right? D3DXMATRIX matView; D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3(0.0f, 0.0f,-10.0f), &D3DXVECTOR3(0.0f, 0.0f, 0.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f ) ); g_pd3dDevice->SetTransform( D3DTS_VIEW, &matView ); D3DXMATRIX matProj; D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 200.0f ); g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj ); g_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
  7. hi, i have this problem. i currently have a simple 3d game written with a long floor (vertex drawing) with a texture of grass on it(like star fox).anyway my problem is i have a ship positioned in the environment, and i can move it left\right up\down.but the problem is that i want the ship to move at a constant rate,(like starfox) except what happens is that the ship rips off into the distance but the camera doesnt stay is persuit. heres the code, i would appreciate any help i can get.. #include "Ship.h" static DXSound& dxSound = DXSound::getInstance(); static DXLib& dxLib = DXLib::getInstance(); Ship::Ship(const std::string name) { vec.x=velocity; health=255; shields=255; weapon=0; filename=name; boostEnabled=false; radius = 50; } Ship::~Ship() { } bool Ship::create(LPDIRECT3DDEVICE9 device) { position.x = 0.0f; position.y = 0.0f; position.z = 0.0f; vec.x = 0.0f; vec.y = 180.0f; vec.z = 1.0f; objectModel = new Model(); for(unsigned int i=0;i<20;i++) { PulseCannon* c = new PulseCannon("cannonball.X"); c->create(DXLib::getInstance().getDevice()); float x = -9999; float y = -9999; float z = -9999; c->setPosition(D3DXVECTOR3(x,y,z)); bulletBuffer.push_back(c); } return objectModel->loadModel(device,filename); } void Ship::render(LPDIRECT3DDEVICE9 device) { D3DXMatrixTranslation(&transMatrix,position.x,position.y,position.z); D3DXMatrixRotationY(&rotMatrix,D3DXToRadian(vec.y)); D3DXMatrixMultiply(&transMatrix,&rotMatrix,&transMatrix); D3DXMatrixRotationZ(&rotMatrix,D3DXToRadian(vec.z)); D3DXMatrixMultiply(&transMatrix,&rotMatrix,&transMatrix); D3DXMatrixRotationX(&rotMatrix,D3DXToRadian(vec.x)); D3DXMatrixMultiply(&transMatrix,&rotMatrix,&transMatrix); device->SetTransform(D3DTS_WORLD,&transMatrix); objectModel->render(device); for(unsigned int i =0;i<cannon.size();i++) { if(cannon[i]!=NULL) { D3DXVECTOR3 pos = cannon[i]->getPosition(); if(pos.z>5000||pos.y<-5000) { freeBullet(i); } else { cannon[i]->move(); cannon[i]->render(device); } } } vec.x=0; vec.y=0; } void Ship::moveShip(int dir,float a_rate) { D3DXVECTOR3 tmpLook = dxLib.g_vLook; D3DXVECTOR3 tmpRight = dxLib.g_vRight; if( dir==DIK_UP ) { dxLib.g_vEye.y -= 10*a_rate; //position.y-=10; } if( dir==DIK_DOWN) { dxLib.g_vEye.y += 10*a_rate; //position.y+=10; } if(dir == DIK_RIGHT) { dxLib.g_vEye -= (tmpRight*-10)*a_rate; //position.x-=10; } if(dir == DIK_LEFT) { dxLib.g_vEye += (tmpRight*-10)*a_rate; //position.x+=10; } if(dir==DIK_X) { vec.z+=15.0f; vec.x+=10.0f; } if(dir==DIK_Z) { vec.z-=15.0f; vec.x-=30.0f; } if(dir==DIK_B) { boostEnabled=true; } if(dir==DIK_SPACE) { dxSound.loadWaveFile("pulse.wav"); dxSound.playWave(); int index = findFreeBullet(); if(index!=-1) { PulseCannon* c = bulletBuffer[index]; bulletBuffer.erase(bulletBuffer.begin()+index); float x = position.x; float y = position.y; float z = position.z; z+=50; c->setPosition(D3DXVECTOR3(x,y,z)); cannon.push_back((PulseCannon*)c); } } bool b = false; if(position.z>4900) { b=true; } if(boostEnabled) { if(b) { position.z-=30; } else{position.z+=30;} } else { if(b) { position.z-=10; } else{position.z+=10;} } dxLib.g_vEye -= (tmpLook*-10)*a_rate; } int Ship::findFreeBullet() { for(unsigned int index=0;index<bulletBuffer.size();index++) { D3DXVECTOR3 pos =bulletBuffer[index]->getPosition(); if(pos.x==-9999) { bulletBuffer[index]->setPosition(D3DXVECTOR3(0,0,0)); return index; } } return -1; } void Ship::freeBullet(int index) { cannon[index]->setPosition(D3DXVECTOR3(-9999,-9999,-9999)); bulletBuffer.push_back(cannon[index]); cannon.erase(cannon.begin()+index); } void Ship::setPosition(D3DXVECTOR3 pos) { position.x=pos.x; position.y=pos.y; position.z=pos.z; } int Ship::getHealth() { return health; } int Ship::getShields() { return shields; } int Ship::getWeapon() { return weapon; } void Ship::setHealth(int h) { health=h; } void Ship::setShield(int s) { shields=s; } void Ship::setWeapon(int w) { weapon=w; } D3DXVECTOR3 Ship::getPosition() { return position; } EDIT: Added source tags and title. [Edited by - 23yrold3yrold on August 22, 2004 9:57:24 PM]