Beginner - Intermediate Tutorials

Last post 04-28-2008, 6:24 PM by Sueds. 47 replies.
Page 2 of 2 (48 items)   < Previous 1 2
Sort Posts: Previous Next
  •  01-21-2008, 7:33 PM

    Re: Beginner - Intermediate Tutorials

    So I worked through the first 4 tutorials (good job btw) and started messing around with the code to see what I could do without a guide.  I wrote some code for reading the mouse x and y values, and can get the camera to rotate vertically and horizontally, but only separately.  I tried combining them and weird stuff starts to happen.  This is how the RotateCamera method looks right now:

    public void RotateCamera()
    {
    cameraRotationX = Matrix.CreateRotationY(turnHoriz);
    cameraRotationY = Matrix.CreateRotationX(turnVert);
    transRef = Vector3.Transform(cameraRef, cameraRotationX + cameraRotationY);
    lookAt = transRef + position;
    view = Matrix.CreateLookAt(position, lookAt, Vector3.Up);
    }

    I assume that there is an easier/correct way to go about this, but can't figure it out. 
  •  01-21-2008, 10:14 PM

    Re: Beginner - Intermediate Tutorials

    Hey, thats great that you're experimenting on your own!  I've tried messing with up and down but they always would screw up when I combined the two probably similar to what you're talking about.  I thought about adding this to the tutorials but I think that tutorial gives a good overview.  Check online for some examples.  A good example but quite complex version is on the dhpoware site (just Google 'dhpoware' or 'XNA FPS Camera').  Sorry I can't really help any more than that, but I haven't gotten that to work either because I haven't spent enough time on it :p
  •  01-23-2008, 2:21 PM

    Re: Beginner - Intermediate Tutorials

    I did not find the demo on you web site can you give me a link to it ?
  •  01-25-2008, 10:44 AM

    Re: Beginner - Intermediate Tutorials

    Demo?  I don't have any downloadable demo's on my site unless you're speaking to someone else who posted here...
  •  02-22-2008, 5:58 PM

    Re: Beginner - Intermediate Tutorials

    So XNA gets to announce new things and I don't?  Not a chance!  I'm back to working on these tutorials and starting out I've updated the website for them.  The new website can be found at:

    http://matt.insidegamer.org/xnatutorials.aspx

    Added to this page are all the links to various downloads, extra articles, and even the article code!  And to top it off, what if I told you what to expect from the next tutorials?

    Considering they're beginner-advanced, and we've got 3D, a camera, and a HUD, the next tutorials may get a bit more complex.  Watch out for low-flying one of the following tutorials:

    - GameStates
    - Audio
    - Saving/Loading
    - Lighting and Shaders

    It's going to be a fun semester :)

    (P.S.  Sorry for ressurecting such an old dead beast of a forum topic, but it's kind of like my own personal sticky for these items.  Plus, I don't want to clutter the forums with multiple posts with just updates)
  •  02-22-2008, 9:20 PM

    Re: Beginner - Intermediate Tutorials

    XNA tutorials on a Cold Fusion page instead of an ASP.NET page?!? Say it ain't so! :(
    Jim Perry
    Here's what I'm up to.
  •  02-22-2008, 10:48 PM

    Re: Beginner - Intermediate Tutorials

    Machaira:
    XNA tutorials on a Cold Fusion page instead of an ASP.NET page?!? Say it ain't so! :(


    I could probably update it to ASP :)  One of my jobs is working in ASP so I could probably update it.  I don't know what the server requirements are for Silverlight but maybe it'll come to that.  Either way, I'm thinking about a new style for that website which will require a change soon.  In fact, your post has possibly persuaded me to get started on that ASP...er I mean ASAP (bad pun).

    UPDATE:  I'm working on a new site layout using Visual Studio Pro 2008 for programming and Microsoft Expression Studio for the graphics.  Now I just need the server to support it....
  •  02-29-2008, 5:28 PM

    Re: Beginner - Intermediate Tutorials

    Ask and you shall receive.  How's the new site looking everyone?  Remember, the old one was completely black and white...

    http://matt.insidegamer.org
  •  03-08-2008, 6:22 PM

    Re: Beginner - Intermediate Tutorials

    I'm just working my way through your tutorials.  They're fantastic so far!  Thanks for making them available.  One small typo I just ran into in tutorial 3 it says "You can see where the front clipping plans" It should be plane instead of plans. 

    Thanks agian!

  •  03-10-2008, 11:37 AM

    Re: Beginner - Intermediate Tutorials

    Thanks for the edit!  I've changed it so it should be right if you grab the new one.  Let me know if you find any others (typically I don't read it over again to find mistakes like that).

    Also, for anyone interested, Tutorial 6 is up.  It deals with game states and introduces a Pause, Loading, and InGame state to your project.  In a few days I should (hopefully) be done with Tutorial 7.  It's over half done and deals with integrating audio into your project.
  •  03-10-2008, 12:59 PM

    Re: Beginner - Intermediate Tutorials

    are you planning to make some basic collision detection ? with your fps camera or somting ?
  •  03-10-2008, 2:25 PM

    Re: Beginner - Intermediate Tutorials

    I hadn't currently planned to but if you want that instead of one of the following, let me know.

    Saving/Loading
    Shaders
    Advanced Shaders (this one is the one that would probably be best suited for a substitution)
  •  03-10-2008, 11:33 PM

    Re: Beginner - Intermediate Tutorials

    Yes, replace the Advanced Shaders for an Animated model controlled by the keyboard and that also collides with the enviroment ( terrain, wall, trees, etc )
  •  03-13-2008, 2:06 PM

    Re: Beginner - Intermediate Tutorials

    Just finished the last of your tutorials - they were all very clear and easy to follow.
  •  03-23-2008, 2:33 AM

    Re: Beginner - Intermediate Tutorials

    Maybe you already know it but some guys have ported jiglib physics engine. The project is still a t the beginging but there is already some very useful feature ( the vertex processor is one of them ). You could maybe use it for your fps camera tutorial. I've seen on their wiki that the creator of this project don't have the time to make a tutorial so it could be a good opportunity to achieve something interesting. MAny people are looking forward documentation or tutorial of any working physic library.

    Anyway I hope you succeed and give us many more tutorials.

    http://jiglibx.wikidot.com/about
  •  03-23-2008, 6:03 PM

    Re: Beginner - Intermediate Tutorials

    XNAtticus:
    Blackgate:
    ...



    Few items here to address.  If you are using XNA Game Studio 2.0 (which you probably should be but if not, don't worry), you won't have the lines:

                if (loadAllContent)
                {
                   
                }

    Instead (and this is very imortant), you will have this line:
       spriteBatch = new SpriteBatch(GraphicsDevice);

    In the first case, you should be able to put the gameSprite initialization within the if(loadAllContent) brackets.  If you're using 2.0 just make sure you place it after spriteBatch = .....  (That spriteBatch is what you are passing to your GameSprite constructor).  Since I've changed the tutorials to support 2.0, I don't need to declare a new SpriteBatch object (it's already done in a default game).

    This line:

                    gameSprites = new GameSprite(this.Content, spritBatch);

    Looks like you are missing an 'e' on the word 'spriteBatch'.  Maybe that's giving you the error?  Again, if you are using 1.0 you need to define a SpriteBatch object.  In 2.0, the object is already built for you (another advantage of getting 2.0).  But, if you are using 1.0, make sure you add the following to the top of your Game1 class around your other objects:
            SpriteBatch spriteBatch;

    Then in the LoadContent (in the braces) you will need to create one.  Since I have 2.0 I'm not positive I remember if the constructor is the same, but it will probably look like:
                spriteBatch = new SpriteBatch(graphics);

    So, I would first try fixing that spelling error if it is wrong.  If it isn't fixed either 1) create and instantiate a new SpriteBatch object (XNA 1.0), or 2) Place the line after the spriteBatch initialization in LoadContent() (XNA 2.0).  Hope this isn't confusing, I'm trying to cover both 1.0 and 2.0 because it sounds like you have 1.0.  If this doesn't fix it come back and let me know which version of XNA you're running and the error (you can send me the code if you like, matt at insidegamer.org)

    I'll try to get the code up with the tutorials.  I had struggled with doing that only because 1) for some it could encourage copy and paste and no learning will really take place, and 2) my code may be inconsistant with yours.  But since you've asked for it I'll try to get it up there ASAP (within a few weeks).  Let me know if all this helps and thanks for the kind words on my tuts!  :)


    Currently I am following your tutorials with great pleasure.
    I went wrong somewhere, but I can't really figure out where. It's a bit like Blackgate's error.

    I get: Object reference not set to the instance of an object.

    gameBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Deferred, SaveStateMode.SaveState);
    in the DrawSprites method.

    I do have the spriteBatch = new SpriteBatch line. Except it requires a GraphicsDevice instead of a GraphicsDeviceManager.

    I was wondering a second thing. Default classes like GameComponent or DrawableGameComponent exist. Those have default initialize and update methods like you are creating yourself now. (Excuse me if I am wrong). Is there a reason why you create them yourself?

    I am not entirely sure. Currently I follow classes XNA at highschool. My teacher mentioned it once a while ago.

    Hopefully you can help me out and keep going with these tutorials. I really like them:)
  •  03-24-2008, 12:05 PM

    Re: Beginner - Intermediate Tutorials

    Dennis:

    Currently I am following your tutorials with great pleasure.
    I went wrong somewhere, but I can't really figure out where. It's a bit like Blackgate's error.

    I get: Object reference not set to the instance of an object.

    gameBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Deferred, SaveStateMode.SaveState);
    in the DrawSprites method.

    I do have the spriteBatch = new SpriteBatch line. Except it requires a GraphicsDevice instead of a GraphicsDeviceManager.

    I was wondering a second thing. Default classes like GameComponent or DrawableGameComponent exist. Those have default initialize and update methods like you are creating yourself now. (Excuse me if I am wrong). Is there a reason why you create them yourself?

    I am not entirely sure. Currently I follow classes XNA at highschool. My teacher mentioned it once a while ago.

    Hopefully you can help me out and keep going with these tutorials. I really like them:)


    I would first suggest determining whether you use Game Studio 1.0 refresh or 2.0 (most likely 2.0 and if not, you should seriously consider upgrading).  In 1.0 you need to create a sprite batch and use it in your GameSprite class, but in 2.0 the spriteBatch is created for you and you just need to pass it.  In 2.0, the spriteBatch is declared first in the Game1.cs file in the LoadContent() method.  Your initialization of your gameSprite class object should appear after this and pass the spriteBatch, so it should look something like this near the top of the LoadContent() method in Game1.cs:

                spriteBatch = new SpriteBatch(GraphicsDevice);
                gameSprites = new GameSprite(this.Content, spriteBatch);

    The way the error is sounding, your gameBatch variable is missing somehow.  If these lines don't fix it send me your .cs files (matt@insidegamer.org), I'd be extremely happy to look them over and help solve the problem.

    Also, I only 'don't use' GameComponents simply because I'm not completely familiar with them.  From what I've seen online, yes, they do automatically have some of these functions built in but really only to make programming easier for the new guys (which I'm fine with).  But I've always been an advocate of starting with a completely blank document (although a new class file in XNA isn't really blank) and coding something from nothing.  Not only do you learn every piece of it then, but if you move to a language like C++ you won't have GameComponents and you'll need to know when to write the methods and what they do, when they're called, etc...  Primarily though, I'm just not familiar with them.


    Responding to Akai Kaze, sounds like a good idea to write one based on a physics library.  I'll look into it more.  The biggest problem would be that I'm really bad at physics :p  But I'll definitely look into it (maybe integrate it as Tut 10 instead of collision?).

    Finally, I want to thank everyone who's checked out my tutorials.  I was randomly checking my website traffic and the tutorial site gets over 7 times the traffic the main page does and the tutorials are the hottest links on the site.  Hopefully this means everyone likes the tutorials as much as I like putting them up.  Don't be afraid to email me with problems, suggestions, or just to talk gaming or programming (especially you Dennis! :) )
  •  03-24-2008, 1:56 PM

    Re: Beginner - Intermediate Tutorials

    I have 2.0(not the beta). I somehow forgot the second line.

    I see your point. Currently I am following Information Sciences at The Netherlands.
    So far I learned Java, C# and currently working on C++. I noticed your C++ habit as well:) (The destructor). A optional part on the study is Game programming. Where we use XNA on this point. (Although I am not officially following it, I follow it for a side project).

    Its really interesting and I like to follow your tutorials. As I just said. I added the line and it all works really smooth now. I look forward to the upcoming parts:).

  •  03-24-2008, 2:44 PM

    Re: Beginner - Intermediate Tutorials

    I'm glad you got your stuff to work now.  I'm in college in the Applied Mathematics and Computer Science degree with a concentration in Software Development but it's more math than anything else (I think I've had 4-6 computer classes in 2 years), so I understand learning other things in school while still keeping up in the programming area.
  •  04-18-2008, 6:56 PM

    Re: Beginner - Intermediate Tutorials

    Hi XNAtticus,

    Just wanna thank you for taking the time to write these tutorials.
    I'm moving on to tutorial 5 now and so far you tutorials are very
    good and i'm learning alot.

    i'm currently on a crash course mission to learn how to control animated characters in xna,
    but so far to no avail, I've looked at the skinning sample and it's not making sense to me,
    but going backwards and going through your tutorials so far, at least i'm starting to understand basic concepts in programming.
  •  04-28-2008, 7:34 AM

    Re: Beginner - Intermediate Tutorials

    I've just add your gameCamera class and I'm having a sort of clipping and I don't know how to ride it off.

    am I the only one having this problem ?


  •  04-28-2008, 5:55 PM

    Re: Beginner - Intermediate Tutorials

    Can you explain what you mean by clipping?  Maybe post a screen if possible?  I'm assuming its some problem with the model that's visible.
  •  04-28-2008, 6:24 PM

    Re: Beginner - Intermediate Tutorials

    sorry I'ts my own mistake ! I was using a weird vertex declaration ! so it's fine

    thanks anyway
Page 2 of 2 (48 items)   < Previous 1 2
View as RSS news feed in XML
©2007 Microsoft Corporation. All rights reserved. Privacy Statement Terms of Use Code of Conduct Feedback