We present a type of agent-based model that uses off-lattice spheres to represent individual cells in a solid tumor. The model calculates chemical gradients and determines the dynamics of the tumor as emergent properties of the interactions between the cells. As an example, we present an investigation of cooperation among cancer cells where cooperators secrete a growth factor that is costly to synthesize. Simulations reveal that cooperation is favored when cancer cells from the same lineage stay in close proximity. The result supports the hypothesis that kin selection, a theory that explains the evolution of cooperation in animals, also applies to cancers.