Date, time, timestamps (mobile) [Game Maker Studio 2 | Advanced]

preview_player
Показать описание
This advanced video tutorial shows you how to utalize the current time, dates or even use time stamps for saving in mobile devices in GameMaker.

Image this, you want to have create a mobile game where you time game your content. The problem is once you close you application you cannot count the time passed directly. How to fix this? With saving in an .ini file the old time stamp/date and read it out (plus compare) once you open the applicaion/game again.

There are different things you can do with the internal time (time_current) or time stamps. First of all you can read out from your local machine (pc/mobile) the time there like minutes, hours up to years if you like, change the time zone or create your own time (stamps) or read out how many days have passed in this year/month/week etc. . That is in most cases not very useful information but you can use those metrics to store them in a time stamp which you create once you close the application. Next time you open the game/application you can compare the old time stored with the current one and even calculate the difference which the most common use case for mobile games. That's it!

// for clarification
current_time: read out internal time passed in application
current_day/current_hour etc. : local values from pc/mobile
date_get_hour: read out also hour but with a argument time
date_current_datetime: the timestamp of the local machine's current time
date_datetime_String: read out a full readable string of the timestamp
date_hour_span: Calculate the difference (here in hours) between two timestamps

// Video on saving with .ini:

Official manual on date and time:

// images from the thumbnail:

👑 Support me and get fresh game art and game maker projects every month:

Follow me on:

----------------------------------------------------------------------------------------
0:00 What we will do
1:01 Subscribe
1:12 Use case for storing time
2:32 General uses
6:45 Practical part for mobiles
Рекомендации по теме
Комментарии
Автор

I've used these functions to autogen seeds for randomness based on the date. Works great and allows for things like daily runs in a rogue-like!

BradleyChick
Автор

How can I read the current hour but from internet? So the players wont cheat by changing the time in their phones. Thank you

Leandro-xkco
Автор

could you show how the progress of the cookie simulator prices were made?

carlos-gens