BluePhase

Members
  • Content count

    15
  • Joined

  • Last visited

Community Reputation

147 Neutral

About BluePhase

  • Rank
    Member
  1. Thanks so much! Finally fixed all the errors. Thanks again ;)
  2.   It seemed to work but now I am getting new errors:   1>Game.obj : error LNK2019: unresolved external symbol "public: __thiscall Game::Game(void)" (??0Game@@QAE@XZ) referenced in function _wWinMain@16 1>Game.obj : error LNK2019: unresolved external symbol "public: __thiscall Game::Game(struct HINSTANCE__ *)" (??0Game@@QAE@PAUHINSTANCE__@@@Z) referenced in function "void __cdecl `dynamic initializer for 'ApplicationHandle''(void)" (??__EApplicationHandle@@YAXXZ) 1>Game.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Game::~Game(void)" (??1Game@@UAE@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'ApplicationHandle''(void)" (??__FApplicationHandle@@YAXXZ)   I'm not sure why  this is happening either.
  3. Yea I am a general Java programmer trying to get into C++ game development. How could I modify my code into just keeping the main function as global? Would I need to just not derive from the class and just directly do int WINAPI wWinMain()?
  4. Isn't that in my header file? I declared wWinMain in my Game.h and used Game::wWinMain in my Game.cpp file.
  5. For some reason I have been having a hard time figuring this out. I used the source code from the Microsoft DirectX 11 Tutorial series to generate a DirectX window but I am receiving a huge list of errors while compiling it.   The tutorial required me to include these libraries:   d3d11.lib d3dcompiler.lib dxguid.lib winmm.lib comctl32.lib   but the first error I got was huge but cant seem to recreate it anymore after I removed the above include libraries. I then reincluded them and then got the following error:   "fatal error LNK1561: entry point must be defined"   I tried everything to fix the error but nothing is working so any help at all would be appreciated.   I modified the source code a little bit into this:   Game.cpp followed by Game.h: #include "Game.h" int WINAPI Game::wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { UNREFERENCED_PARAMETER( hPrevInstance ); UNREFERENCED_PARAMETER( lpCmdLine ); if( FAILED( InitGameWindow( hInstance, nCmdShow ) ) ) return 0; if( FAILED( InitDirect3D() ) ) { CleanupDevice(); return 0; } // Main message loop MSG msg = {0}; while( WM_QUIT != msg.message ) { if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { Render(); } } CleanupDevice(); return ( int )msg.wParam; } HRESULT Game::InitGameWindow(HINSTANCE hInstance, int cmdShow) { // Register class WNDCLASSEX wcex; wcex.cbSize = sizeof( WNDCLASSEX ); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon( hInstance, ( LPCTSTR )IDI_WINLOGO ); wcex.hCursor = LoadCursor( NULL, IDC_ARROW ); wcex.hbrBackground = ( HBRUSH )( COLOR_WINDOW + 1 ); wcex.lpszMenuName = NULL; wcex.lpszClassName = L"Project Plexice"; wcex.hIconSm = LoadIcon( wcex.hInstance, ( LPCTSTR )IDI_WINLOGO ); if( !RegisterClassEx( &wcex ) ) return E_FAIL; // Create window g_hInst = hInstance; RECT rc = { 0, 0, 640, 480 }; AdjustWindowRect( &rc, WS_OVERLAPPEDWINDOW, FALSE ); g_hWnd = CreateWindow( L"Project Plexice", L"Project Plexice - Development build 0.1", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, rc.right - rc.left, rc.bottom - rc.top, NULL, NULL, hInstance, NULL ); if( !g_hWnd ) return E_FAIL; ShowWindow( g_hWnd, cmdShow ); return S_OK; } HRESULT Game::InitDirect3D() { HRESULT hr = S_OK; RECT rc; GetClientRect( g_hWnd, &rc ); UINT width = rc.right - rc.left; UINT height = rc.bottom - rc.top; UINT createDeviceFlags = 0; #ifdef _DEBUG createDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG; #endif D3D_DRIVER_TYPE driverTypes[] = { D3D_DRIVER_TYPE_HARDWARE, D3D_DRIVER_TYPE_WARP, D3D_DRIVER_TYPE_REFERENCE, }; UINT numDriverTypes = ARRAYSIZE( driverTypes ); D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_11_0, }; UINT numFeatureLevels = ARRAYSIZE( featureLevels ); DXGI_SWAP_CHAIN_DESC sd; ZeroMemory( &sd, sizeof( sd ) ); sd.BufferCount = 1; sd.BufferDesc.Width = width; sd.BufferDesc.Height = height; sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; sd.BufferDesc.RefreshRate.Numerator = 60; sd.BufferDesc.RefreshRate.Denominator = 1; sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; sd.OutputWindow = g_hWnd; sd.SampleDesc.Count = 1; sd.SampleDesc.Quality = 0; sd.Windowed = TRUE; for( UINT driverTypeIndex = 0; driverTypeIndex < numDriverTypes; driverTypeIndex++ ) { g_driverType = driverTypes[driverTypeIndex]; hr = D3D11CreateDeviceAndSwapChain( NULL, g_driverType, NULL, createDeviceFlags, featureLevels, numFeatureLevels, D3D11_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice, &g_featureLevel, &g_pImmediateContext ); if( SUCCEEDED( hr ) ) break; } if( FAILED( hr ) ) return hr; // Create a render target view ID3D11Texture2D* pBackBuffer = NULL; hr = g_pSwapChain->GetBuffer( 0, __uuidof( ID3D11Texture2D ), ( LPVOID* )&pBackBuffer ); if( FAILED( hr ) ) return hr; hr = g_pd3dDevice->CreateRenderTargetView( pBackBuffer, NULL, &g_pRenderTargetView ); pBackBuffer->Release(); if( FAILED( hr ) ) return hr; g_pImmediateContext->OMSetRenderTargets( 1, &g_pRenderTargetView, NULL ); // Setup the viewport D3D11_VIEWPORT vp; vp.Width = (FLOAT)width; vp.Height = (FLOAT)height; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; vp.TopLeftY = 0; g_pImmediateContext->RSSetViewports( 1, &vp ); return S_OK; } void Game::Render() { // Just clear the backbuffer float ClearColor[4] = { 0.0f, 0.125f, 0.3f, 1.0f }; //red,green,blue,alpha g_pImmediateContext->ClearRenderTargetView( g_pRenderTargetView, ClearColor ); g_pSwapChain->Present( 0, 0 ); } LRESULT CALLBACK Game::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { PAINTSTRUCT ps; HDC hdc; switch( message ) { case WM_PAINT: hdc = BeginPaint( hWnd, &ps ); EndPaint( hWnd, &ps ); break; case WM_DESTROY: PostQuitMessage( 0 ); break; default: return DefWindowProc( hWnd, message, wParam, lParam ); } return 0; } void Game::CleanupDevice() { if( g_pImmediateContext ) g_pImmediateContext->ClearState(); if( g_pRenderTargetView ) g_pRenderTargetView->Release(); if( g_pSwapChain ) g_pSwapChain->Release(); if( g_pImmediateContext ) g_pImmediateContext->Release(); if( g_pd3dDevice ) g_pd3dDevice->Release(); } #ifndef GAME_H #include <windows.h> //#include <windowsx.h> #include <d3d11.h> #include <D3DX11.h> class Game { public: Game(HINSTANCE hInstance); virtual ~Game(); int Run(); HWND GetGameWindow() const; HINSTANCE GetGameInstance() const; float GetAspectRatio() const; bool Init(); void Update(float dt); void Render(); LRESULT MsgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ); public: HRESULT InitGameWindow(HINSTANCE hInstance, int cmdShow); HRESULT InitDirect3D(); void CleanupDevice(); UINT creationFlags; //DirectX attributes HINSTANCE g_hInst; HWND g_hWnd; D3D_DRIVER_TYPE g_driverType; D3D_FEATURE_LEVEL g_featureLevel; ID3D11Device* g_pd3dDevice; ID3D11DeviceContext* g_pImmediateContext; IDXGISwapChain* g_pSwapChain; ID3D11RenderTargetView* g_pRenderTargetView; }; #endif // !GAME_H    
  6. Is it possible to detect a radius from a circle based on the coordinates of the object (X, Y, Z) where it's located on the center? It has to be abstract where I can get the radius from any model from any location. I am using the radius to draw a circle around a model for collision detection. This is being implemented into XNA.
  7. [quote name='phil_t' timestamp='1350949876' post='4992941'] When you draw the mesh, you generally apply a world matrix. If that world matrix includes a scaling component, then you also need to include that when generating your bounding sphere. It should only take a few seconds to check this in the debugger. Just set a breakpoint on that section of the code and take a look at the values. The bounding spheres are obviously not intersecting, so what do the values look like? You can take a few seconds to figure it out yourself, or you can keep wasting time guessing and hoping someone will figure it out for you.... your choice :-) [/quote] Still having a difficult time understanding how to implement that :3
  8. [quote name='phil_t' timestamp='1350938585' post='4992893'] So your bounding sphere sizes might be incorrect. Do they look correct to you if you step through the code? Are you scaling your models at all when drawing them? In your collision code you're taking into account their position but not their scale. [/quote] Does it really matter if I include the scale or not? The bounding spheres are congruent to the mesh so I assume it is taking the size in as well. Stepping through the code takes me a very long time. I have a lot of code written.
  9. [quote name='Krohm' timestamp='1350889406' post='4992694'] [quote name='BluePhase' timestamp='1350870942' post='4992653'] Currently, the object free falls until it collides with the object then stops but it's not working[/quote]So it works... or not? I guess you mean to say the two objects get stuck to each other. This is because[list=1] [*]Your CD checker... which is n^2... ouch! [*]Anyway, I have no idea who sets up [font=courier new,courier,monospace]collision.HasCollided[/font] but I speculate it's the return value from [font=courier new,courier,monospace]CheckFromCollision[/font]. [*]Suppose object A collided with object B. Its internal flag gets set. [*]From now on, [font=courier new,courier,monospace]Update [/font]LN 14 will always be executed. The object, according to the code you posted (and the code I have speculated) cannot exit from the collided state, and gets no updates ever. Therefore, it sticks to its collider. [/list] That said. I strongly suggest to look for a C# binding of a physics library. It's never too early to use one. BTW, what's the real point of LN14? [font=courier new,courier,monospace]ModelPositionHeight [/font]is numerically equivalent to [font=courier new,courier,monospace]model.Position.Y[/font] so this is actually a NOP. [/quote] It won't let me modify the model.Positiion.Y file because it basically doesn't have a value until initialization. And I used a bad use of grammar. The object just FREE FALLS. It never stops even when the models are right on top of each other.
  10. I can't seem to get my collision detection to work at all. Hopefully someone can. Is there a better way to test if it's colliding? The object should free fall until it collides with the object then stops but it doesn't. It just free falls continuously. Thanks in advanced! This is my Collision Detector: [source lang="csharp"] public bool CheckForCollision(CustomModel c1, CustomModel c2) { for (int i = 0; i < c1.Model.Meshes.Count; i++) { // Check whether the bounding boxes of the two cubes intersect. BoundingSphere c1BoundingSphere = c1.Model.Meshes[i].BoundingSphere; c1BoundingSphere.Center += c1.Position; for (int j = 0; j < c2.Model.Meshes.Count; j++) { BoundingSphere c2BoundingSphere = c2.Model.Meshes[j].BoundingSphere; c2BoundingSphere.Center += c2.Position; if (c1BoundingSphere.Intersects(c2BoundingSphere)) { return true; } } } return false; }[/source] This is my physics that I use to test it: [source lang="csharp"] public void Update(GameTime gameTime, CustomModel model, float Mass, float Velocity) { if (collision.HasCollided == true) CollidedWithObject = true; ModelPositionHeight = model.Position.Y; if (CollidedWithObject == false) { ModelPositionHeight = (Velocity) - (0.5f * Mass * Time * (Time * Time)); model.Position = new Vector3(model.Position.X, ModelPositionHeight, model.Position.Z); Time += (float)gameTime.ElapsedGameTime.TotalSeconds; } if (CollidedWithObject == true) { model.Position = new Vector3(model.Position.X, ModelPositionHeight, model.Position.Z); } }[/source] In my Main (game1) class: [source lang="csharp"] customModel.Update(gameTime, models[0], 120, 250); collisionController.CheckForCollision(models[1], models[0]);[/source]
  11. Hi forums, I have done a fair amount of CG in the past, but all characters and architecture/ objects- never any terrain larger than a single model. My goal is to make a terrain which is several square kilometers large. I am using Mudbox, Maya, Blender, and World Machine. Now I would like to model in a large amount of detail to make normal and displacement/heightmaps from to project onto lower poly models of the same terrain. In order to do this, I need a very large number of subdivisions. Since I can't afford (processing wise) to subdivide the entire world like this at once, I guess I need to divide the whole world into smaller chunks. I started out in maya, and made a plane with a grid on it, divided into 64 spaces, each grid square I gave its own uv map space, so I ended up with 64 uvs. Then I imported this plane grid into mudbox, where I will model each unit, and then import each unit's UVs into world machine, then world machine's outputs back to mudbox. So the terrain is made up of 64 smaller objects with their own individual uvs. I have two major issues: 1) [what seems to be the much harder question] since mudbox can only sclupt one object per stroke, when I sculpt over the edges between object squares, they never quite line up again. What is the secret for having sculpted terrain chunk objects that have edges which line up? Do I need to rethink my method entirely to achieve this? Am I perhaps doing it backward? Do I model a fair level of detail, then divide the master terrain model into my 64 chunks from there? Even so, once I cross a chunk edge between two models with a sculpting tool, the seam is broken I would think... 2) Since I am working with 64 sets of uvs from the start, the process is incredibly cumbersome. Is there a way to make a master height map to first take into world machine, and then export WM's outputs, and then take all this into say Maya, and subdividie the whole model into the smaller chunks at that point, with the heightmap UV's being divided as well into their corresponding grid parts? If all of this doesn't make sense, my question is basically what process do I use to create a massive seamless world (that may have smaller model parts or chunks) if I want to model in high details for displacement maps to project, with Mudbox, Maya, Blender, and World Machine at my disposal?
  12. Best Method to Create Terrain?

    Alright thanks so much for the feed back, but I am running into one more problem now. I noticed that when people connect multiple sections of height maps, seams are visible from where they connect. What causes this and is there a method to fix that?
  13. Best Method to Create Terrain?

    I thought about using height maps but those are unable to make caves so it wouldn't be good for what I am trying to accomplish.
  14. I'm about 4 months in to the development of a game and I have some concerns involving the terrain. I've read around many forums and people seem to always say that importing terrains like .fbx or .x is a horrible idea because it takes up too much hardware consumption. I was curious to know if this is true? What are some optimal methods to make beautiful designed terrain like the ones from Dear Esther? I and a friend (Professional Architect) have been discussing of how to handle things with the terrain and we can't seem to find the solution to our problem. I thought maybe I could program a map editor that uses the XNA Primitives and use Mudbox functions like Sculpting which would enable him to make efficient terrains but is that even considerable? Thanks in advanced!
  15. I have been working with XNA for a few months now and I have gotten to the point of where my models folder is just insanely huge. And there is expected to be more than just the amount I have about 750 more. The reason for this, is because I might have one column, but might have another 30 different columns with just a few different changes, etc. And it would save me a lot of exporting just to do all the designs in one model file and load a specific part of the model in the game. Is there any possible way to load just a specific part of the model file into the game?