For a personal project, I am attempting to create an environment for reinforcement learning algorithms. Specifically, I want the user (i.e., an artificial intelligent agent, but for intuition you can also think of a human game player) to control a 2-D "point" in some grid. The actions that the user can apply are NORTH, SOUTH, EAST, and WEST.
Pressing NORTH, for instance, should obviously move the particle north. But how do I ensure that if the user keeps applying the NORTH action, that the particle moves faster? And then if the user applies SOUTH, the particle shouldn't reverse immediately but should slow down a bit and then move down, depending on how long the user presses SOUTH. And then if the user presses EAST while the particle is moving south, then the particle should move south-east, and so on.
For the movement part, I am going to follow this tutorial which uses basic trigonometry to determine the resulting movement given the velocity in the x and y directions (see the section "Movement vectors").
However, I'm unsure on how to implement the acceleration, and the tutorial assumes we already have some velocity, but I need to define a reasonable mapping from NORTH, SOUTH, etc., actions to velocity.
I'm not a physicist, so I'm probably missing something obvious. If so, any possible supplemental references would be appreciated. And just to be clear, I'm not looking for a guide on particle collisions and the like; my interest is trying to simulate realistic movement from NORTH, SOUTH, EAST, and WEST user-provided actions.