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
Plex is quite brilliant ( and free )
If you have your own collection of movies ( say you got from the equally brilliant Yify website yts.re ) or just home videos or photos or whatever. Plex will run thru them and find the ratings, descriptions, poster art and present them to your Tv either via DLNA or via various native clients it has such as for the Roku ( also brilliant if soon to be obsolete due to the new and upcoming Amazon Fire Tv and Android Tv and Apple Tv etc ) and you can get a native Plex client for iPad iOS and Android. And the source code is available, which leads to things like Rarflix which is an enhanced Roku client. And it has plugin support for adding your own channels to navigate various sites, or adding things like omdb support ( also brilliant , a site that gives you an API to access movie information )
So using all this combined with my new 10 megabytes per second internet wooyay, I wrote a script that takes my IMDB watch list and magically downloads all the movies, boom, 300 movies... which naturally I legally own all of them already.. *cough* ahem, I have said this before, the Movie industry needs to be real careful and stop the infighting, I want to pay monthly for access to all tv and movies and music. I do not want to pay £10 per movie to RENT or buy it. I do not want to have to subscribe to 5 different services all with varying degrees of support for my devices and even differing quality or limited availability. And they could do all of that for a reasonable price... but they do not. So apps like Popcorn Hour ( also brilliant if you don't mind the lower quality ) emerge become open source and suddenly people can freely stream almost any movie instantly for free, and then they get no money. Zip Diddly Squat.
I am a paying user of Netflix ( also brilliant ) but it periodically looses films I wanted to watch due to license issues or whatever. And the selection of films in the UK is a joke compared to the US. But it is still the most convenient way to get at most of the Tv series I watch.. well given the 50/50 chance they are even on Netflix anyway. And the Netflix original creations such as House of Cards are significant draws, good for them, as at any point in an instant the film studio can and have pulled significant numbers of films out of greed.
*sigh* all alone
Also after a decade of using Apple Script I finally started using external functions, so you can have common functionality in separate apple scripts and use them from anywhere else.
It is achieved quite simply with:
set SomeVariable to load script POSIX file "/SomePath/SomeFolder/SomeScript.scpt"
tell SomeVariable to someFunction(someStuff)
Embarrassingly simple, yet I never thought to check it could do that till now. Also you can use a property instead of a variable to store the script in, then it is saved with the file. So if you make changes to the originally loaded script it won't effect other scripts you saved that used an older version ( till you open them up and resave them ) this would prevent say you changing something in the loaded script that inadvertently broke many other scripts. The Cons are obviously any improvements you make won't propagate then either.
Also I have implemented some multi threaded type stuff by using this:
set scptf to "theScriptYourWantToRun.scpt"
set arglist to "arg1 arg2" -- A space separate string of arguments you want to send to the script
do shell script "/usr/bin/osascript "" & scptf & """ & arglist & " >/dev/null 2>&1 &"
Which will run a script and send it some arguments / variables. And it doesn't sit around and wait for it to finish ( so you can't have any callbacks as such ) but is good to spit out 100 of processes that are happy to work independently of each other.
-
And in other news I repaired my TimeBomb / Apple Time Capsule, soldered new capacitors onto it and fixed a resistor onto the fan to keep it permanently running and cut a hole in the bottom for air flow. On performing this however I found someone had already changes the capacitors themselves
:-D
then remembered vaguely that I had in fact bought a refurb/repaired capsule off ebay.Thankfully the new AC capsules do not have the sudden death problems any more. This has all been a huge pain in the ass simply because I cannot use my 3TB in any external enclosures due to legacy bit issues, ugh. Nothing but a nightmare all round.
It is no wonder I never get any work done... I need to work on my priorities, just after I uhm... write a script to remind me to do things
:-P