x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

keep contdown timer running even if the game was close

Hello guys,

Before anything else, I would like to apologize for my bad english, I'm from Brazil.

I'm making a game for Mobile, and would like to make a countdown timer. Used to upgrade a weapon for example. (Okay, easy)

The problem is, my game will be offline and I wish to keep this countdown timer running even if the game was close.

is there any easy way to do this? If there was a way to get the schedule of the operating system. this has help me a lot. (although this could be easily cheated)

Product Version: Not Selected
Tags:
more ▼

asked Jul 30 '14 at 12:53 AM in Blueprint Scripting

avatar image

Edney Reis
56 3 5 10

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

Get Accurate Real Time solve my problem !

This function returns the current time of the OS in seconds ! so i can compare the time when the player left the game with the time he joined.

more ▼

answered Jul 30 '14 at 08:10 PM

avatar image

Edney Reis
56 3 5 10

avatar image drUniversalis Aug 14 '14 at 08:51 AM

Be aware cheating will be as easy as setting the time then though ;)

avatar image jwatte Aug 14 '14 at 06:05 PM

Presumably, anything important for gameplay is actually done server-side. The timer should only be set when the player requests it AND the server determines that preconditions are met (pay resources, etc.) Also, while the client-side GUI can show "X minutes left," the actual "create the upgraded unit" effect should only happen on the server, or at least should only happen after the server has agreed that it's correct and updated the state according to the enforced game rules. Someone setting the "time when done" value locally will then see an inaccurate "X minutes left" display, but should not be able to cheat the server.

(comments are locked)
10|2000 characters needed characters left

Yes: Instead of storing "there's 20 seconds left," store "this upgrade will be available at time XX:XX GMT."

Then, when you display how much time is left, subtract from the target time, to see how much is left. If it's after that time in GMT, then the upgrade is available.

This needs access to a real clock that's set correctly, of course. Typically, this comes from servers, but if it's single player, you can use the normal PC clock. You might want to double-check that the clock doesn't jump around too much -- daylight savings time, leap seconds, CMOS batter replacement, and a bunch of other things may do weird things to time.

more ▼

answered Jul 30 '14 at 02:56 AM

avatar image

jwatte
1.3k 48 41 88

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question