Throughout the play, Horatio is entirely consistent in his relationship with Hamlet. In the very first scene, Horatio is skeptical about the ghost, but once he decides it is the late King Hamlet (Senior), he immediately tells the prince. As Hamlet has been worrying about Claudius and Gertrude’s possible involvement in the former king’s death, he accepts the ghost’s invitation. Horatio is shown as careful and protective as well as skeptical of the ghost’s intentions.
Once Hamlet decides to pursue his investigation into the suspected “foul play” of his father’s death, he settles on the scheme of feigning madness. He understands that the full weight of the pursuit of truth falls on his shoulders. He also realizes that if Claudius killed his father, he might well be next. He needs an ally and confidant. There must be one person who knows not only that he is sane but that Claudius is a danger—not just to Hamlet, but to Denmark itself.
The first act shows how quickly Hamlet has had to grow up. His melancholy disposition is associated with grief and mourning. Before he came back from college, it seems that Hamlet was not as serious and certainly not gloomy. He is sensible enough to understand that Horatio is the right person for his ally. When his old college buddies turn up, he is not interested in hanging out with them. He also immediately—and correctly—suspects that they are in cahoots with Claudius. While Rosencrantz and Guildenstern betray him, Horatio remains loyal and even offers to die alongside his friend.