Idea using real calendar to modify the game

A few months ago I met a user named glosgreen2 who created a script which told the game the current date in real life. From this (and with his help) I modified it to edit the game based on which month it currently is.
One can have things like snow during December, pumpkins in October, birds chirping during July, ect… without even modifying the game! Doing this can keep a game from becoming stale because it would be ever changing.

I was wondering if anyone else has thought of this idea, and if so if they have implemented this idea?
I have been building a map for quite some time that uses this concept and I’d love to see other games do this too!

2 Likes

I tried to do something like this when I first started coding. I only got seasons working and then I stopped working on it. Unfortunately I don’t have the place anymore.

1 Like

Hmmm. You probably use tick(), and knowing that was started on January 1st of some year, you divide it by some number to get the current month? I’m too lazy to illustrate what I mean right now. :stuck_out_tongue:

Not a game, but I made a dominus back in 2011 whose texture changes based on the current season.

[quote] Not a game, but I made a dominus back in 2011 whose texture changes based on the current season.

http://www.roblox.com/Dominus-Quattuor-item?id=49339156 [/quote]

That model is a LIAR. Still got some snow here. Hahaha.

I was planning on adding an event system in one of my games. Like every day at 5:00 pm to 6:00 pm players can fight a super strong boss. Or on Wednesday, players can do a GUI puzzle to claim rewards. It’d also be cool to set the TimeOfDay based on the time as well (if each player had their own Lighting, it’d be fun to do it in local time as well).

Haven’t even tried implementing it however. I think there’s stuff like leap seconds and stuff that has to be accounted for. At first glance, this seems like a decent resource to look at: stackoverflow question

Sounds very cool, I’m curious if it’d effect a server if it was 12:00 am est and people who were pacific joined the server and it was say April 1st in Est but still march 31st in pacific if that would effect anything, I know months are way different from seasons but I’m just trying to show a point in this.

I plan on putting seasons in my game which would recolor the entire game

Here is some code that SIrGelatina made that gets the date excellently from tick(). It returns a table with the time info in it.

function date()
	local seconds = math.floor( tick() )
	local minutes = math.floor( seconds / 60 )
	local seconds_remaing = seconds - ( minutes * 60 )
	local hours = math.floor( minutes / 60 )
	local minutes_remaing = minutes - ( hours * 60 )
	local days = math.floor( hours / 24 )
	local hours_remaing = hours - ( days * 24 )
	days = ( days + 365 + 366 )
	local L_days = math.floor( days / ( 4*365 + 1 ) )
	local Q_days =  math.fmod( days, ( 4 * 365 ) + 1 )
	if Q_days >= 31 + 29 then
		L_days = L_days + 1
	end
	local years = math.floor( ( days - L_days ) / 365 )
	local J_days = days - ( years * 365 ) - L_days
	if Q_days <= 365 and Q_days >= 60 then
		J_days = J_days + 1
	end
	local year = years + 1968										-- current year
	local month = 13												-- current month
	local maxdays = 366
	local month_days = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365}
	while J_days < maxdays do
		month = month - 1
		maxdays = month_days[month]
		if month > 2 and math.fmod(year, 4) == 0 then
			maxdays = maxdays + 1
		end
	end
	local day = J_days - maxdays + 1
	return {second = seconds_remaing, minute = minutes_remaing, hour = hours_remaing, day = day, month = month, year = year}
end
1 Like

I also have a piece of code which can do this, but it would be better if ROBLOX actually enabled the function.

local date = os.date('*t')
for _, v in pairs(date) do
print(_, v)
end

I don’t see any problems with this sort of code, so I don’t see why os.date isn’t allowed for us to use.
I should make a suggestion on that, actually. If you see a thread about it on the Feature Requests forum, you know where it came from :stuck_out_tongue:

I’m pretty sure we can use os.date on the client, but not server.

Did you test that? You don’t seem very sure. Because you can’t. I tested this.

Some guys from the IRC said you could. Holds up hands I’m innocent!

I remember when you first sent this to me. I initially thought it made no sense, but it’s an interesting idea for role playing games with big maps…