How was the real melee like... hm. I can answer for how was it in Ottomans;
-The first few lines were filled with Bashibazouks, those fighters were trained to crash and die , so they had only like a 0.01% chance to stay alive.
-In the left and right parts , Akıncıs ( Raiders ) were trained, best in scouting, riding , and making fast attacks were taking part in the battle.
-After Bashibazouks , there were Sipahis with Akıncıs , they were cavalry too (Dragoons,horse archers etc.)
-In the core of the army, there were Janissaries , those men were fighting machines, because they didnt have any fear of death, belief was; if you die in the way of Jihad , you will go to the Heaven. Also Janissaries could use any weapon , they were taken as children of war refugees, prisoners , villagers from Europe countries, which lost battle against them. Imo if you take a kid when he is 2, and train him until he is 21, he will be a real monster.
-And in the other flanks there were cannons , archers , Mehteran etc.
Allah is merciful. (!)
Hope this helps