How do I work with Time in Construct

0 favourites
  • 5 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Posting here because I do need a solution.

    I got a racing type game that needs to run off milliseconds.

    Floating point stuff is giving me a headache (0.1 = 0.099etc).

    Can't use the, every x seconds because every 0.01 seconds doesn't play nice.

    [quote:4brktgh9]Time leaderboards present scores in hours / minutes / seconds / hundredths of a second format. You must submit scores as milliseconds, so 66032 would be interpreted as 1:06.03.

    Quote from Google Play Games Services for Publishing Android Games.

    If anyone has any experience with c2 to google play, handling hundredths of seconds, I'd love to hear about it.

    Also working on another game where I want to accumulate revenue over time regardless of whether or not the app is running.

    Correct me if I'm wrong but Construct 2 doesn't have native support for 'system time' ?

    I was just going to search for a unix time addon but got cold feet wondering if it would work on the million different types of android phone. I want to be able to work with hundredths of seconds and days all in the same equation. Elapsed time.

    e.g. this thingo will give revenue 3 times per second, and this thingo will give revenue about once every 3 hours and if the app is closed, it will check on startup, using last stored times, how much has been earned since last revenue gained and calculate/display the progress towards next revenue for each thingo.

  • The expression int(time * 1000) will give you the game time in milliseconds, rounded off. You can get hundredths of a second by dividing that by 10, or changing the expression to multiply time by 100.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • changed to wallclocktime insted over add to count ever x seconds, works well.

    int(Scores.At(Scores.CurX)/60000) & "." & int(((Scores.At(Scores.CurX)/10) - ((int((Scores.At(Scores.CurX)/10)/6000))*6000))/100) & "." & (Scores.At(Scores.CurX)/10) - ((int(Scores.At(Scores.CurX)/1000))*100)

    Set | Scores to | (int(Text_Timer_Min.Text)*60000) + (int(Text_Timer_Sec.Text)*1000) + (int(Text_Timer_Mil.Text)*10)

    Set | Play_Time to | wallclocktime - Menu_Time

    Still need a reliable unix addon that works in android for progress over time games

  • You will never have a reliable unix addon that works in android since all JavaScript time plugins rely on local system time which can be tinkered with/manipulated freely.

    C2 doesn't even really use time, per se, anyway, it operates purely on the concept of frames and the time component comes in frames per second. C2 is designed to run at 60 frames per second, and has a 'dt' parameter to allow you to get frame-rate independent time measurement relative to the 0th time from app launch based exclusively on local system time clocks. Like: https://www.scirra.com/tutorials/67/del ... dependence

    If you want un-manipulable time, then you have to use a server.

  • well I suppose that's the trade off isn't it... If you want "real time" in C2 games that can run offline then your subject to cheating. Otherwise the game must be 100% online, as you said.

    could always have some anti cheat e.g. "current time is more then a month greater then previous time = reset game". But no I don't actually think that would help.

    As for unix plugins or just plugins in general, I'm having a hard time getting past the Intel XDK's create app button. Keeps telling me my plugins are wrong and I can't for the life of me figure out why... all I did was update the xdk, app hasn't changed. So based on those issues.. I feel even less confident to proceed with the "real time" app.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)