• Advertisement
Sign in to follow this  

Unity How to share code between projects w/ versioning?

This topic is 4614 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

OK, let me tell you what I'd like to achieve. I have a lot of common source code between a few projects, your average "basecode" sort of deal. It has become quite large, and I now have a few projects using it, so manual management has become tedious. Basically, the problem is - say project A and project B are using the same code base. I work on B for a while and while I'm doing that I update the basecode a bit. Now if I go to project A, the basecode has changed, and now A won't compile without being updated to use the latest basecode. Now, updating A is the best solution, but it's somewhat impractical, particularly if A becomes very outdated and I need to make a small, quick change to A. What I'd basically like to do is be able to use the old base code for A while still using the new basecode for B. Then when (and if), I'm ready to update A to use latest basecode, I can just click a button to bring the version in use forward. Even better would be if I could modify some basecode from A and some other basecode from B and then later merge the two modifications to the basecode when I want either A or B to move to the latest basecode version. I'm under the impression that "CVS" is the correct answer to this problem, however I havn't used one before and so I don't actually know if it is. So, if it is, any advice on what software to use and how to use it to solve this problem is very much appreciated. Ease of use would be a big plus (something that can just slot into MSVC is very preferable). So yeah, any ideas? EDIT: more info down the page. [Edited by - Andrew Russell on June 1, 2005 8:13:25 AM]

Share this post


Link to post
Share on other sites
Advertisement
Hi,

I think VCS can be easily integrated with VC++. Not sure of CVS. But yes, I would suggest CVS or some kind of versioning system.

Share this post


Link to post
Share on other sites
I think Visual SourceSafe is what you're looking for. It'll plug into Visual Studio.

Because I use Linux only, I have a lot of experience with using CVS, and while I only use it from the command-line I'm pretty sure there are a lot of user interfaces to make it easier.

Another thing- Why can't you just make the code that's common to both of them a library so that you don't need to keep them synchronized, just link it to the library. That's what I would do.

Share this post


Link to post
Share on other sites
I'd recommend Subversion.

Basically, it sounds like you'd want to take your base code, make a branch for A and a branch for B. At this point, they use common base code, but any changes made to the base code in A or in B will not change the other branch.

When you are ready to update A's basecode (assuming B's basecode as been modified), you can merge the B's updated basecode into A's basecode.

All of this shouldn't be too hard, but I do recommend you read the subversion book (it's free, listed on the website above).

Edit: And there is a visual studio plug-in available too: Ankh SVN

Share this post


Link to post
Share on other sites
I use symbolic links, which could probably be considered a hack.

I don't think that would work in Windows, though.

Share this post


Link to post
Share on other sites
Quote:
Original post by smart_idiot
I use symbolic links, which could probably be considered a hack.

I don't think that would work in Windows, though.

This is similar to what I was suggesting. Just add to your path the directory that would have the stuff that's used between the projects and just include it and link to the library as normal. Cleaner and quite cross-platform.

Share this post


Link to post
Share on other sites
I think I need to better explain what I'm doing and how I'm doing it. The basecode is a seperate collection of source code. For example, my directory structure looks like this:
/basecode/
/projectA/
/projectB/
etc...
The projects then use #includes to get headers and the project files directly reference source code files from the basecode directory.


Originally, each project had its own copy of the basecode. This caused two problems: Firstly, bugs that got fixed in one copy were not fixed in another copy causing all kinds of problems, and features that got added to one copy were very difficult to move to another. The second problem was that it took a long time (hour or more) to pull together the code and create a new project (it now takes about 5 minutes - I am aiming for 0 minutes (automation) eventually).

@Mercury: There are several problems with making the basecode a library. The interface may change for starters. It also uses a lot of templates, which can't be DLL'ed. Also, there are a lot of optional modules that would bloat the library.


Anyway, Subversion/AnkhSVN seems to be the solution that I'm after. However, I'm still interested to know the best way of achieving the desired result.

Hallucinogenic's solution seems workable. However, I'm not really keen on having a seperate branch for each project - I am concerned this could cause the same problems as when each project had its own copy of the basecode. The ability to use a rolled-back version for a project until the project is ready to be updated, or the old version of the basecode is modified and thus split (to possibly later be merged), seems preferable.

Anyone have any oppinions or other options on this? Or advice for implementing it?


Anyway - more input is appreciated. I'll keep researching it and look into Subversion.

