There are two forms of the past perfect (= плусквамперфекат) tense:
past perfect simple
past perfect continuous
When we want to say that a past action finished before another past action, we use the past perfect simple:
When we arrived, they had already left.
By the time we arrived, they had already left.
Watch this video for a clearer view on the past perfect tenses: