Muzzy A

Members
  • Content count

    197
  • Joined

  • Last visited

Community Reputation

737 Good

About Muzzy A

  • Rank
    Member
  1. It looks like speed should be called Force.  You're applying it to the acceleration which means it's a sort of force. Velocity already contains your speed. Just a little note.
  2. Adding a scrolling camera stuck with the maths

    You can just add or subtract the camera's position   an object is at position // Screen Coordinates x = 300; y = 300; The camera's top left is at position x = 200 y = 200 Picturing this in your head you can tell it should render at 100,100 on the screen   soooooo objX - camX = 100; objY - camY = 100; For input.... You clicked the screen at position x = 100; y = 200; Cameras top left position x = 200; y = 200;   // Coordinates in the world would then be... x = mouseX + camX; // 300 y = mouseY + camY; // 400   gridPos = worldIsoGrid( x,y,widthHalf,heightHalf);
  3. C# 2D Body Animation help

    I was searching and didn't realize there aren't many free articles on this subject.   A Book:  3D Animation     You'll want a class like this class KeyFrame {     Vector2 Position;     float Scale;     float Rotation;     float StartTime; };   // Store all of your key frames into a list List< KeyFrame > frames;   // To create the key frames, I suggest making a button to push to set the key frame // You will have to set the time in which each frame starts // first frame starts at 0 seconds, second frame may start at .5 seconds, the 3rd one at .65 seconds, 4th at 1 second... etc   // or you can set it up so that you can just set the very last key frame to the length of the animation and average out the rest of the key frames times from that   // Actually playing this animation you will have to store the total time elapsed in this animation, along with the current index.   class Animation {     float fTimeElapsed;     int CurrentIndex;     List< KeyFrame > frames; };     // You'll want to interpolate between frames to get that smooth looking animation  
  4. Programming a Level Editor

    Having a level editor will make the creation of your levels go MUCH faster.  It will save you a lot of time to go out of the way to create the editor.  Making a 2D editor should take you no time at all. ( Assuming you're using C# Windows Forms for it )
  5. What to do after the basics

    There used to be an awesome guide to creating a text RPG called wrath lands that I was going to post here.  It brought everything in perspective of how you can use C++ for game programming for me.  But unfortunately it isn't there anymore :(   As it's already been said before create some simple little things.   A guessing game where you guess a number between 1-100, have a difficulty setting, easy you get 7 tries, medium you get 5 tries, hard you get 3 tries.   Try to create a text RPG, you don't have to make the full game.  But get it so that you have a battle system that works, and you can travel from town to town. Level up you skills.   Just search google for ideas to apply your skills to and learn.   Even to this date I still go to Project Euler to challenge myself.  It has a ton of logic problems and math problems to solve by programming.  And they're made so that you can't just come up with the answer in your head.
  6. XMMatrixLookAtLH()   The second parameter is the "Focus Position" not the direction.  So for that parameter you might want to add the direction vector to the position vector. // This would be the correct way to do it XMMatrixLookAt(  eyePosition, eyePosition + direction, upDirection );     EDIT: I just realized you used "LookTo" not "LookAt". so my post probably isn't helpful.   is your forward vector valid when you get to the look at function?
  7. Ray/AABB Intersection Incorrect

    Learn a little about AABB to Ray intersect instead of just copying the code.  It's not that difficult if you know vector math.  But there are other guides to help you.   Another topic about AABB to Line Segment ( has Ray to AABB code ) Video Explaining Ray to AABB ( No code, just the math side ) A little guide to creating Ray to AABB Checks ( Has code, gives a little bit of explanation for it too )   EDIT: After you complete that, I would look into using OBB's instead of AABB's if your cube is going to be changing orientation.
  8. Shader always returns white

    PROBLEM SOLVED   My graphics card doesn't support version 3.0 pixel shaders, had to use version 2.0.  I was looking up reasons why ID3DXEffect::ValidateTechnique() would fail and found a topic on here that led me to test the version I'm using.  3.0 works with the vertex shader however... I guess I better put it down to 2.0 just to be safe, just have to be careful with how many calculations I perform.   Before I made this topic I thought about changing those down to 2.0 to see if it worked... I should have done it, but I assumed this computer was new enough to be aware of version 3.0, assumptions can cause problems.  Lesson learned.
  9. Shader always returns white

    OK So trying to set the Technique gives me D3DERR_INVALIDCALL.   I can't find anything helpful on google, but I'm continuing to look.  Also, it keeps crashing in PIX when creating the ID3DXEffect.  Looking into that as well. // Returns D3DERR_INVALIDCALL HRESULT hr = pShader->SetTechnique( "Tech" ); HRESULT hr = pShader->SetTechnique( pShader->GetCurrentTechnique() );   D3DXTECHNIQUE_DESC desc; pShader->GetTechniqueDesc( pShader->GetCurrentTechnique(),&desc );   // 'desc' output is // desc.name = "Tech" // desc.passes = 1 // desc.annotations = 0   // Again here's the shader code // SimpleShader.fx float4x4 gWorld : WORLD; float4x4 viewProj : VIEWPROJECTION;   float4 gColor; float3 gLightPos = float3( 6,4,-5 );   struct VS_IN {     float4 pos : POSITION;     float3 norm : NORMAL; }; struct VS_OUT {     float4 pos : POSITION;     //float4 color : COLOR; };   VS_OUT vs( VS_IN input ) {     // Positions     float3 world = mul( float4( input.pos.xyz,1 ), gWorld ).xyz;     float4 pos = mul( float4( world,1 ),viewProj );       // Normals     float3 norm = normalize( mul( float4( input.norm,0 ), gWorld ).xyz );     float3 ldir = normalize( gLightPos - world );       // Amount of light hitting the obj     float scale = saturate( dot( ldir,norm ) );       // Save     VS_OUT output;     output.pos = pos;     //output.color = float4( gColor.rgb * scale,gColor.a  );       return output; }   float4 ps( VS_OUT input ) : COLOR {     return float4( 0,1,0,1 ); }   technique Tech {     pass pass1     {         VertexShader = compile vs_3_0 vs();         PixelShader  = compile ps_3_0 ps();           CullMode = CCW;         //FillMode = Solid;     } }
  10. Shader always returns white

    Please don't be condescending, I'm trying to get help.  I never post all of my code at once, I try to keep the problem as simple as I possibly can so I can get as much help as possible.  Nobody likes to look at a HUGE wall of code to help with what might simply be a typo when rendering or making the shader =).   PIX hasn't been working well for me,  whether I have the Direct X debugging tools turned on or not.  It becomes an annoyance to mess with and get it to work correctly, which is why I've gotten lazy with using PIX lately. I'm trying again though, will reply with my result.
  11. Shader always returns white

    That didn't change anything, it still returns only white.  I've updated the shader since I first posted it so I'll just re-post it here, but I highly doubt the shader is the problem. float4x4 gWorld : WORLD; float4x4 viewProj : VIEWPROJECTION;   float4 gColor; float3 gLightPos = float3( 6,4,-5 );   struct VS_IN {     float4 pos : POSITION;     float3 norm : NORMAL; }; struct VS_OUT {     float4 pos : POSITION;     //float4 color : COLOR; };   VS_OUT vs( VS_IN input ) {     // Positions     float3 world = mul( float4( input.pos.xyz,1 ), gWorld ).xyz;     float4 pos = mul( float4( world,1 ),viewProj );       // Normals     float3 norm = normalize( mul( float4( input.norm,0 ), gWorld ).xyz );     float3 ldir = normalize( gLightPos - world );       // Amount of light hitting the vertex     float scale = saturate( dot( ldir,norm ) );       // Save     VS_OUT output;     output.pos = pos;     //output.color = float4( gColor.rgb * scale,gColor.a  );       return output; }   float4 ps( VS_OUT input ) : COLOR { /*     float3 ldir = normalize( gLightPos - input.world );     float3 norm = normalize( input.norm );       float scale = saturate( dot( ldir,norm ) );       input.color.xyz *= scale;     return float4( input.color.xyz,intput.a ); */     return float4( 0,1,0,1 ); }   technique Tech {     pass pass1     {         vertexShader = compile vs_3_0 vs();         pixelShader  = compile ps_3_0 ps();           CullMode = CCW;         //FillMode = Solid;     } } Here is the result           EDIT: static volatile const unsigned long long var[5];   // ^^ WIN!! Got bored lol
  12. question about pathfinding

    A* can be complicated for beginners.  But it's the most widely accepted algorithm, and after you get the Breadth First Search complete the rest should be a piece of cake ;)
  13.   Buckeye wasn't just talking about the debug tool, he was talking about debugging.  The debug tool is a Tool to help you debug, you don't always need it to debug.     EDIT:  Said debug too many times, now it has no meaning lol.
  14. Finding covered tiles of the brush

    Not an expert on this or anything, but no one else has replied so I will put in my opinion =P     From what your saying it seems like I would personally do something like casting a ray from the camera and get the point of collision on the terrain from that ray.  Then create a vertical cylinder, rectangle, or whatever the shape will represent your brush the best, then test that geometric shape against the terrain to find all of the tiles that are either inside or colliding with the shape.   Hope this helps!