Some stuff I am playing with right now for game I am programming.
Took a 'break' from working on my game to make a hover car.
Took me forever to add a basic self righting / stabilisation mechanism due to the confusing nature of rotations, gimbal lock and quaternions
Uses a configurable grid of hover forces under the car also so it isn't disturbed by small objects
Can set stabilisation force for when on ground separate from when in air
If you set the stabilisation force high for on ground it will stay level even when climbing a slope
And just played with it using the wireless xbox controller, tis fun!
Used Tattiebogle on Mac to use the controller
Link: tattiebogle.net --- Xbox360Controller
Nerding out over here with the new Swift programming language from Apple
Read the ebook, quite impressed with how elegant it is, minimal but powerful pushing the functionality to the frameworks like Cocoa and SpriteKit, GCD for asynchronous code and so on.
Most importantly is, I can already write code in Swift, I cannot even read most code in Objective-C
Super nerd points for writing Swift code in a command line terminal window:
Even bigger nerd points for doing the same with C# and Unity:
I'm already jealous of a few of the language features that C# is missing, like easy to read write Tuples, and the range syntax '0.0....120.0' nice they stole that from Python I think.
The fact that it looks so much like a script language, yet is really compiled down to machine code is a key detail here. The fact it looks like a script but has no garbage collection is also significant. So very very glad I chose to learn C# instead of Objective-C as it has pretty much already taught me to write in Swift, people going from Objective-C to Swift will probably find it harder
:-D
Also very jealous of the ability to write into this realtime 'playground' where it runs your code as you write while showing visual representations of values, code ran over time even fully rendered graphics object on the right side of the screen. The Ability to scrub your playback back in time.... awesome.
The fact it is a closed spec/compiler and will only run on Apple devices, well what do you expect.
And this had to be done with the new playground:
My talents are wasted
But swift is really elegant and minimal, while allegedly very very fast.
versus c#
So very very similar looking to C#.. and semi colons are ugly
Also I just I write a nice script that you can drag/drop a Unity project folder onto and it will inject preset hardlinks ( like symlinks but craftier ), so say you have a Standard Unity Project folder with a bunch of utility scripts, standard images and stuff you like to always have in a project, it can link to that ( can show a lis. t of items to pick from if you only want to include some not all of the items also ), and another script you can drag the folder/folders onto that will remove those links. Tested it all and It's completely safe regarding deletion. Which means I can finally start using separate Projects for things instead of lumping everything into one big monolithic super project that takes over 10 seconds to compile every time I change something in the editor :-S
Producitivty Ho!
Trying to implement something similar to Swifts built in language support for Tuples
Creating a generic list of an anonymous type, simple enough
But how do I return an anon type from a method?
Using anonymous types and casting using an extensions method, is how:
Once you hide all that extensions method stuff away It's not too ugly, you are left with a function that returns an object. And you take the result and just do:
whateverResult.CastTo( new{ name="", age="" )
And then you can access the properties as per usual, but this will get real ugly for lists of anon types, and yes I realise I have age as a string not an int
And yes with dynamic type you can probably do this nicely, but I target iOS with is ahead of time compilation AOT, so cannot do dynamic
Still.. .swift is better
And next C# has Tuples but they are completely useless ( thought I think they are improving this in C# 6 )
You can't name there arguments, and it looks ugly as sin, I hate angle brackets
I also saw someone creating a class that inherits from the Tuple type, allowing you to add names to it... not sure why you would ever do that.. I guess it saves you having to implement IComparable, IStructuralEquatable and friends on your own custom type.
So back to using 'out' parameters, which are kinda nasty... very nasty really, just not as nasty as the above
Now I hate twitter for various... nay numerous reasons. Chief amongst them the fact that for the very few things I do follow, I want to make sure I read every single thing they say and essentially mark things as read like how email or RSS feeds work. And so finally I have found a way to get twitter into an rss feed to use with a service like Feedly. This used to work in the past but Twitter stopped it because well.. Twitter are dicks.
This is really easy to setup also:
Link: www.labnol.org --- 28149
There is also this service that can pull links from your feeds into an RSS but I did'nt try it:
Link: www.siftlinks.com
Just more ways I can get stuff from my RSS reader Feedly over to my 'read it later' service Pocket... this is why I got this badge of honour after all ;-P
The way Unity will work on the web is the most confusing bastard stuff in the world
Unity uses Mono for It's scripting
Mono is an custom implementation of the C# spec that Microsoft partially open sourced
the part Unity uses is free due to the open source LGPL license it enjoys
Then Mobile phones happened and Apple do not allow the on the fly compilation that Mono lets you do free
This is done via a JIT VM, just in time virtual machine and is typically how C# is ran, compiled on the fly using magic
instead they have to compile beforehand ( AOT ahead of time ) which Mono wants moneys for... lots and lots of moneys
So they held Unity to ransom ( probably ) as Unity become more successful
Unity said FU... people are happy with the 5 year old version you already sold us
But people were not happy, they cried at weird memory problems and missing features that came with C# 4 and 5 that they could only dream of using, let alone the debugging issues.
And now to get out of this on going problem and finally be able to upgrade to a modern C# with better memory management they will do the following
C# is compiled to an intermediate language ( IL ) using the free part of Mono, this is normally then ran in realtime on a device via the HIT VM ( which Apple won't allow )
But instead Unity will convert this intermediate code into C++ source code, which is then compiled using Enscripten asm.js thingy made? by Firefox guys into a weird JavaScript soup that some how runs fast but looks like computer vomit
Thus taking advantage of a shit ton of work either end that is free and open source and even used and probably contributed to by their competitor Unreal Engine and Mono
They just have to take care of this middle step themselves... now do we trust them to do this part properly?
Already they are claiming "What is so exciting about IL2CPP is the big performance speedups however. We have seen 2-3x speedups on math heavy code."
Still a weird place we find ourselves that ( C# -> IL -> C++ -> JS -> Machine Code ) is a fast intelligent way of making anything.. ever..
Link: blogs.unity3d.com --- the-future-of-scripting-in-unity
Link: forum.unity3d.com --- 247039-The-collected-il2cpp-forum-topic
Link: blogs.unity3d.com --- on-the-future-of-web-publishing-in-unity