# savail

Member

235

333 Neutral

• Rank
Member
1. ## Interactive body parts in 2d game

Hey, I'm wondering what would be the best approach to make a character be completely interactive with the environment just like in the "Happy Wheels" game. How are characters in "Happy Wheels" made anyway? Are they 3d models or each body part is a separate object and everything is just being linked into 1 character in game? I would like to achieve a similar effect but in a completely 2d game (without 3d models), so that character would bleed just in place where he was shot, could be cut on half in many places of his body etc... ; P
2. ## How to prepare yourself for working in game industry?

Hey, I already have quite good knowledge of C++. I've written 2d game in DirectX 9, played with network programming a bit and WinAPI. Now I would like to start learning 3D game programming and I wonder what would be the best approach? Should I learn DirectX 11 and try to create my own engine? I've already tried to learn DX 11 but it seems to be pointless... Going through DX 11 tutorials is a pain for 1 person and takes too much time in comparison to knowledge achieved. So maybe should I learn some 3D library like Ogre or download a game engine like Unity or Unreal? I would like to go with a solution that would give me most abilities and knowledge used in professional game development. I would be very grateful if someone with experience could share his thoughts!
3. ## View matrix - explanation of its elements

So a common view matrix looks like this:   where n is a vector acting as "z" axis of camera, u as "x" axis and v as "y" axis of camera. u_x, v_x, n_x etc. are coordinates of each vector. c is a vector representing distance of camera from (0,0, 0). u*c, v*c and n*c are dot products Does somebody know any detailed article which would explain precisely how to create such a matrice from the scratch? Or maybe could someone explain it to me here? First my assumptions: When applying this matrix to every object on the scene, this matrix is the first factor of multiplication and a vertex is a second one? So for example: * | x | | y | | z | | 1 | If my assumptions are correct then I don't understand a few things . Why 4th row of the matrix must contain a vector representing how much should I move every vertex on the screen? The 4th coordinate in any vertex is "w" right? So what meaning does it have here? I thought it's actually useless but defined only to enable adding matrices in form of multiplication. Now after such mutiplication as above I would get the following vertex transformation: |x * u_x + y * v_x + z * n_x + 0 | |x * u_y + y * v_y + z * n_y + 0 | |x * u_z + y * v_z + z * n_z + 0 | |-x * (u*c) -y * (v*c) -z * (n*c) + 1 | And it seems as the "w" component of the vertex was moved but it doesn't make any sense to me : (.   My second issue is rotation in the view matrix so 3 first rows of the view matrix. I completely don't understand why we can put coordinates of the camera axis vectors as rotation factors.   So if anyone could lend me a hand here I would be really grateful!
4. ## DX11 different colors when using XMVECTOR or XMFLOATs

