New Project: Clanning
Just for a change of focus and, admittedly, for fun, I started a new (side) project recently. It's an application for an online game I play.
Some context first. So I've been playing this game for the past 15 years now. It's a multiplayer online role-playing game. Note that I didn't use the term massively that is usually associated with these games (as in mmorpg). This game started out in 2000 or maybe a little prior to that. Personally I've been playing since 2001.
At that time there were a lot more people playing (around 200 at the same time at peak time), and it was on a subscription basis as most of these are. A few years later the population dwindled and it went free (once you buy a character that is) but the servers are kept running and the game has been managed by volunteers ever since. Now there is usually 20-40 people playing at peak time.
It has an old style (circa 2000), cartoonish 2D graphics, is low resolution, and it's not for everyone. But the gameplay is incredible and the interface is one of the best I've seen for interacting in this type of game. And the community is just wonderful. If you're curious you should check it out, it's called Clan Lord. And if you ever want to try it out, give me a shout and I'll show you around (you can try it out without buying a character).
One of the things that I also like about this game is that it as its own macro language. It's built to ease some of the social interaction and skill use, but it's very powerful and flexible and I've built a huge amount of macros over the years to do a number of things. I think I have around 10k lines of code in my various macros. It kept me coding during those years I spent doing something else!
One of the things that pushes that scripting/macro language a bit is mathematics, and I've been frustrated over the years by those limitations in a category of macros I use to determine various astronomical data for the game. The game time is roughly 4 times as fast than real life [RL], and the number of days in a year is different than in RL too. In fact there are a whole lot that is different, and those astronomical events do have an impact on the game. For example, it's more dangerous at night than during the day in most areas, so sunrise and sunset matter. Some areas change depending on the rising zodiac (which constellation rises with the sun that day), for example a path through a maze might depend on the rising zodiac. And some event only happens on the day of the full moon, or some areas are only accessible at low tide. Those are just a few examples.
One other limit of the macro language is that it doesn't give you access to the current time. Up until recently I used the text logs time stamps to get that information and it's a bit unreliable. That and the restriction on mathematics have made this series of macros hard to maintain as they'd drift over time so I needed to constantly adjust them. They also didn't take into account daylight saving time, or leap year for that matter!
Add to this my recent change from TextExpender to Typinator, which I was happy to find supports triggering of Swift scripts. This has triggered (pun intended) me to port my astronomical clan lord macros to Swift.
So I started out in Playgrounds, which is quite useful since you see the results immediately (but it's also still buggy), and then it evolved into its own iPhone app. I'm now incorporating a list of currently online players that I get from a server in XML format.
It's been very interesting to work on that. I learned a lot on manipulating dates and calendars and parsing XML data in the process. I plan to add notifications to it (for when there is a major event in the game, like an invasion of town, or just when a friend logs on). That's something else that will be new to me and it's a great excuse to learn how to implement that.