Darknet, Unity, and the Asset Store
Darknet is built in Unity, like everything else nowadays. Unity seems to be the dominant engine among indies by an enormous margin. Frankly, I can understand why. It’s relatively easy to use, it deploys just about everywhere, and it offers a great set of features. Unity’s popularity, in turn, encourages other companies and platforms (like Oculus) to support it, and the engine’s huge development community is another big plus. I’ve heard plenty of complaints too, and I understand that there are flaws and disadvantages, but it’s really a remarkable piece of software.
The best thing about Unity, though, and the subject of this paean, is the Asset Store. Any developer can sell assets or extensions to Unity on the Asset Store, and these products have saved me an enormous amount of time and effort. I want to give credit to some of the ones that have had the biggest impact on Darknet.
iTween and LeanTween
Smooth transitions (sometimes called “easing” or “tweening”) are a critical element of polish. Once upon a time, I would implement all tweens myself. I’d carefully adjust the acceleration and position and timing of every little thing in the game until I eventually ran out of time or motivation. It was always a stupid way of doing things, but I didn’t know any better.
Enter iTween. iTween is a free tweening engine that has saved me from many a headache. Instead of setting up all the variables, figuring out the math, and updating objects every frame, I just say “hey iTween, move this to there” and it does all the work for me. There are a ton of options for tweening different properties or adjusting the details, and now, almost every moving part of Darknet is controlled in this way. (Enormous thanks to Will Stallwood, who introduced me to this marvel for the first time.)
At some point, I discovered a downside of iTween: it’s not particularly efficient. It works great in moderation, but as I said, I was using it for just about everything. So, I googled the problem, and found another convenient prepackaged solution waiting for me: LeanTween. It’s essentially the same as iTween, but much faster and (surprisingly) even easier to use. I feel spoiled.
When I started using Unity, the built-in 2D elements had not yet been released, so I turned to the Asset Store. After considering some of its many competitors, I ended up choosing 2D Toolkit to work with, and I have not been sorry. Even now that Unity offers some of the same features, I see no reason to stop using it.
2D Toolkit solves a lot of technical problems. It will bundle your textures into atlases, use vertex colors for tinting, generate easy bitmap fonts, and give you access to a pixel-perfect 2D camera. In less technical terms: it makes 2D development much faster and easier!
The earliest versions of Darknet were composed entirely of straight lines because straight lines are easy. When it became clear that occasional curves would be nice, I turned again to the Asset Store, and I found Curvy waiting for me.
Curvy offers a ton of options for defining curved paths. It will also dynamically build 3D shapes based on those paths, which is how the curved links between nodes are generated. I’m sure that I could handle the math and eventually build everything myself, but Curvy is fast and convenient, and I’m always happy to skip the boring part and just get the final product.
I don’t know if or when Darknet will be translated into other languages, but I’ve always been advised to consider it early and to build the game with localization in mind. Naturally, the Asset Store has several solutions clamoring to help me out. I ended up selecting I2 Localization.
I2 lets me define all in-game text with a tag, and it then automatically assigns the proper text based on a spreadsheet. It works with a Google Drive spreadsheet if you want to collaborate online, it can change audio and fonts based on language, and it integrates will a bunch of major UI solutions (including, happily, 2D Toolkit). I’ve never done localization before, but I2 makes it seem like it won’t be all that bad!
When I needed a cool glowing effect that was compatible with the Oculus Rift, I found that the creator of the Glow11 plugin had made a Oculus-compable version for his customers.
When I needed a cool glitch effect, I discovered one for free at the top of the /r/unity3d subreddit.
When I needed a bunch of 3D geometric shapes, I found a huge collection of polyhedra available for $5.
I have saved so much time by using the extensions and assets that others have created. And I haven’t even started on custom UI solutions, or multiplayer frameworks, or integration into platforms like Steamworks. The whole thing is a miracle, and even though I still have plenty of programming headaches left to suffer, I’m grateful to be making games at a time when resources like these are available to everyone. Ultimately, I think Unity’s dominance is well-earned.