# Level Editor + Game -> Duplicating rendering/game specific code?

I've been reading about how to design code for a game. One thing I haven't been able to figure out is - how do you manage writing an outside-game level editor (not an 'in-game level editor') without 'copying' code from the game? For example, you might have to copy all code about the different types of entities you can have. You'll have to add the game rendering code.

My guess is this can be done by making a DLL out of the 'engine' part of the game. Then, share it between the actual game and the level editor.

Or is there a better/easier way to do this?

You will have to separate your code into separate projects (in the same solution). Usually you would have the following setup:

-Engine Core       (DLL)
-Game + Game Logic (EXE)
-Content Pipeline  (DLL)
-Editor            (EXE)


For even larger projects you might want to separate the Engine Core over multiple projects like Core, Physics, Graphics, Audio, Input and Networking. All these projects can't reference each other, but they all reference Core where you can store some common base types.

If they would reference each other the separation would be useless.

Anyway this should help you reuse parts of your engine in other projects. For example for the editor you would need to reference the Graphics project which references Core itself.

This separation also means that you can now use Windows Only technologies, like WPF, in your editor while your game can still target Windows and XBLIG.