[Extension] arcade-rtc (Real Time Clock)

Hey folks!

I was inspired by @TheEarth’s recent real time clock extension to make my own! I present: riknoll/arcade-rtc

This is a browser-only extension for getting the current time. Times in this extension are represented in the traditional browser format, which is milliseconds since the epoch (January 1, 1970). All functions will automatically convert that time into the local time zone based on the settings of the player’s browser/computer.

Also, because it’s fun, this extension includes a few blocks for getting the current lunar phase! This is based on data from the US Astronomical Applications Department and should be accurate for any date between 2026 and 2050.

Nothing would please me more than people starting to make their games behave differently if it’s a full moon.

13 Likes

Me about to make an animal crossing like game where the time is equal to the real world time and certain things happen on special days. Or a game where the current real world lunar cycle effects your cults activies or something.

There is lots of potential here.

5 Likes

Now we just need the ability to see when the MakeCode streams will be cancelled. /j

2 Likes

Hm, this could work really well for a Kerbal Space Program game - accurate times, and then I would have to make a physics engine and stuff like that. Guess I’ll try, why not? Time to destroy everyone’s computers with a really super sort-of accurate rocket simulator (my computer’s doomed, too)!

1 Like

hmm this could be used alot, and because I always feel like doing so, I made a tiny project using it. One question, why does it add browser extensions? Also, can you make it possible to get the milliseconds?

BRO YOU HAD TO STEAL MY THUNDER/j I’m fine with this lol

2 Likes

how did you get local time zone HOW???

it adds the browser extension because the RTC apis it uses are defined by that extension. it’s a required dependency

and to get milliseconds:

@TheEarth sorry! i tried to give you a shout out as the inspiration.

and the local time zone is already included in the dates in the browser events extension. you can see the actual implementation of those functions here:

all of the methods on the Date type return local time by default.

1 Like

You could make a game where on certain holidays different special events can happen, so you don’t need to make a new update and write new code exactly 2 minutes before you promised it to be released. This could also be good for games that use the settings extension, so you don’t lose your progress when you update the link.

Thanks! It’s also nice knowing current_time is a number. Now it should have milliseconds and the total.

Lol all of them just use a different function
It’s like block settings all over again

1 Like

no dude Im fine with this bro it ok we both wanted to do the same thing no harsh feeling

I made my own local time zone selector lol

What a coincidence. I was thinking of a Day-Night cycle for my turn based RPG.

I had an idea for that, I would love to help

1 Like

Sure, I would really appreciate the extra help. However, I want my game to include the Kerbals so that logo with ‘Makecode’ instead of ‘Kerbal’, while very cool looking and a great name, won’t really work. And the other thing is you probably won’t be able to actually work on the code unless I’m taking a break, just because of both the amount of free time I would have in the summer. So you would probably just provide assets, but if I go on vacation or I am inactive for a while, I would ping you and (if you are available) you would be able to work on the code for that time. I will make a topic for this after I complete the gravity stuff and just a proof of concept demo, and ping you there.

1 Like