Does anybody else have experience with something like this? What's the best way to go about it?
One approach that I used is to create 3 separate projects (e.g. in Eclipse):
- Library (with common code, i.e. for loading levels / some graphics code etc)
In theory you would then also be able to use this library for other games you make. I say "in theory", because in practice I noticed that maintaining one generic library that stays compatible with different projects is extremely hard since my libraries tend to evolve very rapidly, requiring me to rewrite earlier projects to maintain compatibility. So instead of this I currently just keep the "library" code inside the main game project, but in a separate package. For each new project I copy the best-fitting library code to the new project and start working with this copy (which will then evolve further along with the new project).
Anyway, it's quite easy and helpful to put shared code in a library, just be careful to do this in a way that helps you and does not become an obstacle.
Edit: you can add a library project to your project's build path in Eclipse using the build path settings