alvaro

Members
  • Content count

    7838
  • Joined

  • Last visited

  • Days Won

    1

alvaro last won the day on November 19

alvaro had the most liked content!

Community Reputation

21297 Excellent

1 Follower

About alvaro

  • Rank
    Legend

Personal Information

  • Interests
    Audio
    Programming

Recent Profile Visitors

40707 profile views
  1. Boids, a way not to check flock every update?

    You can use a spatial-partitioning method (e.g. quadtrees or kd-trees) to quickly discard most of the N^2 possible interactions. "Broad phase collision detection" could be a useful thing to search the web for.
  2. C++ 2D Math Problem

    If you know how to rotate around the origin, you can rotate around any point P like this: translate the whole picture so P becomes the origin, rotate around the origin, translate back so the origin becomes P Does that help?
  3. Controlling a Very Intelligent AI

    Yeah. That game sounds like no fun.
  4. I'm dreaming too high?

    Making a game is similar to making a movie. You are probably more aware of how many people and how much money it takes to make a movie, so you probably don't come out of a movie thinking "I am going to make a better version of this movie by myself, with no budget". A game like Dark Souls probably costs tens of millions of dollars to make. Now re-read this thread with that in mind, and see how silly what you are asking sounds.
  5. How to learn the math necessary?

    Since nobody seems to have mentioned it: Do lots of problems. Math is about solving problems. Good math books have problems at the end of each chapter. Take some time and try to solve them. That's the part of the book where you learn the most. I got a degree in math and my primary way to study was to take a long list of problems and solve problems 7, 17, 27, 37... If along the way I discovered I needed something I didn't know, I would read the text about it, with the specific problem in mind. If I had time I would pick another digit and do another pass (say 4, 14, 24, 34...).
  6. You really should be able to figure this one out yourself. Measure the distance (a single number, as ferrous points out), then check against your threshold.
  7. The likely problem is that you misunderstood what the operator || does. It takes booleans on both sides and returns true if either one is true (it also has short-circuiting semantics, but that's not relevant here). So `distance.x' is converted to a boolean, which means your condition will trigger whenever distance.x is not zero. Probably not what you want.
  8. Lead Moving Target with Moving Shooter

    It's not that hard. You write down an equation that says "at the time t when the hit happens, the target will be at a position P(t) such that the time it takes a projectile to get there is t." Any positive solution of the equation will do. If everyone is moving at a constant velocity, the equation is quadratic. With constant acceleration (e.g., if gravity is involved), the equation is quartic. In any case, as long as every function involved is smooth, you can use Newton-Raphson to find solutions with very good precision.
  9. AI Topic for External Blog

    There are just too many options. This forum is primarily about game AI. A few big areas (off the top of my head): Locomotion (pathfinding, flocking behaviors, animation controllers) Full-information two-player games (chess, checkers, go) General game playing Tools for game designers to describe behaviors (behavior trees, goal-based architectures, planners, utility systems) Machine learning (reinforcement learning for driving games, AlphaGo) Dialog (select phrases appropriate for the situation) Automatic adjustment of difficulty levels to give the player a good challenge I am probably missing some big ones, but perhaps something in that list piques your interest.
  10. Learning C++ by Writing C++

    I also learn programming much better by writing programs. "A capar se aprende cortando cojones", my father would say. ("You learn how to castrate by cutting balls.") I would use the textbook as a list of concepts to learn. Take a look at the table of contents and see what they cover first. Say it's basic integer types and input and output using <iostream> (I have no idea if that's a reasonable place to start, but whoever wrote the book probably has thought about the proper order more than I have). Challenge yourself to do something with that. For instance, try to write a program that asks the user for 2 integers, adds them up and displays the result. You can learn how to write that however you learn best (tutorials, references, reading sample code...). Once you are satisfied that you understand the concepts, go back to the textbook and read the chapter. Chances are it will be very easy to understand at that point, and there might be things you didn't figure out yourself, or details that you had overlooked. If you have a hard time getting started, or if you get stuck, or if you want some suggestions for a targeted challenge, you can post here, or you can PM me.
  11. There is a series of videos on 3blue1brown that try to develop your intuition for linear algebra. It's called "Essence of linear algebra": https://www.3blue1brown.com/ It might take some time to go through the videos, but I think they do a very good job.
  12. Oh, you have a more basic problem. I imagined you were building your matrix from scratch every time. You should make the scaleFactor equal to 1.2 when `W' is pressed, and 1/1.2 when 'S' is pressed, 1 otherwise. Either that, or build the matrix from scratch every time.
  13. I am having a hard time understanding what your problem is. But perhaps we can get to the bottom of it if by looking at your last line: "[...] multiplying by a translation or rotation matrix seems to be additive". I can see how translations might seem additive: There is a very natural way to describe the translation using a vector, and composition of translations corresponds to addition of vectors. In the case of rotations, they seem additive if you are thinking about them in terms of angles. Now, anything multiplicative can be made to look additive if you use logarithms, because log(a*b) = log(a) + log(b). In some sense, angles are logarithms of the transformations they represent. Now, scaling things is the prototypical example of multiplication, and you generally want to use multiplicative updates. In the bit of code you posted, if you hit "S" twice the object will collapse to a point because you made the scaling factor zero. Also, if you have made the object very big already, hitting "W" again will have an almost imperceptible effect. My guess is that that is not what you wanted. An alternative would be to multiply the scale factor by some constant (say, 1.2) when you hit "W" and divide by the same constant when you hit "S". Try that and see if that's closer to the behavior you want. As a side note, you could keep track of the logarithm of the scaling factor instead. To get the same effect, you would be adding log(1.2) [about 0.1823] or subtracting log(1.2) to a variable named "log_scale", and then the scaling factor would be computed as "exp(log_scale)". That's rather awkward and I don't recommend it, but it would make scaling seem additive. It gives me a similar feeling to code that uses angles.
  14. The inverse of multiplying by 2 is multiplying by 1/2, not -2.
  15. Choosing Flowfield Methods

    Disclaimer: I didn't read your link. You can use Dijkstra to compute the distance from any node to the player. Then have the agents move to the lowest-value node they are adjacent to.