Share this post


Link to post
Share on other sites
On the topic of source control, I use Perforce at work, and really like it. You can download and use a 2-client version for yourself for free. If you need more users, you need to buy licenses. It also has decent vs.net integration.

Share this post


Link to post
Share on other sites
Your goal seem to be to end up with one source base that both project A and project B is using.

I would try to keep A and B syncrhonized with the base code even if that would require some extra time. I would also try to not switch too much between projects, like having project A and base as your main project and only update B when it's absolutly necessary. This solution would of course require that you don't change the base code too much and too often.

If you want to use separete code bases for the projects however, you might be easier off just having two separate source bases and doing a manual resynch once in a while. But then you won't get the bugs that you fix in one common base though.

The only thing left would be using a versioning system.

Share this post


Link to post
Share on other sites
OK, I think I've worked out my plan.

I will have my basecode in the SVN repository

In the unusual cases where an project needs an older version of the basecode, I will extract that as my working copy and use that (Question: can AnkhSVN do this? Another Question: Can it save the version-to-use data within the project file itself?).

In the rare case where I have to modify the basecode of an older version before I update the project to the newer version of the basecode, I'll use SVN's spliting features. If the change needs to be in the newer version, I'll use the merging features or seeing as this would be a very rare occurance, manually update the new version too.

Does this sound workable? Any more input is still appreciated.

Share this post


Link to post
Share on other sites
Quote:
Original post by DGates
On the topic of source control, I use Perforce at work, and really like it. You can download and use a 2-client version for yourself for free. If you need more users, you need to buy licenses. It also has decent vs.net integration.


Seconded, I use the free 2-client version of Perforce for my own projects. If you've never used source control software before, then I'd say it's a lot easier to pick up than CVS or Subversion. It's very user friendly, and like sourcesafe, has a plug in that allows it to integrate with Visual Studio.

I don't recommend Visual Sourcesafe at all, it's awful, even Microsoft don't use Visual Sourcesafe. It's especially bad for branching so I hear, as it makes a whole copy of the code you're branching, rather than just storing the deltas.

It's not so much of an issue when you're working on your own, but if you're using it professionally, working on a real team, it's a nightmare. Because the branching is so inefficient, it doesn't get used. This means when you're running up to a milestone, the lead coder will tell everyone to stop checking in to the database, in order to avoid introducing bugs, resulting in much lost time, until a stable build is submitted and accepted. One other minor niggle I have with it, is that the check in, and get latest dialogues are very similar, so it's quite easy to do a get, when you really meant to do a check in. Heh, I only did that one once, and very quickly learned not to do it again, after I lost 1 days worth of work on a maya file. This also goes for the get latest, and check out menu, meaning that it's really easy to accidently check out the whole project if you're used to the interface and end up clicking through the dialogues without really looking at them.

Oh, and then there's the fact that it keeps asking if you want to merge binary files when you do a get, while you've got them checked out. Why in the hell would I want to do a merge on a binary file?

God I hate sourcesafe.

Share this post


Link to post
Share on other sites
Stay away from SourceSafe at all costs.. one day it just broke and the whole source tree was gone. Good thing somebody checked out the latest version the night before or there could have been some big issues.

We moved to CVS but needed better branching, etc so the repository just moved over to SVN a few days ago now and it's just amazing.

Lesson of the day: NEVER use SourceSafe.

