hiro4476

Members
  • Content count

    8
  • Joined

  • Last visited

Community Reputation

122 Neutral

About hiro4476

  • Rank
    Newbie
  1. Tahnks Adam! you are genius! how could I have missed that XD although this is barely scrashing the directX. void Sys_CreateLoadThread() { ?HANDLE newThread; ?InterlockedExchange((volatile LONG*)&_LoadEnd,0); ?newThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)Sys_LoadThread,hWnd,0,NULL); } void Sys_LoadThread(HWND hWnd) { ?OnLoading(); ?InterlockedExchange((volatile LONG*)&_LoadEnd,1); } and inside the OnLoading(), it's just for loops to load all the resources specified... _LoadEnd is not been used anywhere but insides the above 2 functions. as googled... think the WaitForSingleObject is needed but it's not been used. I'm a lilo confused here... so it created a new thread to load resource. but not waiting for the loading to complete... if that assumption is true, then probably it explains why the program yells LOADING FAIL occasionally. ahyhow, I've restored everything back to what it was, but replaced Sys_CreateLoadThread() with the OnLoading() so far, and I think it is sweet. I DO think this API needs a rewrite... besides this, I've caught quit some bugs too... Kindly Regards to oeveryone, Hiro
  2. omg, that was a bad indentation!! and it look like I can not re-edit or preview before I post... [code]BOOL DoWindow(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR lpszCmdLine, int nCmdShow) { ?MSG pMsg; ?WNDCLASS myProg; ?LPCSTR Name = "Window_Class_Name"; ?if (!hPreInst) { ??myProg.style = CS_HREDRAW | CS_VREDRAW; ??myProg.lpfnWndProc = WndProc; ??myProg.cbClsExtra = 0; ??myProg.cbWndExtra = 0; ??myProg.hInstance = hInstance; ??myProg.hIcon = LoadIcon(hInstance,"MAIN"); ??myProg.hCursor = LoadCursor(NULL, IDC_ARROW); ??myProg.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); ??myProg.lpszMenuName = NULL; ??myProg.lpszClassName = (Name); ??if (!RegisterClass(&myProg)) return FALSE; ?} ?hWnd=CreateWindow( (Name), (USERNAME), ... ); ?InitDxLib(); ?OnCreate(); ?Sys_CreateLoadThread(); ?InitPlayerInput(); ?ShowWindow(hWnd,nCmdShow); ?UpdateWindow(hWnd); ?while(true){ ??if(PeekMessage(&lpMsg,NULL,0,0,PM_REMOVE)){ ???if(lpMsg.message == WM_QUIT){ break; } ???TranslateMessage(&lpMsg); ???DispatchMessage(&lpMsg); ??} else if (Sys_LoopControl(60)){ ???FrameTime = (timeGetTime()-old_time)/F(1000); ???old_time = timeGetTime(); ???GameLoop(); ??} ??Sleep(1); ?} ?OnDestroy(); ?DelDxLib(); ?_CrtDumpMemoryLeaks(); ?return((int)lpMsg.wParam); }[/code]
  3. thanks for the tips. but I'm not sure about this "main" thread thingy. And I don't think it's related to [url="http://stackoverflow.com/questions/266168/simple-example-of-threading-in-c"]http://stackoverflow.com/questions/266168/simple-example-of-threading-in-c[/url] I've try moving CreateDevice and every related codes into WinMain but it's not getting any better though... it was all in other cpp called Gp3Lib.cpp. the original WinMain look like this [code] int WINAPI WinMain (HINSTANCE hInstance,HINSTANCE hPreInst,LPSTR lpszCmdLine,int nCmdShow) { ?stageInfo::readinFileTable(); ?Sys_SetScreenMode(); ?return DoWindow(hInstance,hPreInst,lpszCmdLine,nCmdShow); } [/code] the only thing I can suspect the odd is the "while(true){" loop at the DoWindow call [code] BOOL DoWindow(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR lpszCmdLine, int nCmdShow) { [indent=1]MSG pMsg; WNDCLASS myProg; LPCSTR Name = "Window_Class_Name"; if (!hPreInst) {[/indent] [indent=2]myProg.style = CS_HREDRAW | CS_VREDRAW; myProg.lpfnWndProc = WndProc; myProg.cbClsExtra = 0; myProg.cbWndExtra = 0; myProg.hInstance = hInstance; myProg.hIcon = LoadIcon(hInstance,"MAIN"); myProg.hCursor = LoadCursor(NULL, IDC_ARROW); myProg.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); myProg.lpszMenuName = NULL; myProg.lpszClassName = (Name);[/indent] [indent=2]if (!RegisterClass(&myProg)) return FALSE;[/indent] [indent=1]}[/indent] [indent=1]hWnd = CreateWindow( (Name), (USERNAME), ... );[/indent] [indent=1]InitDxLib(); OnCreate(); Sys_CreateLoadThread(); InitPlayerInput(); ShowWindow(hWnd,nCmdShow); UpdateWindow(hWnd);[/indent] [indent=1]while(true){[/indent] [indent=2]if( PeekMessage( &lpMsg, NULL, 0, 0, PM_REMOVE ) ){[/indent] [indent=3]if(lpMsg.message == WM_QUIT){ break; } TranslateMessage(&lpMsg); DispatchMessage(&lpMsg);[/indent] [indent=2]} else if ( Sys_LoopControl(60) ) {[/indent] [indent=3]FrameTime = (timeGetTime()-old_time)/F(1000); old_time = timeGetTime(); GameLoop();[/indent] [indent=2]}[/indent] [indent=2]Sleep(1);[/indent] [indent=1]} OnDestroy(); DelDxLib(); _CrtDumpMemoryLeaks(); return((int)lpMsg.wParam);[/indent] } [/code]
  4. btw, here's the Warning message, [b]Device that was created without D3DCREATE_MULTITHREADED is being used by a thread other than the creation thread.[/b] [b]The thread Win32 Thread has exited with code 0 (0x0).[/b] and also, is there a way to check if a [b]D3DCREATE_MULTITHREADED [/b]is needed? like if I bring this game back to my school.
  5. Thanks to Tom's tip, I've managed to fix it!! I fix it by providing a [b]D3DCREATE_MULTITHREADED[/b] tag to the [b]CreateDevice().[/b] I also received a huge amount of Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: xx Direct3D9: (WARN) :Ignoring redundant SetRenderState xx even I comment'em. guess there are ok I think. and thanks to Ripiz too. but the froze was a program froze. I've also googled the primitive topology, it seems like it's a DX10 feature? Is there a equivalent feature/setting for the DX9? might as double check it.
  6. I'm at my limit... This game uses the Library which is provided by my school. The same code works fine in my school's computer but not in my notebook. I've been debuging this days after days (although not continuously) The HRESULT returned from CreateDevice has no problem as far as I can see. (the result was 0 I think) with the D3DCREATE_HARDWARE_VERTEXPROCESSING setting, the last trace is "pD3DDevice->Present.s" and the screen went frozen, leaves no error messages. with the D3DCREATE_SOFTWARE_VERTEXPROCESSING setting, it's extreamly slow. but won't freeze (maybe too slow to even not get to the point yet) since it has no error messages and it's un-debug-able... I've been googling for days, and still have no idea what's going on. can anyone give me a direction, where should I start looking? pSprite is a LPD3DXSPRITE And this is the snippet in the gameLoop [code] while( LOOP ) { if(pD3DDevice != NULL) { pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,0),1.0f,0); } if(pD3DDevice != NULL) { pD3DDevice->BeginScene(); } if(pSprite != NULL) { pSprite->Begin(D3DXSPRITE_ALPHABLEND); } //draw something if(pSprite != NULL){ pSprite->End(); } if(pD3DDevice != NULL){ hc::trace("pD3DDevice->EndScene.s"); pD3DDevice->EndScene(); hc::trace("pD3DDevice->EndScene.e"); } HRESULT hr; if( pD3DDevice != NULL ) { hc::trace("pD3DDevice : %d", pD3DDevice); hc::trace("pD3DDevice->Present.s"); hr = pD3DDevice->Present(NULL,NULL,NULL,NULL); hc::trace("pD3DDevice->Present.e"); } } [/code] Actually, before this happened, I had "LNK1000: Internal error during IncrBuildImage" error at every compile. the hotfix VS90-KB948127 fixed it but still.... it could be the problem of my graphic card... my graphic card is ATI Mobility Radeon X2300. a VAIO notebook probably 2 years old. But then if I can create something like this with no problem in compiling and executing [url="http://hiro4476.blogspot.com/2012/02/gelises851-about-demo.html"]http://hiro4476.blog...about-demo.html[/url] it could also be something wrong within the school's Library? Regards, Hiro
  7. a video add-on from youtube, Wiimote + Halo2 :) http://youtube.com/watch?v=Rk4WLtuf-ME > if you had to turn 180 degrees, then you'd have to hold and drag two or three times to be able turn enough. I had that question too :p > On the Wiimote, the A button is operated with the thumb and the B button is operated with the index finger. > The human thumb can be moved independently from all the other fingers, a feat that separates us from most animals. > Secondly you should definitely add some movement functions to the Nunchuck control stick, so the player can move > (strafe, forward, back) and shoot at the same time yeah... I thought most people would've known, so I only mentioned the rotate and aim :) btw, I play Violin very well, my fingers are softer than normal people (I can do things normal people can't), I think I can handle my fingers pretty well, I know thumb works a little different, but when holding a gun, lets say you can only rotate your arm within +-30 degrees when you grab you gun. if you want to rotate from current angle to another +-30 degrees, you got to dis-attaach and reattach your thumb, I feel a little weird doing this (especially during repeat index-finger action), so do my friends, maybe not all to do with muscles but maybe there's something else? It's easy to re-hold gun, while stop pulling trigger. the guy I talked to is on the other side of screen... he insist it's a easy to use and a much better design (to rotate, aim and shoot), and he insist, it's totally the same holding a mouse, gun and game-pad (I don't really think they are the same though...) he seems kinda... angry (can tell from his words)? he probably think I'm totally against him... I'm not interested in right or wrong, it's a discussion, I'm just unsure, and think it needs more consideration, future is uncertain. would be good if I have a dev-kit to play with... btw, people in n-sider hate the hold A then rotate arm design... ="= but I would really like to hear the experience from someone who had played with this control scheme before. also, do general people think this Hold B then Rotate method, faster and more accurate than the general Wii FPS design? (exclude Metroid Prime 3, MP series is not a standard FPS, it's an action FPA) I also suggested... if you really want to control your turn speed in real time (not using setting), why not use the current control scheme, plus the rotation of z-axis? It would probably be more intuitive? he hates this though... and he hates when I say put the rotate button in left hand nunchuck, saying those would disturb even more and lastly... do normal people say PC mouse moves in XZ axis...? [Edited by - hiro4476 on August 19, 2007 12:54:11 PM]
  8. To Whom It May Concern: me just registered :) I'm no native english speaker, so please bare with my poor english a little :p I wonder, if this is a better design? I was talking to a guy the other day. he think he's got the better wii fps control design than all the others. fix the cursor at the center of the screen, Press then Hold A then move your arm to rotate the camera, Release then move your arm to another direction, Press then Hold again to rotate the camera, Hit B to fire, in a simple way to explain... move mouse = Hold down Wiimote B and rotate your arm hit mouse left button = hit Wiimote A I'm not sure about this... wouldn't those finger action interrupt each other? especially when you roll up you fingers (the muscles in your arm is tensed), and you need to hit B madly, he said it's the same as holding a gun or a mouse but you only hold your mouse once, and I think the muscles are relaxed. when holding a gun (similar to Wiimote), you only hold it once (you don't dis-attach then attach frequently), even though your muscles are tensed but they aren't moving anymore, the only thing you do is to control the muscles to pull your index-finger... well... I don't think holding a gun and mouse is the same as holding a Wiimote (with hitting A to rotate and B to fire) I would imaging people would stop the fire during release -> move arm -> Press then hold action? It's much easier to do it separately, no mixing 2 finger's pulling force. I've asked 3 other friends, and they are not sure if they can do it easily, a friend who's studying anatomy/etc told me that some finger action can move separately but some can't, cause some action uses the same muscles. and I do know, when I roll up my fingers, the muscles around my wrist is tensed, holding Wiimote is tenser than holding a game-pad or mouse (but maybe similar as holding a Gun) I can move one finger down and up and keep the rest straight at their start position, if I move slowly, but if I move fast, the nearby fingers will also move up and down... and maybe this is too much to handle all in once? Has anyone done this control scheme testing before? It's a control scheme from mouse control, I would image any studio that wants to make a Wii FPS would probably done this before? Is this a better way that suits most people? Regards,