MrTwiggy

Members
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

107 Neutral

About MrTwiggy

  • Rank
    Newbie
  1. [quote name='WavyVirus' timestamp='1339519426' post='4948540'] If the only difference between the characters is the values of the member variables, there is no need to create a sub-class for each character type. You can have a single character class and simply pass in the correct values when you construct it. Only if the different characters behaved in fundamentally different ways would you need to consider adding classes specific to each character type. [/quote] But, say you wanted a multiplayer game. Even if the only thing that differeniates different characters is different values, wouldn't it be better/easier to have unique classes for each character that inherits from the base character class, and then when people are selecting their character, you could set their character type to the class for the unique character, rather than constantly calling functions that are hardcoded in and would set the values for each specific character?
  2. I have a question based off the answers given. Would it be better to have a base character class that has universal members that all would have, texture, position, animations, sounds, move speed, etc. Then have a different class for each character type that inherits from the base character class, but gives it`s unique values to the members? Would that be the best way?
  3. I'm not sure if I'm understanding right. Do you mean that all of the sprites are different in size, and at random positions? Or do you mean you have multiple textures/animation sprites, each with their own size, and location? For example: If you have a character with a run animation and also a jump animation on the same sprite sheet, each with 5 frames. Are the 5 frames for the run animation all the same size, and are next to each other in order, while the jump animation has a different 5 frames, all with the same size, except it is a different size from the run animation, but each are in order? If so, thats a relatively easy fix. I had something like this before, however the way I structured my animating classes fixed it. Esentially, I had a base Animating class with drawing functions/methods, that was passed in an 'Animation' variable (a seperate class), and the 'Animation' class had its own name for the animation, starting location of the first sprite, number of frames, size, etc. and various other intuitive functions that determined the frames to be used. And all these animation variables were declared inside the Player class (hard coded). This was in XNA, so I'm not sure if it will work for whatever program your using. Best of luck.
  4. [quote name='wildbunny' timestamp='1302212179' post='4795673'] [quote name='MrTwiggy' timestamp='1302211882' post='4795670'] Hey. Yeah, I actually did. It's really well done, but unfortunately the C++ portions of it clouded it a bit too much for me to get enough out of it, just because I don't understand the inner-complexities of the actual C++ language. Really great thing though. [/quote] The code snippets and examples are actually written in flash [/quote] Ahh xD I just figured it was really complicated C++, haha.
  5. [quote name='wildbunny' timestamp='1302182342' post='4795495'] [quote name='MrTwiggy' timestamp='1302174244' post='4795464'] When you are controlling player movement, I'm assuming you add a force to the player, correct? Which causes an increase in acceleration, and thus an increase in velocity and position. However, how do I limit the input force, but not the external forces? (Such as riding a train) Because, in these games, the players accelerate, and then they reach a maximum speed. But how do I enable that effectively for the input speed? EDIT: Also, does anyone know any good tutorials or guides that go in-depth with a 2D rigid body dynamics physics engine? I have found some, but they are almost all in C++, and the inner-working of C++ seem to complicate everything even further. So hopefully something that is either not language specific, or is C# or XNA specific. Thanks. [/quote] Did you see my article Physics engines for dummies? Might give you some pointers [url="http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/"]http://www.wildbunny...es-for-dummies/[/url] Cheers, Paul. [/quote] Hey. Yeah, I actually did. It's really well done, but unfortunately the C++ portions of it clouded it a bit too much for me to get enough out of it, just because I don't understand the inner-complexities of the actual C++ language. Really great thing though.
  6. When you are controlling player movement, I'm assuming you add a force to the player, correct? Which causes an increase in acceleration, and thus an increase in velocity and position. However, how do I limit the input force, but not the external forces? (Such as riding a train) Because, in these games, the players accelerate, and then they reach a maximum speed. But how do I enable that effectively for the input speed? EDIT: Also, does anyone know any good tutorials or guides that go in-depth with a 2D rigid body dynamics physics engine? I have found some, but they are almost all in C++, and the inner-working of C++ seem to complicate everything even further. So hopefully something that is either not language specific, or is C# or XNA specific. Thanks.
  7. Do you have any portfolios or example of your artwork?
  8. Thanks everyone for your replies! Although, my goal right now isn't really to create a full-fledged physics engine or system, it's mainly to have a force based transferrence. So like SeanH said, something with just rigid objects and force-transferrence. I really appreciate all of the replies, and I will definitely be able to use some of it [quote name='Mussi' timestamp='1302058677' post='4794873'] [quote name='MrTwiggy' timestamp='1302054144' post='4794851'] I sort of have an idea for the end result of movement. I could have a net-force object on the player, for example, that is an object of a seperate class, that holds it's scalar force in Newtons, and it's direction in degrees or something, which would have it's own function to translate that into a vector quantity that can be added to the player's position that roughly translates into that net-force of movement. However, the trouble I am having understand, is how to use collision detection and force-transferrence. Stuff like, applying gravity to the players net-force, using collision detection and normal forces that oppose force of gravity and whatever else. [/quote] Force is a vector, why would you want to store it as a scalar? If you were thinking of writing your own physics engine I would highly recommend you not to. There are libraries freely available, why not use one of those? [/quote] Well, the way that I've learned it in class (which might be wrong?) is that a force can be represented like this: 220N[E30N] or something like that. So I decided for the sake of accuracy and simplicity, which might sound likes it more complex, but I figured it's a lot easier to just see 220N [E30N] than seeing a Vector2 quantity of (20, -8). So I thought that having a method inside of the net-force object that translates that automatically into a Vector quantity might be easier to manage? I'm not sure. Also, I wasn't really thinking about writing my own full fledged engine. I have no idea was rays, ambiance, torque, soft-body (I assume like rubber?) and all that other stuff is. The only physics that I actually know or have learned yet is the basic rigid-body physics with force transference and net-force. Also, I'm not really creating it for practicality (but I will use it), but mainly for educational purposes. I think it would help me with my understanding of the basic physics, learn more about force-transference in coding and how to implement it, and become useful in the future, as I hope to start a 2D-Platformer soon (Mario clone anyone?). Thanks again, -Ty EDIT: Also, I just remembered some stuff and came up with an idea. Newtons are forces, and refer to acceleration more than velocity right? I mean, if you apply a 1000N force to a 1kg object for a split second, it won't automatically go to 1000m/s, but it will accelerate at a rate of 1000m/s^2. So perhaps, as an example, I would have a player, and I would have TWO objects inside of it. A net-force object, and a Vector object called Velocity. This Velocity would be added to the players collision at the very end of every update loop (and it would be multiplied by the ElapsedTime in seconds between frames, so that everything maintains a per second basis). Right before the end of the update loop, before you add the velocity to the players position, I would run a method in the Net-Force object that translates the total force into an acceleration amount for that frame, and add it to the velocity. So once that's done, all I need to do is before the end of the update loop when it does that, I can just add and subtract forces and such to the player's netforce. I mean, in theory, that sounds correct. But there could be a gaping hole in it? Any thoughts?
  9. [center][i]Note: I realize after writing thing, it is quite long. And I tend to ramble at some parts, so sorry for that.[/i] [/center] Hey, there! First off, I wasn't sure whether this should be in 'Math and Physics' or 'For Beginners'. Because, I am a beginner and this is sort of a beginner question, but it's related closely to physics and math. If this isn't the right area, please feel free to move it, and I apologize. Anywho, onto the situation. I'm a student in currently finishing my 11th year of Highschool. I've taken one introductory course into CS (c++) and have quite a bit of my own time learning about programming in general, and focusing mainly on C# and the XNA framework, which is a great starting point IMO. I'm part of a team that makes Indie Games for the Xbox 360, but I work with a more experienced programmer who helps me, and oversees my work. I'm planning on attending university (Carleton University to be exact, but it's not really well-known, and it's in Canada. So you probably haven't heard of it ) and getting my Honours degree in Computer Science, with a specialization in Game Development (Which I was careful to be sure it wasn't some flimsy degree centered on game design just to make easy cash from prey.) Although, I'm beginning to realize I am off course. Anyways, I'm currently in my first course of Physics, so my knowledge on the subject is fairly limited. I have a basic understanding forces and Newton's three laws. I understand normal forces, free-body diagrams, the effects and force of gravity, net-force, friction (Static and kinetic) and velocity-related stuff. I realize that likely seems like very little to most of you, especially those who have minored or majored in physics already. But, that's what I have to work with. I was hoping to get some basic knowledge of how I can implent fairly standard and basic physics into games that I would be creating (likely with the XNA framework). The only problem is, I'm not sure how to structure everything. I mean, I COULD go out there and find some sort of physics engine, but those are typically extremely complex and long, and do far more than I need it to. And since I'm so relatively new to programming, I have a hard time reading, understanding and grasping other peoples' concepts and ideas for programming and their code. So I want to do my own. It wouldn't have much, it would not have particle systems and squishy stuff or whatever, xD. Just mainly a collision detection system, with friction, gravity, and all that stuff for players to move and collide with the world and objects. I realize that I could probably do this with 'magic', which I have done before. But it's typically VERY bug-prone, and it just doesn't feel right. So I've decided to try and build a system that implements atleast semi-realistic physics in terms of forces, gravity and opposing motion (walls and the such). However, I'm not really sure how to implement those things into code. I sort of have an idea for the end result of movement. I could have a net-force object on the player, for example, that is an object of a seperate class, that holds it's scalar force in Newtons, and it's direction in degrees or something, which would have it's own function to translate that into a vector quantity that can be added to the player's position that roughly translates into that net-force of movement. However, the trouble I am having understand, is how to use collision detection and force-transferrence. Stuff like, applying gravity to the players net-force, using collision detection and normal forces that oppose force of gravity and whatever else. Upon further thinking, I suppose perhaps I could do something like this. I would have the player's net-force object. Then when I detect a collision between, say, the floor, I would calculate the force of gravity (perhaps with a method in the player class that returns the force of gravity) and then have a function in the floor object that determines the normal force and adds it to the players net-force? I'm not really sure, and I'm sort of lost. Maybe I'm over my head, and should stick to magic until I'm done atleast my first semester of physics. Or if anyone has any other suggestions or ideas, I'd love to hear it. Anywho, thanks for reading all of this, if you did. I appreciate any comments or feedback that are constructive in some way. -Ty