When I connect an Ethernet cable to my MacBook, WiFi is automatically disabled. When I disconnect the Ethernet cable, WiFi is enabled again. This not standard behaviour. It seems like magic. so how did I do it?
Brett Terpstra recently posted a tip on how to turn a Mac’s WiFi on and off from the shell. I remembered that Keyboard Maestro recently added functionality to allow the triggering of a script when a volume was mounted or unmounted.
Well, what does a volume mount have to do with an ethernet cable connection? I only “dock” my MacBook to a USB extender, power and Ethernet. Whenever I plug in the USB extender, my media and backup drives become available. Sometimes I might disconnect my backup drive, but whenever I’m “docked”, my media drive entitled amazingly enough, “Media” is always connected.
So I set up a Volume mounted trigger on “Media” and this executed the following shell script, taken straight from Terpstra’s article:
networksetup -setairportpower en0 off
And I set up a corresponding shell script trigger for when “Media” is unmounted as follows:
networksetup -setairportpower en0 on
Voilà! I no longer have to manually turn WiFi off to take advantage of lightning fast Ethernet speeds when I’m plugged into my BT Infinity 2 router over the Gigabit Ethernet, and I no longer have to remember to enable WiFi when I unplug.
Finally then, here is the PC build of Reach for the Sky, my toy, soon to be I think, the world’s first Rocket RPG. Yes, that’s grandiose. Yes, that’s tongue in cheek. Oh and there is a Mac version too. Of course. And the Mac version has that lovely rocket sound.
Get the PC build here.
Get the Mac build here.
Remember, it’s just a toy, so muck around with it. I’ll be building a game on top of it.
You can fiddle with the JSON files in the assets folder and see what happens. The good news is that you can fiddle with them without restarting the game. After you’ve fiddled, just hit the Backspace (delete on Mac) key and all the changes will be reloaded.
You can change the sky gradients, the engine power, the atmospheric density at ground and at the top of the sky, the drag on the ship, and lots more. Please give me comments here, or on Twitter @shahidkamal with the hashtag #RFTS
Thanks to everyone for your help so far!
I’ve done a weekend of work on this, but almost none of it is visible.
Internally, this is not just a toy now. I can play with the environment, background, rocket attributes, physics, engines and so on very easily. Instead of a single big file, I have classes for Ship, Engine, World, View, Particle, Emitter, RocketEmitter and so on.
This is the latest Mac build, watch out, this rocket is a lot more powerful. The gradient sky came about as a result of a nice tip from Paul Pridham (@madgarden on Twitter) – thanks Paul! I will experiment with this in later builds. The gradients are important because the object of the game will be to ensure that you reach the “sky” (the dark bit) and of course, the sky will become a narrower band as the levels progress.
Next week, there will be levels and more than one rocket to control. Eventually, you’ll be able to level up your rockets with multiple staged engines, but it will become like playing the keyboard, so later levels won’t be easy. You might need a friend when it gets up to 8 rockets on the screen with each of them having different attributes!
Download ReachForTheSky-0.02.zip for the Mac here.
Sorry I haven’t got a PC build ready. I’ve not had time to build the Cinder environment for my PC laptop yet.
This is a toy that took me a weekend and a bit to get going. I’m using the Cinder library, which for the most part keeps itself to itself, and C++, very badly abused C++ at that.
It’s only on the Mac at the moment. I’ll see if I can get it going on the PC and upload a build here if I can.
Grab the Mac build here.
Unzip it, stick it in Applications or something and remember to sort out your security settings to allow running something by a nobody. (After you’ve run it, do remember to restore your security settings, OK?)