Saturday, 16 November 2019
Wednesday, 24 October 2018
Diagnostics
Added some diagnostics to help with dev. Using "Dear ImGui" which is an awesome immediate mode gui toolkit. Go support it:
https://github.com/ocornut/imgui
https://github.com/ocornut/imgui
Sunday, 27 August 2017
Thursday, 3 November 2016
Short Passing
Tweaked user controlled short passing now feels nice and crisp. Compare with short-passing-demo to see the improvements in passes connecting with the receiver. A receive state helps the AI connect with the pass, and the input switching is tweaked so the receiver doesn't grab input too soon and run away in the opposite direction.
Some A.I. controlled dribbling and short passing.
Some A.I. controlled dribbling and short passing.
Wednesday, 2 November 2016
Player Search
Added functionality to search for players based on name, nationality, playing skills etc.
Saturday, 24 September 2016
Dribbling Speed
Player's running speed slows down when they are dribbling with the ball. Tap to knock the ball forward and gain a little speed to get away from pursuing defenders, but lose a little ball control!
Tuesday, 30 August 2016
Short Passing Demo
Assisted pass by tapping fire. Indicator turns green when there is a possible pass recipient.
and without the debug indicator:
and without the debug indicator:
Tuesday, 9 August 2016
Friday, 13 May 2016
Sunday, 8 May 2016
Sunday, 1 May 2016
Detecting Danger
With hit detection, triangle turns red when dribbling player detects an obstacle to avoid.
Saturday, 30 April 2016
Some Vector Math
The problem is to allow the player to work out if if there is a dangerous obstacle (an opposing player) in his path whilst dribbling. This is similar to a "field of view" but just re-sized to what the player considers "too close for comfort." So when an opposing player enters the danger area, the dribbler will try to change direction or get rid of the ball.
Here's the vid:
Teaching myself vector math from the beginning again, there is probably a more elegant way to do this. Anyway, here's what my brain came up with.
Given the position of the player p, his normalized velocity v, an angle specifying how wide the field of view should be and a length specifying the size, we can calculate a triangular field of vision (three points, p1, p2, p3) like this:
p1 = p
p2 = v.rotate(angle/2) x length
p3 = v.rotate(-angle/2) x length
With different parameters, this can also be used to select possible pass receivers etc.
Example in code:
// calculate the angled vectors
Vector3 side1 = position + velocity.rotated(-25, 0, 0).normalised() * 200;
Vector3 side2 = position + velocity.rotated( 25, 0, 0).normalised() * 200;
// p1 is just the position of the player
p1.x = position.x;
p1.y = position.y;
// p2 is end point of the first side
p2.x = side1.x;
p2.y = side1.y;
// p3 is the end point of the second side
p3.x = side2.x;
p3.y = side2.y;
For the uber curious, here's the rotated() function:
// ----------------------------------------------------
// rotated
// ----------------------------------------------------
Vector3 Vector3::rotated(double a, double x_origin, double y_origin) {
a = RADIANS(a);
Vector3 rotated = *this;
rotated.x -= x_origin;
rotated.y -= y_origin;
double nx = cos(a) * rotated.x - sin(a) * rotated.y;
double ny = sin(a) * rotated.x + cos(a) * rotated.y;
rotated.x = nx;
rotated.y = ny;
rotated.x += x_origin;
rotated.y += y_origin;
return rotated;
}
Here's the vid:
Teaching myself vector math from the beginning again, there is probably a more elegant way to do this. Anyway, here's what my brain came up with.
Given the position of the player p, his normalized velocity v, an angle specifying how wide the field of view should be and a length specifying the size, we can calculate a triangular field of vision (three points, p1, p2, p3) like this:
p1 = p
p2 = v.rotate(angle/2) x length
p3 = v.rotate(-angle/2) x length
With different parameters, this can also be used to select possible pass receivers etc.
Example in code:
// calculate the angled vectors
Vector3 side1 = position + velocity.rotated(-25, 0, 0).normalised() * 200;
Vector3 side2 = position + velocity.rotated( 25, 0, 0).normalised() * 200;
// p1 is just the position of the player
p1.x = position.x;
p1.y = position.y;
// p2 is end point of the first side
p2.x = side1.x;
p2.y = side1.y;
// p3 is the end point of the second side
p3.x = side2.x;
p3.y = side2.y;
For the uber curious, here's the rotated() function:
// ----------------------------------------------------
// rotated
// ----------------------------------------------------
Vector3 Vector3::rotated(double a, double x_origin, double y_origin) {
a = RADIANS(a);
Vector3 rotated = *this;
rotated.x -= x_origin;
rotated.y -= y_origin;
double nx = cos(a) * rotated.x - sin(a) * rotated.y;
double ny = sin(a) * rotated.x + cos(a) * rotated.y;
rotated.x = nx;
rotated.y = ny;
rotated.x += x_origin;
rotated.y += y_origin;
return rotated;
}
Wednesday, 27 April 2016
An Idea
Not very realistic, but fun. Player transfers to be done with an in-game browser on an Ebay type site.
Monday, 25 April 2016
Tuesday, 19 April 2016
Tuesday, 12 April 2016
Handy New Feature
Holding Player 1 Start + Left on the stick brings up the IP address for a few seconds.
Saturday, 2 April 2016
Another Pressing Example
Of course, if the dribbler manages to change direction, then pressing players would recalculate their interception paths, so it might appear in the static screenshot that a simple turn by the dribbler would easily evade the pressers, but as soon as he does so, the pressing targets would also change to intercept his new run.
We can also tweak the values for how far ahead of the dribbler the pressers will project. Again, the static screenshot may make it seem like they are planning a path way too advanced of the ball, but in reality the dribbler is moving quite fast and will converge with the nearest interception circle in only a second or so.
[click to enlarge]
What we might want to do for less aggressive pressing players, is to extend a path from the initial calculated intercept point to the middle of the goal, and set the new target a percentage along this new line. this would result in a kind of pressing that favors pushing the dribbler into the flanks whilst protecting the goal area.
We can also tweak the values for how far ahead of the dribbler the pressers will project. Again, the static screenshot may make it seem like they are planning a path way too advanced of the ball, but in reality the dribbler is moving quite fast and will converge with the nearest interception circle in only a second or so.
[click to enlarge]
What we might want to do for less aggressive pressing players, is to extend a path from the initial calculated intercept point to the middle of the goal, and set the new target a percentage along this new line. this would result in a kind of pressing that favors pushing the dribbler into the flanks whilst protecting the goal area.
Subscribe to:
Posts (Atom)

