Given an algebraically closed field $k$ and a subfield $L$, the $n$-type space $S_n(L)$ is equal to $\mathbb A^n_L$ as points by restricting a type $p$ to the ideal of polynomials $f$ such that the equation $f=0$ lies in $p$, and the topology is the same except the closed sets $V(I)$ are also open in $S_n(L)$.
Given the very direct correspondence between types and prime ideals in varieties, is there an approach to model theory without co-odinates, free variables and such, so that this fact has a generalization where $\mathbb A^n_L$ is replaced by an arbitrary affine scheme $SpecR$ and $S_n(L)$ is replaced by some other appropriate object space in model theory?