Sign in to follow this  

Setting up multiple projects in visual studio

Recommended Posts

I'm not sure how to set up multiple projects in visual studio for my game. I heard there's a lot of benefits from having multiple projects. You can have some in release and some in debug and have individual precompiled headers. But what type of project should they all be? Console applications? Dll's? (which I don't know how to use). Any help would be great. Thanks

Share this post

Link to post
Share on other sites
They should be whatever you need. Some can be console applications, some can be static libraries, some can be dynamic libraries, etc. It really depends on what program your making and how you designed it. Rarely will all your projects be the same type. For example, you might want to create several dynamic libraries, one for sound, one for networking, one for collision detection, etc. and then use each of these dynamic libraries in your main application. This would mean your dynamic libraries would each be one project (a dynamic library), and then you'd have one main project that would consume your dynamic libraries.

Share this post

Link to post
Share on other sites
Yeah! That's what I want. Static libraries. But then what are the differences between that and dynamic libraries? I'm going to be doing exactly what you said where there's a project for physics, graphics, etc.

[Edited by - M4573R on March 14, 2009 10:05:41 PM]

Share this post

Link to post
Share on other sites
Static libraries are basically one big .obj file. You can link with them when building your main .exe. One of the benefits is that you can easily use the libs in more than one project, and it can probably save you some time when rebuilding. Note that you can easily switch a project from static lib to dynamic lib if needed (in which case the link is done at runtime rather than compile time).
Personally I have these projects in my current hobby app:

client (win32 application with a console for debug builds) - the game
lo (win32 application) - the launcher (launches update then client)
update (win32 application) - the auto updater
server (win32 console application) - the server
install (WiX install project) - the .msi
protocol (static lib) - the protocol used by the client and server
directx (static lib) - Direct3D 11, DirectSound/XAudio2 and DirectInput/XInput code
open (static lib) - OpenGL 3.0, OpenAL, etc... (I know, the project name is really bad)

So for client I have "many" configurations:
- debug or release
- x86 or x64
- directx or open*

Technically there's also some more configuration where the 2 static libs are DLLs instead, but I don't really use it at this point.

Anyway now you get an idea of all the possibilities :)

[Edited by - Rewdew on March 15, 2009 6:14:09 AM]

Share this post

Link to post
Share on other sites
Original post by M4573R
I'm not sure how to set up multiple projects in visual studio for my game.

You just create new projects in Visual Studio as needed. Don't try to throw all the different projects into the same Workspace Solution though, since you will not be able to run them all at once.

Create individual projects and run multiple copies of Visual Studio to manage them. That way, you can run them all in Debug/Release/etc... at the same time as needed whereas if they are all under the same Solution, that is not possible. For example, if you have a client and server project, you could only debug run one of them in the current instance of Visual Studio. If you run two copies of Visual Studio each with their own respective project, then you can run both of them at once and do realtime debugging simultaneously.

Also, if you are just getting started, don't make life harder for yourself by developing a DLL/LIB until you have to have one. It might seem like a cool idea at first, but once you go that route and do not understand the implications of using them, you will make debugging twice as long and hard than it should be.

What kind of "multiple projects" did you have in mind? In your second post you mentioned physics and graphics, but I would strongly recommend you do not go that route yet. Keep everything in one project and once you get everything working and have an idea of how you want to split it up, then you can look into breaking it up into separate components that no longer need to be constantly maintained.

The things you should be separating at this point would be game utility projects, such as game mod tools, format converters, map makers, etc... Anything else can really lead you down a path of headaches if you do not understand all of the gotchas (especially trying to mix release and debug libraries in the same executable).

Good luck! [smile]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this