I started making an engine for HTML5 games. Soon, I got interested in another project, basically, an evolution simulation. The simulation would be ran on the server, but the actual rendering would take place on the client side. I realized that I could use most of my classes and code from the game engine on the server side, too.
Now, I'm not sure what should I do. I have the option of creating a "monolithic engine", which would have both the specific functionality and universal functionality for both sides. Or, I could create a separate "game engine", and use it to render the simulation and make games, and a separate "simulation engine" that has simulation specific functionality.
The monoluthic approach has the problem of keeping the code in codebase too big and unrelated, while the separate approach has the problem of having same classes in both code bases.
How can I handle this situation?
If it changes anything, I'm coding in Javascript.