Can anyone tell/show me example of an algorithm that are needed to build simple games in any programming language? Also, do every feature requires different algorithms or do game devs write whole algorithm in the beginning?
Well the algorithm is game-dependent since not every game does the same thing. Some mostly used popular algorithms are: -A* for pathfinding -Fringe search also for pathfinding -Co-op pathfinding for entity group pathfinding - Terrain acknowledgement algorithms for knowing the entitie's surroundings (AI) -Behavior trees for making decisions based on state -Floodfill for detecting similar things in a grid (think paint bucket tool or minesweeper when you click an empty tile) -Reinforcement learning (More of a ML topic) Then there's the liner algebra, algebra, geometry algorithms for finding collisions, line of sight, simple linear paths, if you need wave-like movement, etc. It's a huge topic, as you see from this list, so first stick to a simple game idea and find the algorithm(s) that are used for only that game and you will learn then make a new game that requires new algorithms and you'll learn those and so on
Hope this helps you