Let’s pretend that there are only two players on the football field, a Center, and a Defensive Tackle. Let’s also pretend that they are lined up exactly in front of each other, and that they are trying to drive each other backwards. How are we going to program this behaviour?
I said last post that this is where things start getting hard, but also where things start getting fun. Having a MoveToSpot() pathfinding system just isn’t going to cut it here. Collision detection, at least what I have implemented, will just move them back to touching, when they move each other overtop of each other. We need to have a system where the players themselves can affect the other players. Then behind the scenes we tell them to move to a certain spot. We may add some flags that make the player move differently that will be important when the graphics increase in quality.
Getting back to our two players on the field, how exactly are they going to effect each others velocities and positions?
Edit: Wow, wordpress just at the next 200 words that I typed. That’s incredibly irritating. Anyway I guess I need a new recap.
Players have weight and velocity, which leads to momentum, and also strength. Momentum and strength are added together for each player and then subtracted against the opposite player. If we have two players, one who is huge but weak, and one who is small but very strong, then we would expect that the huge player will initially drive the smaller player back, but quickly the tables will turn and the strong player will start to drive the bigger player back (due to the smaller player being much stronger). That way both size and strength are very important to the outcome of the play.
Programming wise, all I need to add is a system where the players can move at low velocities. This might be hard because I currently have a MoveTo system. I will need to calculate the speed of the players first and pass that into the function.