Have you ever played baseball?

Literal

Baseball [obj-を] did thing [subj-が] exist-[polite Q-ますか].

~たことがある ('have (ever) done X') is the standard pattern for experiential questions. Literally 'there is the thing that X-happened.' The negative counterpart ~たことがない means 'have never done X.'