r/KerbalSpaceProgram • u/KasperVld Former Dev • Nov 17 '15
Dev Post Devnote Tuesday: The Mother of all Merges
Hello everyone!
With 1.0.5 released and stable we switched gears and have invested a good amount of time to make sure that everyone switched over to the Unity 5 side of development and merging all the code changes from the Unity 4 branch (1.0.x) into the Unity 5 branch (1.1.x). These branches have seen separate development for the past six months, and we’re serious when we say that has led to the mother of all merges.
Fortunately Git allows us to easily merge different branches, but this merge was something different that your standard run-of-the-mill merge. Felipe (HarvesteR) bit the bullet and attempted to merge the branches, an operation that resulted in 390 conflicts on a total of over eleven thousand changed files. A larger problem was that due to optimization concerns many files had been moved on the Unity 5 branch, and these files weren’t properly identified as having been modified but instead were set as added and deleted files. This wouldn’t normally be a problem but given that many of them had received code changes in either Git branch it became one: these changes were not compared and therefore would be lost in the progress.
This was a larger problem that the code change conflicts themselves, because hunting down the changes in both versions (and then determining which version of the code should prevail) manually is nearly impossible. Fortunately Git provided us with an alternative method: rebasing.
Instead of grabbing all the accumulated modifications from both sides and trying to crash them together straight away, rebasing works by treating one side as if it had happened first, then replaying the changes from the other side on top of that, as if it had happened afterwards. It’s a brilliant tool, which meant that by rebasing the Unity 5 branch on top of the Unity 4 branch, we could have the changes from our Unity 5 overhauls done after all of the Unity 4 work as if it had been completed before any work on Unity 5 had even started. Not quite time travel, but it’s the close.
The rebasing tool took us from 390 conflicts and a lot of added/deleted files to 398 ‘both modified’ conflicts, which was a good place for Felipe to start. This was a task that had to be completed by one developer because if the changes are ‘pushed’ then the files lose their conflicted tags which makes them much harder to find and resolve. At this point an overlooked line of code would mean that a bugfix or new feature would simply disappear.
The next job was making the game compile and work properly: compile problems galore, from syntax problems from problematic merges, to the much expected integration problems of trying to make two six-month long trains of changes crash together and keep on going in a single rail. Fixing these issues meant Felipe and other developers worked through the weekend and yesterday’s Mexican national holiday. The good news is that it worked as the two branches are now merged into, which (hopefully) contains all the changes done on both sides.
Straight after this mother of all merges we moved back to finishing the user interface overhaul. Many tweaks are still left to be done but with the Flight scene done and the Editors a good part of the way there progress is definitely felt and made. The tracking station also received some attention, and a very old bug was fixed in the process: small orbits on distant planets would be visible if you were zoomed in on any planet which wasn’t particularly hard on the eyes, but did affect performance. Orbits you could never see were wasting CPU time to render as tiny blips. That should be fixed now. If you zoom in to Kerbin, you should only see orbits belonging to the Kerbin system. If you zoom out, planets will fade in, but not their moons, until you zoom into them.
While on his coding spree over the weekend Felipe also fixed the rendering of the new map nodes and put quite a lot of work in on fixing depth sorting issues which were occurring because when transforming the node positions to screen space coordinates, they were losing all depth information.
The fix for that seemed straightforward: the nodes needed to have their Z coordinates back, but that presented a problem. In map view, even though the nodes live in a scaled down layer, the distances are still quite huge. This is a problem because the interface canvas depth space is quite finite, so we needed a way to transform these potentially boundless distances down to a finite space.
Usually this is done by defining a ‘far’ plane. A distance considered to be at infinity (but which very much isn’t), so you can get a depth scalar value by dividing against that. That approach always bothered me, because it requires a fair amount of guessing, and mapping depth linearly like that would mean wasting most of the canvas depth space with… well, empty space.
Felipe worked out a curve using a graph plotter which is based on the really nice asymptotes produced by taking reciprocals of things. Starting from a reciprocal (1/x) function which approaches zero as x approaches infinity, he worked out a neat little function that transforms the camera-relative distance of objects in the world to the finite canvas space, in such a way that they never quite reach 100% depth. They slowly taper out as they approach infinity, and thus the depth space is filled out as optimally as possible.
Meanwhile Mike (Mu) continued work on the 1.1 version of part tools. It now supports package dependency loading, DLL loading and a fair few other bits. The KSPedia tools were also folded into the package so you can create entire plugin packages and package them as a single asset bundle. The KSP-side of part tools, to load and unload assets dynamically, is almost complete. Dynamic loading and unloading of assets in the game will probably not be in 1.1 yet as it requires a fair bit of work to get this fully functional however it will be coming.
KSPedia is well under development, and Dave (TriggerAu) has been working hard to improve the efficiency of the development process in this area, setting up scripts that convert vector files (images) into component pieces that will allow the Unity Engine to display them ingame. A basic web display is also being made to allow the QA team to review the content independently of the game, making sure that no typos or inconsistencies slip through.
While on the subject of update 1.1. We’re currently at a fork in the road: do we continue with the features we set out to add and delay the release or do we perhaps cut a few features to meet our internal deadlines. There’s a few things dependent on this decision, and that not only makes it a very important decision but also one that is rather ‘opaque’ for people not involved in the process. There are many things to consider and we’ll keep you up-to-date in the future devnotes. Jim (Romfarer) quoted Felipe in this regard: “there is no amount of pre-planning that can avoid having to revise the layout entirely”.
It’s a hard landing for our new producer, Joe “Dr Turkey”, who will introduce himself below and will try to give you some insight into the current state of how we look at the near future:
Well, hi! So this is me, some of you already chatted with me over EJ’s stream last Friday.
Basically I have been working behind the curtain for the past month to hit the ground running. I’ve been crazy busy getting to know the (truly fantastic) team, the community, and the more ‘technical’ state of things as well as the business and overall planning overview as a whole. There is so much to do that a list would probably take the space of the whole of this week's devnotes to write. I was there for the birth of 1.0.5 to take notes and analyze how the team performed as a whole.
In a VERY general summary, right now the plan is to consolidate current projects, consoles and the 1.1 update as smoothly as possible. Hopefully as soon as the transition period ends, I’ll have the time and energy to start laying the groundwork for some secret hush-hush thingies for the far- far away future. On the lighter side, I’m trying to get things all good and set up for the Squadcast, which will have me as host and some surprise co-host. I got some fun plans for my tenure as Squadcaster, but their implementation depends on the status of other projects, job timing, some extra planning and organizing beyond my current capacity as a human-poultry hybrid. No worries though, soon I’ll have power over spacetime and I’ll be able to extend all of Squad’s days from 24 to 42 hours per day, and then the true TAKE OVER will begin. I mean, gobble. gobble!!
Looking forward to more sleepless nights in the name of KSP!
That’s it for this week’s devnotes. Be sure to follow us on our official forums, Facebook and Twitter. If you have any questions you can post them there.
65
u/Iamsodarncool Master Kerbalnaut Nov 17 '15
Glad to hear about dynamic asset loading, even if it's far away it will be awesome to have.
As for the debate on 1.1- why don't you release a barebones Unity upgrade 1.1 and then add all the exciting features later in a 1.1.1?
106
u/whitethane Nov 17 '15 edited Nov 18 '15
Personally I'd like to see the U5 update prioritize for 1.1 instead of pushing features on top of the engine update. For a start, there's no sense in rushing a product, so trying to complete U5 and a feature set will likely hurt the quality of KSP. As much as I hate to say no to features, the hardware limitations of U4 seem to be the biggest detriment for KSP, and can really limit enjoyment of the game. If we don't get radio antennas or some extra parts we'll live, but the U5 upgrade changes the game significantly for the better.
Just my 2 cents.
21
u/AngryCalcul8or Nov 17 '15
I definitely want a faster switch to unity 5 more than all the fancy proposed features. But I'm willing to wait for whatever is decided :)
21
u/The_Chronox Nov 18 '15
People have said it already, but I would also like to have the Unity5 update as soon as it's feasible.
Even when the Unity5 update is released, it'll be a few weeks for most mods to update, so most people won't be able to enjoy 1.1 fully until a bit after the U5 update. Releasing the 1.1 update a little before 1.1.X would give modders more time to work and update their stuff
10
u/Foulds28 Nov 18 '15
I vote for the unity 5 update to be prioritized over new features, but I'll be happy with whatever you choose, I trust your judgement. You guys go above and beyond what's required, you out do every other developer I know of in terms of community involvement and communication. You guys are the best devs we could have asked for, keep up the amazing work and give yourselves a pat on the back for the huge accomplishments you have made. But most of all don't ever think you have done us wrong, the only wrong you have done is make thousands of people happy.
17
u/ohineedanameforthis Nov 17 '15
I'll bookmark this post in case anybody asks me again why I prefer git as a vcs.
7
u/i_start_fires Master Kerbalnaut Nov 18 '15
If they're features we haven't had up until now, I would much rather see Unity 5 before anything else.
5
u/Rat2man Master Kerbalnaut Nov 18 '15
And this is why I love you guys. Not only did you make a fantastic game, but you give us these "behind the scenes" of what you all are up to. Love it and yes the #hype is real!
8
u/CommanderSpork Alone on Eeloo Nov 17 '15
We must initiate Dr. Turkey.
One of us, one of us. Gooble gobble, gooble gobble. We accept him, we accept him. One of us, one of us.
4
u/alwaysstuckforaname Nov 18 '15
I'm a software developer and the idea that you tried to merge files that have have both been modified in two parallel streams and been moved just made me wince ... i hope Felipe gets some beers on the company for this :)
14
u/byzod Nov 18 '15
Deadline?No! Do WHATEVER you need to! We kerbonauts want a FULL game, not a QUICK game. Just me?
6
u/[deleted] Nov 18 '15
I've been holding back on KSP for a few months now because I've got to the point where my install will barely run due to the number of mods and texture tweaks, and I've grown tired of shearing the files in order to make the game run.
I'm not sending this message as a criticism, I'm just saying I have huge hopes in the transition to Unity 5 for mods and assets loading : if you choose to prioritize this transition rather than the addition of new features (which we got plenty of in the last updates), I'd be forever grateful.
2
u/Timoff Nov 18 '15
Can you do something to attempt to make career saves not break? It's really annoying to play the game in career mode only for a new version to come and wipe it out. There has to be a way to reconcile this.
2
u/masterwit Nov 18 '15
And I thought git merges sucked at the distro level.
Thanks for the hard work and fantastic support
2
u/8Bitsblu IITE Dev Nov 18 '15
What a nice young man.
2
u/KerbalEssences Master Kerbalnaut Nov 18 '15
It depends on your schedule. If you are aiming for a christmas release and it would be impossible to achieve that goal without leaving out some features I'd go for it. Also, an engine change probably has a higher chance of bugs appearing after launch. This means the less additional features you add the more time you have for your families arround christmas ;P
2
u/thundercuntingnow Nov 19 '15
Git dev here!
Checkout the man page for merge, search for rename-threshold. If you set a lower than default threshold you may have avoided some of the problems using merge.
3
u/Viddlerx Nov 17 '15
Awesome work, keep it up guys! :)
3
u/StephanieAmbrose Nov 18 '15
If they ever add 5m parts to the stock game, I hope that the heavy lift engine that comes with it is called the Unity
1
u/the_Demongod Nov 18 '15
I'm currently taking a Java course and for a project my group is using Github and I've taken the role of being in charge of the repository so I feel your pain. Sounds like you have some very dedicated programmers and are making good progress. So hyped for the release. Good luck!
1
u/senion Nov 18 '15
Gut feeling is Unity V5 first and features later may end up making those features take even longer to implement as new bugs are found while everyone is throwing hundreds of mods on the 64-bit version.
Optimistically, the U5 update first and features second wouldn't delay internal development. Do what you think is best, Squad.
1
u/Yuffy_Kisaragi Nov 18 '15
now THAT was a wall of text!
1
u/WaitForItTheMongols KerbalAcademy Mod Nov 18 '15
Adding another voice in favor of splitting up Unity 5 update from feature update. I personally prefer frequent small tweak releases over widely-spaced mega-releases (assuming quality is the same in both). It means there isn't so much "dormant code", that is, things you have finished making but are waiting for the other features to join it for release.
1
u/[deleted] Nov 18 '15
i dont get it. docks when?
1
u/zekromNLR Nov 18 '15
I'd say release 1.1 as just the Unity 5 update, maybe also with Dynamic Asset Loading as soon as that is stable and all the really bad (i.e. game-breaking) bugs have been worked out (Danny will find the amusing physics glitches anyways :P) and then release the other new features in a later 1.1.x update.
1
u/RoeddipusHex Hyper Kerbalnaut Nov 18 '15
People seem to think the Unity 5 port is on the table as something that could be pushed back. That's not how I read it. The Unity 5 changes have been merged into the code base. That's done. He said they were considering whether to add all the planned features with a later release date or cut some features and meet internal deadlines.
1
u/Jack0SX Hermes Commander Nov 18 '15
I don't know much about software development so I'm assuming 390 errors is a lot of stuff to fix!
I'm honestly more keen on seeing 64 bit/Unity 5 compatibility. Memory shortage has been the Achilles heel of Kerbal Space Program.
That said; whatever you guys deem a priority I'm sure the community is with you 100%!
1
u/TyrannoFan Nov 18 '15 edited Nov 18 '15
I'd rather get the Unity 5 upgrade now and cool features later. With the mods I want to install, the game crashes every few minutes, and I don't want to sacrifice what I consider to be essential mods. An upgrade to just 64 bit as well as multi-threading would be more exciting to me than just new parts and features.
Also, some of those new parts and features can be substituted with mods like RemoteTech. So the Unity 5 upgrade should definitely be the #1 priority IMO.
1
u/Toekind Nov 18 '15
Does it bother anyone else that a turkey is a flightless bird.
1
u/boxinnabox Nov 19 '15
I am concerned about this inverse depth scaling for map view nodes. You found a clever solution, but why was this necessary? Why is it a problem just now? Will this change the way map view looks?
Map view has been around for a long time, and it always looked like a perfect, true-scale, 3D view of the solar system. It doesn't seem like you had to use an inverse function to artificially re-scale distant objects to fit in the view. Instead of being a true-scale view, it sounds like now map view will be a distorted schematic view with artificially compressed scale.
1
u/notHooptieJ Nov 19 '15 edited Nov 19 '15
I'd be all for releasing a 1.1 "Unity 5" upgrade, minus other feature enhancements, ON THE CONDITION, that it doesnt remove currently working features.
That said, if its not possible to make to "feature/performance parity" with current release, i'd rather you guys get it done right(and not let the hypetrain push any more half-assed updates), and will happily and patiently wait.
But - if the U5 update comes out buggy with less stuff working than currently.. i'll be the first one handing out pitchforks and torches.
1
u/[deleted] Nov 19 '15
I was working on a multiplayer Android game a while back and had to completely gut and reimplement the network code while the rest of the team continued to work on the game itself. After completing the new network back end came time to merge. There were about 1900 compile errors. It was quite a project getting the thing to compile and run again, and this was only after forking the project for two weeks. I can't imagine the pain you guys went through. Kudos.
1
u/stdexception Master Kerbalnaut Nov 28 '15
I'm a bit late, but please make this web viewer available to us, as it would be immensely useful for multi-monitor users.
0
u/gerusz Nov 18 '15
Bwahahahahaha! Right, yeah. Easily. Good one!
-1
u/Juuzeri Nov 17 '15
It's happening.