brandontreb.com Tips And Resources For Software Consultants

My Number One Feature Request For iOS 6

Fix the Snooze button! I have no idea how this UI component got to Apple’s review team and they were like ”Yep, that looks beautiful! Ship it!”. If Apple changes the snooze button and slaps a 6 on iOS, I will be happy. If not, more rants to follow. Stay tuned….

If There Was Ever A Time To Submit A Show HN Article, It’s Right Now

Earlier today a post titled ”I Try to Up Vote Every ‘Show HN’ Post and You Should Too” made it to the top of HN.  It basically talked about people posting “Show HN” posts are putting themselves out there and the least we can do is give them an up vote.  Well, people are listening and as of this posting, there are currently 15 Show HN posts in the top 30.  That’s incredible.

So, if you have recently created something cool.  Head over to HN’s submission page and add your link making sure to add “Show HN” in the title.  You might get some great traffic/feedback out of it.

Lua Scripting The UI For Pocket MUD Pro

I have just updated my MUD client [Pocket MUD Pro] to be a universal library. It was surprisingly easy to add the iPad support as most of the application was comprised of UITableViews.

The main “MUD” view was the most challenging part as it contains a couple UIWebViews, UIButons, and a UITextField. However, I chose to do something I feel is pretty cool.

Scripting The UI With Lua

If I haven’t said it enough, I love lua. Especially in the context of scripting within other applications. Pocket MUD Pro already has complete lua support in triggers in aliases, so I figured I might as well apply that same logic to the UI.

Pocket MUD Pro has 3 core sections for the UI not counting the text input field. The main view (UIWebview), the prompt view (UIWebview), and the button bar (custom UIView).

One of the core challenges I faced on the iPhone, was resizing/reorienting all of these views on orientation change as well as when the keyboard was visible and when it wasn’t. To be honest, I spent most of my cycles getting this part right. On the iPad, I decided to things a little differently which improved the speed of my development overall and paved the way for future updates that will allow user-scripted UIs.

The UI Script

I want to start by showing you the lua code that is used to script the UI by default.

–MUD 
mudFrame = Frame:new("mud_frame") 
mudFrame.type = FrameTypeMUD
mudFrame.portraitFrame = {0,0,768,931}
mudFrame.portraitFrameKeyboard = {0,0,768,667}
mudFrame.landscapeFrame = {0,0,1024,675}
mudFrame.landscapeFrameKeyboard = {0,0,1024,323}
createFrame(mudFrame)

What’s happening here is, I have created a Frame class that has some properties (type, name, etc…) and injected it into the global lua space for use inside of the UIScripts. Then when the interface gets drawn, I reference the UI script for each of the MUD servers and use it to render the interface.

One interesting thing here is, I set the frames for each of the possible layout scenarios. Portrait, Landscape, with and without the keyboard. That way, when the keyboard hides/dismisses or the user rotates the device, I just reference the this script again and re-render the frame accordingly. This could have been achieved with auto-resizing masks however, it gets much more complex and things get tricky when you want to have a dynamic number of windows.

I follow this exact pattern for the button frames and the prompt frames. As you might have guessed, in a future release, I will open this script area up to MUDders and give the user the ability to script the interface however they would like. Some examples might be:

  • Dedicated map window
  • Dedicated chat window
  • Customized movement buttons
  • Customized backgrounds/borders/themes
  • Custom health/status/mana

Given this powerful UI Scripting style, a user will be able to create complex interfaces such as the one below from inside the app:

I still have a ways to go with exposing various functionalities via my custom lua bridge. But things seem to be moving along quite smoothly.

If you want to learn how I was able to bridge lua into my application, consider checking out my talk on lua scripting at 360iDev 2012 later this year!

Happy Coding!

Jailbreak iOS 5.1.1 With Absinthe 2.0 + More Watch Dev Coming

The GreenPois0n team has just announced Absinthe 2.0 allowing users of all iDevices (except Apple TV 3) to jailbreak iOS 5.1.1. This is especially good news for me as I can now continue development on my jailbroken app for the inPulse watch, iOS notifier

[Link URL]

Join Me At 360iDev 2012

I mentioned this on Twitter last week, so I might as well post it here to make it more official. My talk Making Your Games More Dynamic With Lua Scripting was accepted for 360iDev 2012! This will be my first official speaking engagement and I could not be more excited/nervous.

The Talk

I have had a huge interest in lua for some time now, especially as it applies to scripting games. In my last project, Pocket MUD Pro, I even embedded lua 5.1 and created my own bridge in order to allow players to fully script the gameplay. This got me very excited for the future as it was so easy to get lua up and running.

My talk will cover the basics of setting lua up in your own iOS projects. I will be using a simple tile based RPG (written in Cocos2D) for the demo and will demonstrate how you might use lua to script the behaviors of the NPCs as well as dynamically add new ones to the game. This opens up a whole world of possibility as you can now ship code over the wire and modify your game content without ever submitting an update to Apple.

It appears my talk has some pretty steep competition in its timeslot. There are two other incredible talks going on at the same time, so I’m starting to campaign for it now :)

Please comment on this post if you plan on attending 360iDev. I would love to connect with you.

[360 iDev Schedule]