Posts Tagged FFXIV Time

FFXIV Time released

It’s taken longer than I expected but FFXIV Time is finally available for the Pebble!

FFXIV Time is a watch app that keeps track of Eorzea time which is used in Square Enix’s successful MMORPG Final Fantasy XIV: A Realm Reborn. With Heavensward close to release there’s no better time to prepare by catching up on your mining, fishing, botany or sight-seeing log.  FFXIV Time helps you keep an eye on Eorzea time, wherever you are!

Picture of FFXIV Time in the Pebble App Store

Big thanks to Angie for hand drawing the chocobo sporting a red Pebble running a copy of the app which is used in both the apps icon and the banner image.

I’d also like to thank the following kind strangers from /r/ffxiv who helped me test the app and get it working across multiple time zones: ChaoticAgenda, OutcastKnight, tecrogue and GoldenCrater.

Whilst I mull over whether to build an enhanced Pebble Time version and investigate options for alerts check out my account of why writing FFXIV Time took 1 week instead of 1 day.

Tags: , , ,

FFXIV Time: The 1 day Pebble app that took 1 week.

You would think that writing a Pebble application to track the time in Eorzea, a region of the world found in Final Fantasy XIV, would be simple. After all displaying the time is pretty much the definition of what a watch should do.

Eorzea time isn’t the same as ‘Earth’ time, it’s considerably faster but follows a set of rules which means we can recreate it outside of the game if we know how. I thought I’d be done within a few hours, after all the maths behind it is already well documented and the Pebble SDK makes it easy to write watch apps, but I wasn’t expecting to hit so many issues along the way:

1) The Pebble uses 32 bit integers.  
This means that the Pebble is susceptible to the year 2038 problem, also known as the Unix Millennium Bug.  This normally wouldn’t be an issue, after all the flash storage and the battery in the Pebble will be long dead by the time we reach 2038 but it means the standard time_t C structure can’t hold FFXIV date/time values.
Fortunately the localtime() function we need to format date/time strings can accept the int64_t data type so we can use that for holding Eorzea time values.

2) The Pebble maths precision returns incorrect values with large numbers.
Instead of the correct Eorzea time being calculated the watch generates a number that’s 44 minutes behind the actual in-game time.  Luckily this is fairly consistent so we can manually correct in code.

3) The Pebble itself has no concept of time zones.
Eorzea time is based on the number of seconds since 01/01/1970, we can get that information from the Pebble but the number returned is based on the local time.  Without knowing what time zone the user is in we can’t calculate Eorzea time at all.  Luckily the Pebble SDK now includes the capability to run some helper code on the phone itself which means we can determine the users time zone and send that back to the watch.  We can’t do this too often though as any communication with the phone is additional battery drain and we don’t want to tie the app to working only when the phone is around.

4) The time on the watch seems to drift over extended periods of time.
This happens more noticibly on my 1st generation Pebble and less so on my Pebble Steel.  Normally this wouldn’t matter too much, if your watch ticks over to 5pm 10 seconds faster/slower than your friends the core functionality is still good enough.
Unfortunately drift of even a few seconds can have a noticeable impact on calculating Eorzea time.  We can use a similar solution to the one implemented to fix problem 3 to figure out if there is a difference between the time on the phone and that of the watch and compensate accordingly.

5) Communication with the phone isn’t reliable.  
Problems 3 & 4 were solved by retrieving information from the phone.  If we can’t communicate with the phone on first launch to get time zone information we can’t calculate Eorzea time and the app is effectively useless.  During testing I found that every so often phone communication failed at app launch and with the next phone communication scheduled for an hour later (to save battery) the only way for the user to fix it was to restart the app until the communication worked.  I like things that ‘just work’ so the the (heavy handed) fix I’ve implemented is to check if we have cached time zone information and if not, blast the phone with up to 30 communication calls to ensure we get something back. The feedback has been that after this routine was implemented the time self heals within seconds of the app launching without users having to do anything at all.

 

It’s been quite a journey creating FFXIV Time (soon to be available on the Pebble Marketplace), several of the problems took longer to identify and resolve than I had initially thought the entire application would take me to write.  In contrast, the proof of concept I wrote for Apple’s iWatch took only a few hours.  I’m still fond of the Pebble, particularly as the iWatch doesn’t run native apps at the moment, but the difference in the time required to write the core functionality of effectively the same application is staggering.

Next challenge: Update FFXIV Time to support the colour features of the Pebble Time.  Though I think I might wait for the SDK to become stable before embarking on that journey…

Tags: , , ,