Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

386 Neutral

About BitBlt

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. BitBlt

    Calculating "Spread" for shotgun shot

    Why not? Intuitively, and experimentally, buck shot spreads out as it travels. The exact position of each pellet each time you fire will essentially be random (at least locally). However, the overall statistical behavior can be predicted and can be easily modeled as a Gaussian distribution in 2 dimensions. I imagine this was their motivation.
  2. Those are probably fine, but notice that they are identical, modulo the sign. A simple test of the target location compared to the launch location should tell you which sign you need. For example, if target_x > start_x, then a negative x velocity will obviously not get you there. Ditto for the y velocity. So just code up these equations and do some quick tests to determine the sign. And I'm pretty sure a negative sign doesn't make sense, and probably correlates to the issue Kian was talking about.
  3. BitBlt

    Euler Integration & Collision Response

    Just once per timestep. You are integrating a force over a time interval, so once that change in velocity is "in there", you don't have to integrate again until the next timestep. BTW, by updating your velocity before your positions, you are using a variant of euler integration called symplectic euler, or sometimes semi-implicit euler, that is significantly more stable than explicit euler. Point being, don't worry too much about RK4 unless a) you are interested (if so, kudos), or b) you need the additional accuracy. (b) seems unlikely.
  4. If you know the impulse is 600, then that gives you the magnitude of the initial velocity, which I'll call m: v_x^2 + v_y^2 = m^2 = 600^2 This gives you 3 equations for 3 unknowns (v_x, v_y, t) which you can solve. Here are the equations explicitly: v_x t = x 1/2 g t^2 + v_y t = y v_x^2 + v_y^2 = m^2, Since they're non-linear they are a little messy, but you only have to do the algebra once and you'll have closed-form expressions. You could also stick them into Mathematica and solve. Keep in mind that you will get multiple solutions because v_x = +/- sqrt(m^2 - v_y^2), but it should be obvious whether to use the positive v_x or the negative, depending on where your target is. BTW, I could be overlooking some simpler way of solving this by using the angle directly instead of solving for (v_x, v_y) then computing the angle. Specifying the time of flight t would mean you don't need the extra eqn. to solve for (v_x, v_y), but it would also mean that the time of flight would be the same for all projectiles, no matter how far away they are from their target. This could look awkward.
  5. BitBlt


    I've been using a pair of Klipsch earbuds for a few years now that sound phenomenal. I think they were $70-80USD. I plug them into my laptop at coffee shops and such, so I can't vouch for them holding up to wearing during sports / exercise, though.
  6. BitBlt

    2D Collision Response

    Hi Mark, What you are doing is called "Jacobi-style" iterations, and it's the same idea as the one from linear algebra. Basically, you are using the same previous vector for ALL computations in this iteration, and you only update at the end. This means, in your case, that the 2nd collision response doesn't "see" the response applied from the first. The result: bouncing rather than sticking. One option is to switch to Gauss-Seidel iterations, where the current position/velocity is update after each collision response and used as input to the next. For your example: player is positioned at (0,0) and tries to move to (50,0). The "velocity" is then (50,0) (50 minus 0). You see a collision with one object, and the SAT detection returns (-1, 0) as the collision normal. The relative velocity in the normal direction is -50. I assume the player is receiving all the impulse so you compute v_new = v_old - n * J, where v_old = (50, 0), n is (-1, 0), and J = -50. This gives v_new = (0,0), which when added to your position gives an end position of (0,0). Now, instead of using v=(50,0) for the input to your second detected collision, use (0,0). Now, when you compute the relative velocity you will get 0. Put in a check so that you only apply response if the relative velocity in the normal direction is negative, in which case, you will do nothing and you are done. Yes, you will need to do another round of collision detection to be sure you didn't introduce new collisions. BTW, the equations used here are much more general than I presented (both sides can be modified, masses can be involved, elastic impulses can be applied, etc.). If you want to learn about that or need it, look up "collision impulses" or similar phrases, or just ask here.
  7. Your problem is underdetermined. You need to specify some additional information, like time of flight. They don't have to be at the same height. The general problem you are solving is 1/2 (0,g) t^2 + (v_x, v_y) t = (x, y), where g is gravity (I'm assuming it points down), (v_x, v_y) is the initial velocity of the projectile, and (x,y) is the desired target. If t is given, then you can solve for (v_x, v_y), at which point it is trivial to get the angle (sin^-1 (v_y / (v_x^2 + v_y^2))). Otherwise, you have 2 equations and 3 unknowns. If you specify something like the magnitude of the velocity (v_x^2 + v_y^2), that should do it too, although I think you might get multiple solutions at that point, but it should be obvious which one you want.
  8. BitBlt

    how to win friends and influence people

    50% of self-help books are just rip-offs of this one. The most noteable one being Steven Covey's "7 Habits of Highly Effective People". It's basically a rehash of Carnegie's ideas.
  9. BitBlt

    How much is gas in your area?

    Woohoo, prices just dropped a bit. I filled up for $3.12/gal today in Los Angeles. I never thought I'd be happy paying >$3/gal for gas.
  10. BitBlt

    Delete Account

    This is kinda weird. You're not a goth kid trying to erase himself from existence, are you?
  11. BitBlt

    A year and a half, wasted...?

    Do what real game developers do. Instead of "finishing" the engine, start making something with it, and fix bugs/features as they pop up. I ditto swapping out the SDL thing. If it was designed right, it shouldn't be more than a couple hours of work, depending on your experience. I think what everyone is trying to say is that you already have what you need, no need to pay money for Torque.
  12. BitBlt

    Who the hell is this?

    Quote:Original post by Cold_Steel I really like Michael Romeo too. He's another underrated guitarist from an underrated band, Symphony X. I love his neo-classical flair. Very impressive Nice video, I love Symphony X. The video framerate can't keep up with his fingers! I wasn't too impressed with the original video posted. Somebody mentioned Phil Keaggy, who is one of my favorite guitarists. There aren't many videos of him online, but here's one where he uses many of the same things in the original video, just a little slower and with better results (IMO). Clickity Click
  13. BitBlt

    dangerous hairs in a swimming pool

    Not to mention how much chlorine decreases the strength of hair, so hair that had been sitting in pool water for any length of time would easily break.
  14. BitBlt

    Funny pickup lines (nothing crass)

    Here's a pickup I made up that actually worked the one time I tried it. It requires knowing a card trick: Walk up to your target with a deck of cards and tell her to pick a card. Use a trick where you can find out the card easily (I use a card force so I know it before the trick begins, and if I mess up the force I go into another fall-back trick). Tell her to study the card then put it back in the deck. Tell her you can find out her card by asking only 3 questions. Shuffle well (if you already know the card) or do whatever false shuffles necessary to move the card to the top of the deck while you ask the questions. Also keep your eyes looking at hers, to a) keep her from looking at your false shuffles and b) to add to the intimacy or whatever you want to call it. [While shuffling] say "First question, what's your name?" She answers. Question 2: "What's your phone number?" She answers again (not many girls wouldn't at this point). Now you should be ready for the end of the trick. If you already know the card (via force) say "And now the last question, is your card the X of Y?" or if you don't know it (but shuffled it to the top) say "Is this your card?" as you flip it over. Badabing, badaboom. Simple, yet effective. Chicks dig guys with skills, nunchuck skills, computer hacking skills, and magic trick skills.
  15. BitBlt

    Obfuscate This

    Here ya go: #include <iostream> #include <cstdlib> #include <string> int main(int argc, char** argv) { int num, guess; bool found; char c; std::string message; std::string correct("Correct!"); std::string too("Too "); std::string low("low."); std::string high("high."); std::string again("Again? (Y|N): "); message = "I'm thinking of a number from 0 to 100: "; while(1) { num = std::rand()%101; std::cout << message << std::endl; found = false; while(!found) { std::cin>>guess; std::cout<<(guess==num? (found=true,correct): (guess < num? too+low : too+high)) <<std::endl; } std::cout<<again; std::cin>>c; if (std::toupper(c) == 'N') break; } return 0; } I couldn't find an easy way to turn the while (!found) into a while (1).
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!