Share this post


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

  • Advertisement
  • Advertisement
  • Popular Now

  • Advertisement
  • Similar Content

    • By Nostalgic Saint
      https://play.google.com/store/apps/details?id=com.SaintSoftware.TRAP.io
      Trap.io is a game I made and released in one week . I'm in dire need of constructive criticism before I release the first big update, so that I know what is in need of a change or to be redone. Any opinion whether harsh or not will be valuable.
      Trap.io is a game where you collect the trap power-ups and place them and then lead the corresponding enemy (based on color) into the trap to destroy the enemy and score points.The game is endless easy to play difficult to master. The game features highly fast paced combat with an arcade-like feel to movement, to bring back the nostalgia from the past retro space shooter games. With addictive fast paced gameplay a mistake might be your last, keeping up with the fast paced flow games typically lasting 2 minutes, this game is all about fast movement and quick thinking with an element of strategy to trick your cunning, wity enemies into the traps to score points.
      The next planned update will include:
      Leaderboard
      Buying Skins
      Improved Ui
      Improved Overall visuals
      Improved game flow
      Sound Effects
       
      Thanks in advance. Any form of support or opinion will be highly appreciated . 

    • By Affgoo
      https://play.google.com/store/apps/details?id=com.NE.Alien
      still a lot of work to do, but its pretty stable  please let me know what you think <3
      Atlas Sentry is a game of destroy everything. Using your turret, simply swivel and shoot your way to victory, upgrading your weapons to unleash destruction on the variety of spaceships. The bigger your combo’s the more score you get! Earn silver as you play and then purchase new weapons and abilities to better deal with your enemy. Different enemies use different tactics and weapons, work out your own priorities in their destruction order. 

      Features: 
      **2 different game modes 
      **A level select mode with 20 difficult levels including a final boss, can you defeat it? **Arcade mode of endless destruction, how long will you last? 
      **High scores to compete against others, see who can take the top spot. 
       
    • By Chamferbox
      Chamferbox, a mini game asset store has just opened with some nice game assets, 
      Here you can find a free greek statue asset 

      Also check their dragon, zombie dragon and scorpion monster out:



      They're running the Grand Opening Sale, it's 30% off for all items, but for gamedev member, you can use this coupon code:
      GRANDOPEN
      to get 50% off prices What are you waiting for, go to
      http://chamferbox.com
      and get those models now!

      View full story
    • By Dafu
      FES Retro Game Framework is now available on the Unity Asset Store for your kind consideration!
      FES was born when I set out to start a retro pixel game project. I was looking around for an engine to try next. I tried a number of things, from GameMaker, to Fantasy Consoles, to MonoGame and Godot and then ended up back at Unity. Unity is just unbeatable in it's cross-platform support, and ease of deployment, but it sure as heck gets in the way of proper retro pixel games!
      So I poured over the Unity pipeline and found the lowest levels I could tie into and bring up a new retro game engine inside of Unity, but with a completely different source-code-only, classic game-loop retro blitting and bleeping API. Months of polishing and tweaking later I ended up with FES.
      Some FES features:
      Pixel perfect rendering RGB and Indexed color mode, with palette swapping support Primitive shape rendering, lines, rectangles, ellipses, pixels Multi-layered tilemaps with TMX file support Offscreen rendering Text rendering, with text alignment, overflow settings, and custom pixel font support Clipping Sound and Music APIs Simplified Input handling Wide pixel support (think Atari 2600) Post processing and transition effects, such as scanlines, screen wipes, screen shake, fade, pixelate and more Deploy to all Unity supported platforms I've put in lots of hours into a very detail documentation, you can flip through it here to get an better glimpse at the features and general overview: http://www.pixeltrollgames.com/fes/docs/index.html
      FES is carefully designed and well optimized (see live stress test demo below). Internally it uses batching, it chunks tilemaps, is careful about memory allocations, and tries to be smart about any heavy operations.
      Please have a quick look at the screenshots and live demos below and let me know what you think! I'd love to hear some opinions, feedback and questions!
      I hope I've tickled your retro feels!



      More images at: https://imgur.com/a/LFMAc
      Live demo feature reel: https://simmer.io/@Dafu/fes
      Live blitting stress test: https://simmer.io/@Dafu/fes-drawstress
      Unity Asset Store: https://www.assetstore.unity3d.com/#!/content/102064

      View full story
    • By DevdogUnity

      Ho ho ho
      Tis the season of Christmas surprises, and we have a awesome one for you! 🎅  
      Sponsored by all your favorite Unity Asset Store developers, Nordic Game Jam, Pocket Gamer Connects, and co-hosted by Game Analytics, we (Joris and I – Devdog) are launching the second edition of our yearly Christmas Giveaway Calendar for all Unity game developers!
      You can already now sign up right here.
       
      So what’s this all about?
      For the past weeks, we’ve been collecting sponsored gifts related to Unity (asset vouchers, product keys, conference tickets etc.), and throughout each day of December leading up to Christmas Day on the 25th, we will be sending out these sponsored gifts as early gamedev Christmas presents via e-mail to hundreds of lucky winners.
      The total prize pool is at $35,000, with over 1200 presents donated by the awesome sponsors!
       
      Merry Christmas from Devdog, Game Analytics, and every single one of the sponsors.

      View full story
  • Advertisement