The Gregorian Calendar can now be modelled with Time Units!

Sojour uses Time Units to model any calendar from first principles.

Here are a selection of calendars created using these Time Units (Click the images to see full sized versions – you can do this for all images in this post):

A Gloranthan Calendar
A D&D Calendar
A Third Imperium Calendar

As you can see, the calendar system is pretty flexible!

However, there used to be a limitation with the system. It couldn’t support calendars that roll their days relative to their months. For example in the Western Gregorian calendar, the 1st of February will start on a different day of the week dependent on the year.

Given that Sojour couldn’t model this, it used to cheat and provided the user with the Windows Operating System’s Gregorian Calendar.

But not any more! Sojour can now model rolling calendars too! 😎

I thought the best way to test the new rolling calendars functionality was to build the Western Gregorian Calendar from first principles using only Time Units and Rolling Entities. If I could get Sojour to model this relatively complex calendar, it should be able to model any calendar!

A few months back I had thought I was nearly there. But detailed testing showed that my calendar always seemed to be a day out here or there. Tracking down these issues took a lot of time. But they are now all fixed!

One problem (of many) were the leap years. I had thought they were simple.

Every four years is a leap year, right?

Wrong.

Turns out there are additional rules…

If the year is divisible by 100, then it must also be divisible by 400 to qualify! So 1700 and 1800 would not be leap years, but 1600 would be.

To allow the modelling of this and other rules, I added the concept of leap year rules, which consist of a triggering condition and any number of rules associated with that trigger:

We now have leap year rules!

For the moment the system only supports divisor triggers and rules, but it is designed to support any mathematical expression should the need arise.

To model the Gregorian calendar Sojour only needed one trigger and one rule. The trigger is activated when a year is divisible by 100. Once triggered, its associated rule – the year must be divisible by 400 – is then invoked.

I suspect that most gamers will not use this functionality as RPG calendars tend to be relatively simple affairs . However, these rules are incorporated to allow the user to be able to create complex calendars such as the Gregorian one.

Why bother trying to model rolling calendars?

Rolling calendars, or in Sojour’s parlance Rolling Entities, allow for a lot more flexibility and will allow users to create their own custom rolling calendars such as the Golarian one used in the Pathfinder RPG. Without this ability, such calendars would be impossible to create.

How are the rolling days of a month created and modelled in Sojour for the Gregorian calendar?

You need to create a Rolling Entity Group, call it days of the week, add the seven days and then associate that Rolling Entity Group with a Time Unit level:

Rolling Entities in Action!

The screenshot above shows our days of the week Rolling Entity Group. We have also ticked the ‘Override Time Unit?’ option so that these Rolling Entities replace the names of their target Time Units.

If you examine the screen shot closely, you can also see that these Rolling Entities target the third level of Time Units, which in this calendar’s case equate to days (as seen in the tree view on the left).

The ‘Start Year’ and ‘Start Rolling Entity’ fields are simply used to determine how the Rolling Entity Group is synchronised with the main calendar. In this case we are saying that for the start of the year 2024, its first day of the week will be a Monday. Sojour will then automatically calculate all the other days of the week!

Rolling Entity Groups and Rolling Entities are extremely powerful. They aren’t just limited to modelling days of the week. A calendar could have as many of these as required and each of them could be applied in a myriad of different ways.

For example, in the Gregorian Calendar, we could add an additional Rolling Entity Group to model the phases of the moon. These moon phases would then show up on the relevant days!

For the rest of this post I will show you Sojour’s Gregorian calendar from first principles using Time Units and Rolling Entities, along with proof that Sojour’s calculations are correct!

First up, an easy one, today’s date:

So far so good…

Lets try the earliest year that Windows 11 allows its calendar to go – 1924:

Still good!

What about a long way in the future? Say the Year 4765?

Alas, the Windows 11 calendar won’t go that far in the future, so we will have to check our calendar against what the Internet says:

Sojour is still delivering the goods!

What about the crazy leap year rules? Will Sojour show 1600 as a leap year, but 1700 and 1800 as non leap years?

Leap Year
Non-Leap Year
Non-Leap Year

Yes. Yes it does!

As an aside, any Time Unit or group of Time Units can be leap year enabled to allow you to create some truly unique leap years for your calendars. These are already used to great effect in the D&D calendar.

Those leap year screen shots look impressive, but how do I know that the actual days of the week shown are correct? Let’s pick 1700 at random. Here is what the internet says:

All good here too!

How about a crazy early year? Say the year 15 AD?

Sojour is still rocking!

Can we go earlier? Oh yes! But alas I haven’t found an online resource to verify the days of the week for such early dates. However, I am satisfied that the internal mathematics are calculating the days of the week accurately.

Here is 426bc:

As noted above, there is no reliable way to confirm that the calculations for this date are correct, but given that Sojour is using the same calculations as used in the previous date examples, I have no reason to doubt its accuracy.

This post might not seem impressive until you consider that this Gregorian calendar is not using any operating system components for its calculations. Instead, it is using Sojour’s Time Units and Rolling Entities from first principles.

These Time Units and Rolling Entities can be used to create any calendar that you can imagine. I’m pretty certain that there is nothing like this in the software market right now and I’m only just getting started!

Why the blog post?

Firstly I wanted to show you folks that I’m still hard at work!

Secondly, I wanted to celebrate getting over the big development hump – the hard bit – the actual calculations themselves. Everything else should theoretically be a lot simpler to implement (famous last words!).

In terms of the development effort so far, I’m up to 25 code commits and 69 hours and 35 minutes of coding and testing!