Thank you very much! Indeed, I had to change the format for my position in the layout from DXGI_FORMAT_R32G32B32_FLOAT to DXGI_FORMAT_R32G32B32A32_FLOAT and now everything works correctly! Thanks a lot again... there is so much to learn in DX 11 that one can easily get confused :(.
5. ## DX11 different colors when using XMVECTOR or XMFLOATs

So I'm following a tutorial http://www.rastertek.com/dx11tut04.html and managed to convert it from D3DX10math.h to DirectXMath.h but I can't get the same color values when using XMVECTOR or XMFLOATs for my vertices. I want to draw a green triangle and this is how I set positions and colors for vertices using XMVECTOR: //vertices::position and vertices::color are XMVECTORs alligned to 16 bytes vertices[0].position = DirectX::XMVectorSet(-1.0f, -1.0f, 0.0f, 0.0f);  // Bottom left.     vertices[0].color = DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 1.0f);     vertices[1].position = DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f);  // Top middle.     vertices[1].color = DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 1.0f);     vertices[2].position = DirectX::XMVectorSet(1.0f, -1.0f, 0.0f, 0.0f);  // Bottom right.     vertices[2].color = DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 1.0f); This gives me totally blue triangle, whereas such solution: //vertices::position is XMFLOAT3 and vertices::color is XMFLOAT4     vertices[0].position = XMFLOAT3(-1.0f, -1.0f, 0.0f);  // Bottom left.     vertices[0].color = XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f);     vertices[1].position = XMFLOAT3(0.0f, 1.0f, 0.0f);  // Top middle.     vertices[1].color = XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f);     vertices[2].position = XMFLOAT3(1.0f, -1.0f, 0.0f);  // Bottom right.     vertices[2].color = XMFLOAT4(0.0f, 1.0f, 0.0f, 1.0f); with types changed to XMFLOAT3 for position and XMFLOAT4 for color gives me correct green triangle.   I've played a bit with these coordinates and tried to make a green triangle using XMVECTORs but it doesn't seem to have any sense. The XMVECTOR solution returns wrong colors all the time whatever I set the coordinates to... I know that it might be hard to guess what's the problem without some details but maybe somebody has an idea of what might be wrong?   PS: When I change the last parameter in XMVECTOR solution for vertices::position to 1.0f it changes the color near that vertex to pink, which is completely wierd for me as position shouldn't have impact on color?
6. ## XMVECTOR vs XMFLOAT4 in classes

thanks for answer!     A lot of libs (I'm using Bullet Math) follow that pattern. You should be very careful again, with passing aligned values, type casting ect. (http://msdn.microsoft.com/en-us/library/83ythb65.aspx)  So it's a better solution if I want my program / game run as smoothly and quickly as possible?   According to my 2. question I mean: I have a XMFLOAT3A Position in my class and Should I use something like this: DirectX::XMStoreFloat3A(&Position, DirectX::XMVectorSet(-1.0f, -1.0f, 0.0f, 0.0f)); or: Position.x = -1.0f; Position.y = -1.0f Position.z = 0.0f; to fill the Position vector? What's faster and better to use? or it doesn't matter at all?
7. ## XMVECTOR vs XMFLOAT4 in classes

Hey, I'm wondering how should I get around with those types. I've read that I should use XMFLOATs in classes for storage purposes but for calculations convert it to local XMVECTOR objects.   1. Doesn't converting from one type to another, whenever I need to calculate sth, slow down the performance? Isn't it better to properly align class and then always use XMVECTOR in it?   2. If I should use XMFLOAT for storage purposes, does it mean that I should use XMFLOAT for filling the data as well? Or is it faster and preferred to use XMVECTOR to fill data  in there and then store it in XMFLOAT?   I would be very grateful for answering 2 of my questions!
8. ## What's worth to learn right now in DirectX?

Hey all! So I have created a few examples in DirectX 9. I've created my own full 2d engine based on DX 9 and now I wanted to start learning 3d. My goal is to become really knowledgeable in the field of creating games in DirectX but I'm now honestly getting confused due to the rapid development of whole game industry, libraries, tools etc and I'm not sure what should i focus on? Currently I'm windows 8 user and I'm trying to learn DirectX 11 from this site: http://www.rastertek.com . There are a lot of technical aspects of initialising DirectX 11, which are not explained actually anywhere and here's my question: Do all Pros remember and understand whole this procedure of getting DirectX to initialise and other actions? Or is it more like paste + copy? Cause actually it seems to me to be completely impossible to remember all of this... If I wanted to become a part of some game company in the future should I be well informed in DirectX 9, 10 or 11? Or maybe since it developed so much and still continues should I get familiar with sth like XNA?
9. ## How can games be loaded through website?

Thanks for answers! The game I meant is not browser based. There are some examples I can tell you: Warrock, Gunz and probably some more which I don't know.
10. ## How can games be loaded through website?

Hey, There are some games on the market which are run directly from a website. You have to log in there and press play. Then the process is created on your computer and you can normally play it as if it was run from .exe. It actually is run from .exe but the game opens only if I load it through website. Running the .exe alone won't open the game. How is it all done? Is the .exe somehow packed and the site unpacks it somehow? I would be very grateful for some brief explanation or articles!
11. ## Game message loop - using 50% of CPU when window is minimized or inactive

Thanks for answers! I think it's true that it was due to my lack of constant framerate. After adding some framerate the program no longer consumes max of 1 core's processor
12. ## Game message loop - using 50% of CPU when window is minimized or inactive

Thanks for the answer. The problem is also that my game has multiplayer mode so I can't stall my application  becouse client will timeout and disconnect from the server. Even if you say that programs run as fast as they can I still can't understand why my game doesn't use 50% of CPU all the time then? PeekMessage must be doing sth which prevents it from using max of CPU I guess.
13. ## Game message loop - using 50% of CPU when window is minimized or inactive

Hey, This is how my game loop looks like: MSG msg; ZeroMemory(&msg, sizeof(msg)); while(msg.message != WM_QUIT) {     if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))     {         TranslateMessage(&msg);         DispatchMessage(&msg);     }     else     {         if( !Render() ) //In Render() function there are all game drawings and calculations         {             MessageBox(NULL, "Failed to render", "Error", MB_OK | MB_ICONEXCLAMATION);             PostQuitMessage(0);         }     } } I'm not actually sure what happens in PeekMessage(...) function. When the game window is active and has focus, everything seems to work fine. PeekMessage function seems to distribute CPU to my game in accordance with its needs. More CPU when there's collision, less when nothing happens at all. I experienced however huge growth of CPU when I minimize my window. I probably have dual core processor and thats why it's taking 50% CPU in that time.  When I erase this block of code from my game loop: if(PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))     {         TranslateMessage(&msg);         DispatchMessage(&msg);     } it takes 50% of CPU all the time -> that's why I assumed that PeekMessage distributes somehow CPU. Simple infinite loop like this: while(1) {} will also take 50% of CPU.   Why is that happening and how can I prevent this growth of CPU without sleep()? I would be very grateful for help!
14. ## How to deal with adding and destroying game objects in UDP?

Thanks a lot everybody for answers and sharing your knowledge! @samoth, thanks for such detailed explanation. It seems not to be as perfect as I made it up in my previous post :P but still does not require server to waste time on searching for appropriate object - only clients have to. Anyway, it's much more clear now and I can even try to implement it on my own :D. Thanks a lot
15. ## How to deal with adding and destroying game objects in UDP?

This idea about using object's memory address is just brilliant! Though I'm afraid I'm still not pro enough to implement it but I would like to find out sth more about this if you don't mind ^^. I'm not sure how could it work? The server would create an object on its side and would send it to client together with its memory address? Then client would have to create the object in the same memory location, as it had been created on the server, using sth like http://www.parashift.com/c++-faq-lite/placement-new.html? But do I have certainty that the memory address which was free on the server will be free on the client as well? Or maybe I'm completely wrong with my assumptions?