This entry is part 3 of 3 in the series Programming Zelda Majora's Mask Time System

Ok, last time we made a clock that resembles (or at least behaves) the way the clock Nintendo made for Majoras Mask. Now we will focus in the HUD Clock that the game has.

We all know the clock HUD , it looks like this:

Now that we will code a similar HUD we need to really understand how it works. First lets consider this representation of the HUD:

Figure 1 - A first look at the HUD

We have here the two main areas of the HUD and a I've also placed two coordinate systems (I don't know how to call these areas so please bear with be):

  • The Hour Arc
  • The Minute Rhombus

A red sun/yellow moon travels the hour arc and its used to represent the hours, likewise a yellow sun travels the minute rhombus and it's used to represent the minutes.

Now it's the time you have been waiting for...math time!!!.Notice that the hour arc could be described as an Ellipse and I need you to remember some things about ellipses:

Figure 2 - You gotta love Math!

Two important values for every ellipses are the semi mayor axis (a in the figure) and the semi minor axis (b in the figure). Why are they so important? well because by using them and an angle we can draw any ellipse. How is that possible you ask? we'll use the parametric form of the ellipse in canonical position (cute name isn't it? ;))

T is an angle that takes values (in radians) from 0 to 2(pi). By using this formula we can easily draw an ellipse or move something with an elliptic trajectory . Also remember that a circle is an ellipse where a = b. That was all the math that we needed to remember in order to proceed. Don't you love math? if you don't...learn to at least to live with it...in game development math is there almost all the time :P
(more...)

This entry is part 1 of 3 in the series Programming Zelda Majora's Mask Time System

Even though my main project is my RPG System I sometimes will make some small side project to research something or just because I want to :P. Since I used to have a Zelda website I decided to start the blog with a small series about one of my favorite games of the saga: Zelda Majora's Mask.

But this isn't just about nostalgia; Majora's Mask is mostly praised by two things:

  • The 3 days time system
  • The characters and their schedules

Those elements give the player a feeling that Termina is "alive", this is something that can't just be ignored by an aspiring game developer.

In this series I will make a very raw copy of Majora's Mask time system, I wont make the event/schedule system that the game has but the time system will be designed thinking that it will be later used by such event system (which I'm planing to do...but don't hold your breath...really)

Basically we're doing the game's clock, here is a screenshot of the finished product:

Timing Majora's Mask

April 24th, 2011 | Posted by vladimirsan in Side Projects - (0 Comments)
This entry is part 2 of 3 in the series Programming Zelda Majora's Mask Time System

We all know that Termina has a strong time system...but exactly how does the system compare to our time system?. That is the question that we'll try to answer here...

The first thing will do is to measure a "Termina hour", like the cooking shows I already have prepared data:

\begin{tabular}{|c|c|}\hline Measurement Number & Seconds \\ \hline 1 & 46s \\ 2 & 45s \\ 3 & 49s \\ \hline \end{tabular}

That gives us an average of 47 seconds = 1 Termina Hour, at least in "normal" time, now I have another set of measures after playing the inverted song of time, behold:

\begin{tabular}{|c|c|}\hline Measurement Number & Minutes \\ \hline 1 & 2:16 min \\ 2 & 2:16 min \\ 3 & 2:16 min \\ \hline \end{tabular}

I'm not cheating there! I swear to Nayru!!,now, I know what you are thinking "nobody would sit in front of a TV with a watch just to see how many seconds a Termina hour have". Well I did...and I'm proud about that :D ;). Anyway 2:16 minutes = 1 slow Termina hour = 136 seconds (you just gotta love transitivity)

When you are programming a game you usually you measure the time delta between frames and you use that to update your game word, what we need next is some conversion factors so that we can easily convert between normal time values and Termina time values. Since we've already calculated some values all it takes is a little math:

\frac{47s}{1s} = \frac{3600ts}{Xts}


X = \frac{(1s)(3600st)}{47s} = 76.595744681 st

Now we know that 1 second = 76.595744681 termina seconds, and by the same method we know that 1 second = 26.470588235 slow termina seconds. That almost all we need in order to make a class that keeps our game world ticking.

(more...)