• Content count

  • Joined

  • Last visited

Community Reputation

127 Neutral

About Dekasa

  • Rank
  1. Best language for beguinner?

    Both Python and C# (XNA) will work great for what you're doing, and both are great choices. You really can't go wrong, I'd just look at some code for each and pick whichever you feel you can read better.
  2. If you're just worried that it's getting bigger than you can handle, it sounds like it's time to learn how to refactor. Refactoring is a very useful (even necessary) skill to have, especially once your project gets to a decent size. If you're worried about it taking too much time, not having enough time, or are bored and want to do something else, then just drop it. What I think you should do, is to get it to a state where it's "done." Or at least, where everything works, and it's more or less complete. Then refactor it. Then add everything you want.
  3. Better way of creating Attacks?

    way2lazy: I guess I didn't say it, but I (after reading the previous responses) did implement an 'owner' reference into the Attack class. Attacks know their owners and exclude them (not via team ID), Character's just don't know their attacks. Attacks resolve their own collision, and send the proper method calls to those taking effects (enemy is hit, it calls Enemy.takeHit. Teammate is healed it calls Teammate.takeHeal, etc.) It's more that attacks are responsible completely for themselves, a Character isn't responsible for its attacks, but an attack can call its owner for things like you mentioned, and an attack now excludes its owner through that reference, not the team ID. And that hit everyone to heal might be a neat idea.....
  4. Better way of creating Attacks?

    Alright, sounds like this isn't a bad design so I'll probably do it this way. Captain P: I do plan on either altering or inheriting from this class for probably all forms of attack, especially long-range. That's why I liked the idea in the first place. I can use it for a sword strike, an arrow, and a theoretical triple arrow can just create 3 attacks, give them slightly different Vectors, and be off. Samoth: The Team ID isn't necessarily anti-friendly fire. It's more because a sword strike's bounding box will usually collide with the character's box, and this allows me not only to avoid that calculation entirely, but not hit myself. As of now you don't have a team, anyway, but for bigger attacks it lets me specify whether it hits everyone (meteor hitting the screen) or hits only enemies (magical smart fireball) or does different things based on your team (spell heals me and hurts you). And the "hit-before" is that if an attack can hit multiple enemies, I don't want the arrow going through an enemy to strike them every frame. It'll do random damage based on framerate, and and any physical force imparted will go from natural and small to unnatural and strange. Akitsune: That counterattack idea is neat, I might have to do that just for the extra possibilities it opens up. Currently the Attack class does take all of its necessary components immediately on creation, but thanks for noting that. And after thinking about it more, it definitely feels like a Character shouldn't know what attacks are theirs and what attacks they've created. For any special attacks that create many attacks (one for each projectile) it'd be a big pain for a Character to store/remember all of them. Thanks guys!
  5. Ok, necessary background. Action-RPG game, character runs around, pushes a button, and attacks. Character has a Strength variable, and a Weapon Object, and a createAttack() method. There is an Attack class that takes a baseDamage variable, Character.Position, and Character.Velocity/Direction. So how attacks are created/used is like this. Keyboard input is taken in Update, if the button for attack is pressed, it calls Character.createAttack() which sends all the parameters to a new Attack object which then has its own position, velocity, collision boundaries, and is in every way separate from the creating Character. When a collision is detected between an Attack and a Character, Attack is sent a reference to that Character, and checks whether or not it hits the Character (might not hit because they're on the same team, or the enemy was hit before, etc.). It then calls the hitCharacter.takeHit method, passing in it's damage, force Vector & magnitude. Character's takeHit method lowers its health and moves the Character. Is this an acceptable/good way to do this? I'm curious mostly about whether or not a Character should "own" it's attacks (other than a friendly-fire id). Comments, suggestions?
  6. Just to say, first, ShadowFlare's post is very useful and will work well for what you're doing. I just wanted to come in and say how I did things, multiple views are good. To automatically decelerate, all you have to do is add a friction variable, and multiply your velocity by it. Looks something like this. Velocity = 0f; Friction = .95f; //Should be close to 1, but never 1 and never over 1. If(Right || Left) set acceleration to +-2; Velocity = acceleration * time; Velocity = Velocity * Friction; //this makes Velocity lower every time. if(Velocity > Max_Velocity) //make sure you don't go faster than your person should go Velocity = Max_Velocity; else if (Velocity <= .1 || Velocity >= .1) //helps with stopping Velocity = 0;
  7. Kinda loosing faith about...

    I believe you're much more likely to fall into bad habits of programming if you learn it when you're younger. I'm 22 now and I wouldn't touch any of the code I wrote when I was in my teens. So, learn how to code the "right" way. Learning to use good naming conventions and writing well-documented code are more important than when you started learning.
  8. Bounding Box and Gravity

    You're going about gravity a little off. Gravity = acceleration. Don't worry about the Force part, that doesn't affect your velocity. Think of it like this: Plane position = acceleration + velocity + original position. So every time you update your plane's position (dealing only with the Y axis, here), you take how much thrust or lift your plane has (player is pressing the Up or Down keys), and then take into account gravity. So, more than not, find a nice, lowish number to represent gravity, and subtract that from your plane's Y position every frame. I'd go into more detail, but I'm not sure where your math is, nor do I know how accurate physically you want this to actually be. For the bounding box question, it's pretty simple. You just make a rectangle, or circle, something that could hold your model inside of it, and have its centerpoint be the same center as the plane. That way, the box/circle/sphere moves with the plane, and for collisions, you just check to see if something hits that box, and if it does, then it hits the plane. Local coordinates are just coordinates with respect to the plane. If the box is in front of the plane, it might have the coordinates (plane.X + 10, plane.Y). This way, the box doesn't need to know its absolute position, it just takes its position in reference to the plane, itself. This way it'll automatically stay with the plane.
  9. A few questions

    C# is a great beginning language and the free XNA framework is an excellent tool to get you started. C++ isn't a worthless language, but as Atrix pointed out, it's difficult to learn. It has a lot of quirks... a LOT of quirks. Blender is a great modeling program. At least, that's what I always hear.
  10. Most of making efficient collision detection is around making as few actual checks as possible. The ways to do this vary, and include spatial partitioning (Don't check collisions for far-away objects), ensuring you only check objects once, and making sure you don't check objects that it doesn't matter if they collide (2 pong paddles will never collide, and even if they did, it wouldn't affect anything), the last way is kind of an extension of the first, oftentimes you use "cheap" detection first, then accurate detection later (ie. having a circle surround your object, and only if that intersects anything, do a more accurate rectangle collision check, because circle detection is cheap (computationally) and rectangles are more expensive). For pong, all you'd ever have to check is whether the ball collides with things, so for it, you could have the ball check for collisions every time it updates. But for more complicated things, you probably want some other manager taking care of collision detection. I like to use a Dictionary to take out unimportant detections, like a character and their own attack, or two trees. Any detection with a separate CollisionManager class using even basic partitioning should be able to calculate thousands of potential collisions in a frame, so yes, collision is called every frame for nearly all objects.
  11. Game engine?

    Alright, I'll fill you in on the things I know (not terribly much). 1. I always liked the FlatRedBall engine, personally. But I know a lot of people like Unity, too. 2. C# is easier to use than C++. You don't have to deal with memory management so....strictly. You do need to keep in mind your memory, but you don't have to manually delete your variables. Also, C# is built with OOP in mind, so to me feels more natural when writing OO code. 3. Don't know, haven't used Unity. Oh, and FlatRedBall is written in C#, so if you go that way, it's a good choice. If you go C++ Unity will probably work better.
  12. What 3D game engine should I use?

    I found myself in a fairly similar boat as the OP a few years ago, had done some minor stuff, wanted to do more, etc. What I found is that C# is a great language, and MS' XNA Studio is *excellent*. There's a good community, it has a lot of great libraries, and I would definitely suggest at least looking into it. C# is a clean, straightforward language, and doesn't have a lot of quirks that C++ has (though, I haven't worked with C++ much, and nothing serious). The biggest thing I know is, if you want to make it work, you're going to have to work for it. That's not to sound threatening or intimidating or anything, it's just that programming isn't the easiest thing you've ever done. You have to learn, and you have to want to learn.
  13. Flash - Connection between stage and code

    Ok, I actually found this (more or less), but one thing I still can't do is make an object that I have a .as file for. Like, I made an object inside a script file, but how do I get that onto the stage. When I put code in the actions of layer1 (on the timeline) it says it can't find it.
  14. New to Java

    I came to Java from C# and I really like NetBeans. Syntax for C# and Java are nearly identical. If you are a mature programmer and just don't like syntax in general, Ruby is fun.
  15. Game running slow

    Also, I don't know how you did all your timings, but you should use a dynamic timestep. More or less, everytime your loop iterates, you take how long has passed, and you send that to everything you call so when the bullet(or whatever) updates how far it travelled last frame, it uses that. Something like this: time_passed = how long has passed since the last time we updated bullet position bullet_speed = how far a bullet goes in 1 millisecond bullet_new_position = bullet_old_position + time_passed * bullet_speed; However, there's definitely another issue if you're seeing a slow-down on 100ms loop, and it's almost certainly with collision detection. For your collision detection, you should use a bounding box (circle, actually) for every collidable object and test those circles first, then if those circles intersect do an accurate collision detection. This is because collision detections on circles is vastly cheaper than CD on every other kind of object (for mathematical reasons). We do these detections because if a circle bigger than an object doesn't intersect with a circle bigger than the other object, there's no way those two can touch.