  For each natural number $d$, we introduce the concept of a $d$-cap in
$\mathbb{F}_3^n$. A subset of $\mathbb{F}_3^n$ is called a $d$-cap if, for each
$k = 1, 2, \dots, d$, no $k+2$ of the points lie on a $k$-dimensional flat.
This generalizes the notion of a cap in $\mathbb{F}_3^n$. We prove that the
$2$-caps in $\mathbb{F}_3^n$ are exactly the Sidon sets in $\mathbb{F}_3^n$ and
study the problem of determining the size of the largest $2$-cap in
$\mathbb{F}_3^n$.
