Sign in to follow this  

Using same graphics framework across different projects?

This topic is 1360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to make games but i also like doing the graphics stuff myself. Over time i wrote a small graphics engine that i continuously add new features to. Up till now I've been copy/pasting the engine code between projects but I want to have the graphics code in just one place and use it across different projects. I also want to keep adding new features to the engine such that the changes affect the engine code in all projects.

 

How can i do this?

Share this post


Link to post
Share on other sites

I would recommend using a VCS (Version Control System) and a host like GitHub. Then you can easily clone the repository when you need to use it and compile it. You can also easily undo changes that breaks code that's using it. I'm afraid there is not some magical way to update the repository for all projects and compile it AFAIK, but I could be wrong. From your question it seems you want that it automatically updates, but did you think about the fact that the code is probably not compatible all the time?

Share this post


Link to post
Share on other sites

I am using Mercurial but like you said it doesn't update other projects. The code will always be compatible because it's mostly adding fixes/updates/features to the underlying graphics pipeline.

Edited by Waaayoff

Share this post


Link to post
Share on other sites

I am using Mercurial but like you said it doesn't update other projects. The code will always be compatible because it's mostly adding fixes/updates/features to the underlying graphics pipeline.

It's highly unusual to update a library your project depends on the hole time. I recommend just tagging versions and upgrading once in a while to a stable version. Using a build system like CMake can make it much easier to pull a new version, compile it and use it.

Share this post


Link to post
Share on other sites

 

I am using Mercurial but like you said it doesn't update other projects. The code will always be compatible because it's mostly adding fixes/updates/features to the underlying graphics pipeline.

It's highly unusual to update a library your project depends on the hole time. I recommend just tagging versions and upgrading once in a while to a stable version. Using a build system like CMake can make it much easier to pull a new version, compile it and use it.

 

 

It's because it isn't finished. I'm basically creating it as i go. When i needed to use 3D textures, i added 3D texture support. When i started using sophisticated shaders, i created a shader pipeline, etc...

 

I guess i can just manually replace the "engine" folder in one project whenever i change it in another one.

Share this post


Link to post
Share on other sites

With SVN you can set an external property to point to another repo.  Whenever you update the first repo it will also check any externals and pull those down as well.  You can do something similar with Git but I'm not sure if that is something that can be done with Mercurial.

 

If you don't want to copy an entire source code folder all the time you could just have your engine code in its own repo and just build the .lib and/or .dll when you do an update and just include that with your games.

Share this post


Link to post
Share on other sites


It's because it isn't finished. I'm basically creating it as i go. When i needed to use 3D textures, i added 3D texture support. When i started using sophisticated shaders, i created a shader pipeline, etc...



I guess i can just manually replace the "engine" folder in one project whenever i change it in another one.

If that's the case I recommend you start with one game, finish it, and then extract the generic parts (your engine) that are useful in other projects, instead of threating your engine as another project...

Share this post


Link to post
Share on other sites

I think you want to compile the engine part as a (static?) library instead of copy/paste the source code between projects.

 

If you're using VS you have only to create a Library Project, copy and paste (for the last time ;) ) your engine's code, compile et voilà, you have your .lib done, ready to be linked to your projects.

Edited by arka80

Share this post


Link to post
Share on other sites
Just use branches/tags/whatever-your-VCS-calls them for each game/project.
When you update the engine for a new project, the old projects will still be on their old engine branch so will keep working. If you want to go back and update your old projects, you can merge/rebase/etc the latest branch over their old branch (and then manually fix the old code I there were any breaking changes introduced by the update).

Share this post


Link to post
Share on other sites
Sign in to follow this