Quite a lot of time has been sunk into this. But I think it will be worthwhile as it will provide Sojour with a world class leading calendar model.

There is still a long way to go as there is a lot more that I want to add to version two of the calendars system.

As with all other enhancements, this calendars update will be free of charge for all existing Sojour customers!

Thank you for your patience and have fun!

RobP

Calendar Rolling Dates – Update

It’s been a while since I have posted. This is due in part to not being able to get enough time on Sojour and also due to the size of the current task in-hand. That said, progress has been made!

I guess the first question for me to answer is ‘What are rolling dates?’

I feel that the easiest way of answering this question is to firstly explain what non-rolling dates are.

Calendars that have non-rolling dates are characterised by each month starting on the same day of the week:

A Gloranthan Calendar – with Non-Rolling Dates! (click for larger image)

The above example shows two different seasons from the Runequest Gloranthan calendar. Each season starts on a very specific day – Freezeday. This would still apply even if I was to go to a different year: Sea Season’s first day will always be Freezeday.

It’s this lack of relative motion between the days and their months that make this Gloranthan calendar a non-rolling calendar (otherwise known as a fixed calendar).

It turns out that many role playing game systems use non-rolling calendars as they are the simplest to use in terms of gameplay. Examples of games using non-rolling calendars are Runequest, Dungeons & Dragons and Traveller.

In direct contrast, the Gregorian calendar, as used in the West on Earth has months that do not start on the same day. This is the case even when looking at the same month over many years.

For example, April 2023 starts on Saturday, whilst April 2024 starts on a Monday.

These variations in the start day occur because the day of the week, Sunday to Saturday, roll independently of the month that they are in. They always form a full seven day week even when crossing monthly boundaries.

It’s this that makes the Gregorian calendar a rolling calendar.

Now, it might come as a shock to most people, but Sojour has never natively supported rolling calendars!

Some of you will be reading the above paragraph in disbelief and will be pointing to Sojour’s built in Gregorian calendar as evidence to the contrary.

However, Sojour’s Gregorian calendar is a special case. Sojour does not use its calendar system’s time-units to model the Gregorian calendar. Instead, it uses the default Gregorian calendar provided by the operating system. It then seamlessly integrates that calendar with Sojour’s user interfaces to provide the illusion of rolling date support.

The big give away is that unlike other calendars, you cannot edit it:

The Gregorian Calendar is a special case – it’s why you can’t edit it!

Much of the recent work has been centred around getting Sojour’s time-unit based system to be able to model rolling calendars like the Gregorian calendar. Enabling this will allow users to literally invent any calendar that they can imagine!

Today is a special day in that I finally cracked it! :

A Gregorian Calendar, but not as you know it! This time it is constructed and modelled with Sojour’s time-units! (Click for a bigger image!)

The above screenshot doesn’t look too significant, however it represents a huge step-up in Sojour’s calendar modelling capability. That’s because it has managed to model a rolling calendar – the Gregorian Calendar – using its own built-in editor and time-units!

The system even takes leap years into account:

A leap year!
A non leap year!

As an aside, Sojour can model leap days, weeks, months or whatever else you can imagine. For example you could easily invent a calendar that has 4 leap days that occur every 6 years 🙂

Coding the month view to support rolling calendar dates was a right royal pain. The first issue is that the 1st can occur on any day! So the 1st will invariably not start in the first cell of the month view and will tend to move around.

In addition, some months will have more, or less rows (weeks) than other months and all of this has to be calculated:

For example April has six rows of days, whereas most other months will tend to have five. The code has to be able to account for this!

Sojour’s rolling dates are really powerful. In the above Gregorian calendar it only has one set of rolling entities to drive those dates and that is a rolling entity group called ‘Days of the week’. However, I could quite easily go on to add many more rolling entity groups and map those to different time-unit levels.

In fact, you can even assign multiple rolling entities to the same level! For example, with the Gregorian calendar I could create another set of rolling entities called ‘Moon Phases’ and then assign those to the day level. The moon phases will then roll around independently of anything else as the days go by!

Sojour even allows you to associate images with your rolling entities and these will end up being visible on the calendar’s month view. In the above example we would see the different phases of the moon on each day.

The Gregorian calendar I created here is simply a proof of concept. I figured that if Sojour’s time-units could model the Gregorian calendar successfully, then in theory a user could create any calendar that they can imagine!

Whilst I have made a lot of progress, there is still a huge amount of work left and I suspect I will be on this feature for quite a while yet.

Hang on in there and have patience! Once released, Sojour will have one of the most powerful and flexible calendar systems ever released in a VTT!

Have Fun!

RobP

Sojour v1.2.1.0 has been released (Custom calendar hotfix)

This is a hotfix for custom calendars. Current calendars will automatically be upgraded and customers shouldn’t see any change of functionality.

This fix separates the concept of TimeUnit number and day of at n level.

Warning! The next few paragraphs are highly technical and only really applicable to customers that are using Sojour to create custom calendars!

Previously, the n.number command did not return the TimeUnit number at level n. Instead, it used to return the day of number at that time unit level.

This is a little misleading to say the least.

To fix this all n.number commands have been renamed to n.dayof and n.numberth commands have been renamed to n.dayofth.

These names better represent what those commands are doing.

There is no need for you to change your existing custom calendars! Sojour’s auto-update system will do this for you automatically! 🙂

The n.number command has then been re-introduced, except that this time it actually reports the number of the selected TimeUnit at the chosen level.

I know this is going to sound like absolute gobbledegook to most people! The intent will be to put out a new custom calendar tutorial video that will make this a lot more clear.

Have Fun!

RobP