In the context of video game development, game mechanics or gameplay mechanics (the words are quite synonymous in this context) are the set of rules which govern how a game works. They explain things such as:
- What entities are there in a game (the player-character, the enemies, projectiles they spawn, the environment, etc.)
- What game-relevant state do they have (position, direction, hit-points...)
- What actions can they perform and when do they perform said actions (ex. "Enemies can spawn a projectile every 10 frames which have a position 5px in front of them and the same direction as the spawning entity", "enemies only spawn a projectile when the player collides with a straight line going from the enemies current position into the direction they face", "Projectiles move forward with a speed of 5px per frame in their current direction").
- How do these entities interact with each other (ex. "when a projectile collides with the player-character, the projectile is removed and the player-character loses 1 hit point")
- What actions can the player perform to affect the behavior of entities (ex. "the player can command the player-character to move left or right with a speed of 3px per frame."). Often this is only one entity: the character they control. But sometimes the player can command more than one entity, like in a real-time strategy game.
- What are the win-conditions and lose-conditions (ex. "when the player-character loses all hit points, the player loses". "when all enemies are removed from the game, the player wins")
Points, achievements and discovery can be part of the game mechanics when they actually do something (ex. when the score reaches 1,000,000 points, the player-character gains an extra life", "when the player reaches level 12, the player-character gains the double-jump ability"). But when they don't actually affect the game at all, e.g. when they would be removed the game could still be played in the same way (even though the average player might want to play it differently in that case), they are not a game mechanic. They are part of the presentation.
you might now wonder "OK, so what part of the game are not part of the game mechanics"?
The controls. The game mechanics explain what commands the player can give, but not how the player gives said commands. The controls heavily affect the way the player plays a game, because the player will usually prefer to give those commands which are easy to give. When the player can command their character to perform a kick by pressing B and a super-kick by pressing up down left left right B, they will usually prefer using the normal kick when sufficient because it is simpler to do.
Note that in highly competitive gaming, the controls can actually bleed into the game mechanics because they put an additional limitation on how fast certain actions can be performed. At a very high competitional level, some real-time strategy players feel like the entity they control directly are not actually their units but rather their mouse cursor.
The presentation. To be able to interact with the game, the player needs to be made aware of what is happening. The presentation is what the player sees on the screen and what they hear over their speakers.
The presentation can also affect how the player plays the game without actually changing the game mechanics. The player will usually pay most attention to those game events the presentation makes them most aware of and behave accordingly. For example, when you would still want the player to use the super-kick more often, have the presentation acknowledge their success at performing it correctly by accompanying it with a flashy graphic effect, a satisfying sound effect and when they do it the first time, give them an achievement "Congratulation! You did a Super Kick!" presented in big letters in the center of the screen with fireworks around them.