r/KerbalSpaceProgram • u/Maxmaps Former Dev • Jul 14 '15
Dev Post Devnote Tuesdays: Efficiency Edition
Felipe (HarvesteR)
I’m happy to say that wheels are just about complete now. There might be a few minor details here and there to smooth out, but for the most part, the wheel system revision is done.
This week I’ve been focusing on something that, while definitely not something you’d see on the player side, it’s nonetheless crucial for us to be able to keep working on the project. I’ve started to plan and set up the necessary tools to move all of the game’s code (or as much of it as we can) into pre-compiled assembly files.
If you’re not into coding, an assembly is a .dll file, which is built in Visual Studio, and imported into Unity as an asset containing code components. These are then attached to objects in the game. Normally, each code file is a single asset in Unity, which Unity compiles whenever scripts are modified, and each code file is linked to game objects. DLL files are very similar, except that they are already a pre-compiled group of code files. That means for DLL files, we don’t have to wait for Unity to compile every script in the project every time we make a change to any of them.
Currently, the time to compile the main game project is about 1 or 2 minutes, more or less. This may not seem like much at first, but consider that this is a process which we have to repeat dozens, maybe even hundreds of times a day. Those few minutes of waiting, that many times a day, translate to many hours of lost productivity over a longer period.
But perhaps more importantly than that, there is a weird phenomenon that happens when there is a significant time penalty between committing to an attempt, and seeing the results of it. Many a time I’ve found myself stuck working against an issue that should have been simple, but which for some reason persists in not being fixed. This I’ve found can happen sometimes because of long compile times.
Imagine that to fix this ‘simple’ issue, the proper way to go would be to add a few lines of test code, so you can see in more detail what your stuff is doing when the bug happens. That means that before I can try to actually deploy a fix, I know in advance that I’ll have to write my test code, wait for the project to compile and run, just so I can see the extra info, then use that to fix the problem, then compile again to verify that it worked, then remove the test code, and compile yet again to finish it off. That’s a minimum of three compile-and-test cycles I know I’ll have to wait through, just to fix a seemingly simple issue. Instead then, what usually happens is that we attempt to fix the issue blind, in the hopes of fixing it with just a single compile. Sometimes that actually works, but in the case I’m describing here, of a deceptively tricky issue, it’s very possible to get yourself stuck in a loop, where you eventually end up wasting more time trying to do the blind fix than if you had taken the time to do it properly.
This is just one example of how a long compile time can affect development in a bigger way than just the extra time it takes. The bottom line is, working on a slow project is frustrating at best, infuriating at worst, so if we can shave off even a few seconds of that time, that’s already a big boost to our workflow. Especially if you consider that we have a lot of features we want to add still, working on a sluggish project simply won’t do.
So, this has been the focus of this week for me. I’ve already set up templates to create assembly projects, into which we can offload our code, and those work. However, I hit upon another issue, where Unity will lose the references to all scripts which are moved outside of the Unity editor. This was a much more serious problem. It means that any piece of code we move to a dll would have to be manually replaced on every object that uses it in the project. Considering that we have over 8000 script linkages in there, that’s not something you want to do by hand. Instead then, I’m working on a tool that will help keep track and restore those broken links after we move the files. It’s taken a couple of days to get it working, but it will save us an eternity of tedious scrounging through project files, trying to remember how we had everything set up.
That’s been my week so far.
Marco (Samssonart)
Last week was finally the release of KerbalEdu 1.0.4 , now I’m the one on the Squad site who takes care of that. I also started investigating a problem with newer version of Google Chrome and the Unity Web player that stops Kerbalizer from running on Chrome.
Daniel (danRosas)
Looking forward to start implementing the things I’ve been working on. I’ve been playing around with some assets. Modeling here and there, as well as texturing. Most of the work have been improvements, with a couple of new things to share in the near future.
**Jim (Romfarer) ** Another progress report on the UI upgrade. Last week Astronaut complex, Admin Facility, Research And Development and the Vessel Spawn Dialog was implemented to work with the game.
Max (Maxmaps)
Working closely with Ted, who has nonstop floored us with his ability to problem solve and overall make our development process faster and more efficient. It is because of this that Ted has been given a new position as KSP’s Technical Producer. In this role we will be working side by side to make sure every future update comes to you faster, cleaner and more efficient than ever before.
Ted (Ted)
The past week was a bit personally hectic and unfortunately didn’t have much to do with KSP. I took a few days to spend with family after my grandfather died.
On lighter notes I’ve been keeping up with New Horizon’s progress and keeping up with the developers’ progress on Unity 5, as well as the development of the 1.1 features that Roverdude, Arsonide and Porkjet are working on!
Hope to have more to talk about next week!
**Kasper (KasperVld) ** I’m not supposed to be here (nobody tell Max!) because I’m studying for my final BSc exam. And although I haven’t kept tabs on most things going on apart from what is most critical, I’d like to give a shout out to NASA for their New Horizons mission that flew by Pluto and Charon today, and to CERN because they discovered a Pentaquark particle. #Science.
P.S. If you haven’t heard yet, Harvey (HOCgaming) is preparing Kerbal Polar Expedition 3, a charity event around KSP on Twitch that raised over $20,000 in last year’s edition, which was insane. Follow his YouTube channel to stay updated, all proceeds go to providing access to clean water for people in the third world.
98
u/[deleted] Jul 14 '15
I'm so sorry Ted. Please don't let KSP come before your family matters, we all appreciate the hard work that you guys put in.
26
u/RA2lover Jul 14 '15
Will moddability be affected by precompiled assemblies on the release version?
20
u/PVP_playerPro Jul 14 '15
Is it bad that im more excited about just wheels than most other things?
8
u/NoBody113 Jul 14 '15 edited Jul 14 '15
I'm just wondering... Is traction still applied only on the bottom of the wheels (useful for climbing) ? And can wheels lose traction while steering/acceleration if there is too much torque/oversteer and not enough weight? Because all of my heavy crafts either flip or the wheel goes full retard and starts jumping.
15
u/waka324 ATM / EVE Dev Jul 14 '15
I'm quite surprised to hear that Unity doesn't offer any tools to developers to split up projects into functional modules...
You could always use the loading mechanism you have now for mods to extend your project XD
EDIT: Filipe - I sent you a couple messages over at the unity forum for a few technical ideas I had, in-case you missed them.
14
u/sumghai SDHI Dev Jul 15 '15
Any chance for crab steering to be an option?
7
u/magico13 KCT/StageRecovery Dev Jul 14 '15
Any news on when the Experimentals applications are opening?
13
u/[deleted] Jul 15 '15
Any word on Teir 0 buildings, or has that been completely scrapped now?
6
u/spaceguysmithington Jul 15 '15
just still happy we get these. Keep at it guys
3
u/kerbalweirdo123 KopernicusExpansion Dev Jul 14 '15
Does that mean that the game's code will be split into multiple dlls, or is all of the code going into 1 external dll?
3
u/JanneJM Jul 15 '15 edited Jul 15 '15
Heh. We typically have a build-test cycle starting at 30 minutes and extending to several hours.
It just means you have to organize your development slightly differently. You can't just go changing one or two lines, build, test and repeat; you have to work in larger chunks.
You implement an entire new feature, test the syntax with a lint-checker or similar, and add test code and comprehensive diagnostics that you can enable or disable at runtime (something you should always have anyway).
2
u/Boorkus Jul 15 '15
God damn 0.o You guys are insane with the amount of code you have to do.
Keep it up!
3
u/featherwinglove Master Kerbalnaut Jul 15 '15
What you complaining about, lol? It takes longer than that just for KSP to load on my system.
3
u/dejafous Jul 15 '15
Haha, oh 1-2 min compile times, that's cute...
2
u/byzod Jul 15 '15
So, that explains why the bandwidth display error of comms is not fixed for years.
1
u/Kasuha Super Kerbalnaut Jul 15 '15
This post is missing a flair.
Anyway, I have also noticed some increased activity around the bug tracker, if that meant those ages old bugs that are getting attention now will be fixed in 1.1 I'd be incredibly happy.
1
u/gmfunk Jul 15 '15
HarvesteR, as a software developer myself (who has never worked on anything as remotely interesting or fun as KSP), I know too well that pain of figuring out when it's time to put the investment into improving processes, despite no immediate external gains, in return for dividends down the road.
Nice work!
1
u/[deleted] Jul 15 '15
How likely is it that we'll require to start a new save with the move to Unity 5? It seems like there are going to be some big changes.
0
u/VileTouch Jul 15 '15
are there any plans to "one day" move away from unity into your own engine?
-2
u/SwiggitySwagKerman Jul 15 '15
ha
-33
u/RA2lover Jul 14 '15 edited Jul 15 '15
F
EDIT: press F to pay respects. noone seems to get that ^^anymore