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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Accessing real-world time from BP


Is there a way to access a certain web directory containing the GMT time to download the time and date to UE? I am making a single-player game in which the gameplay would also be affected when not playing the actual game (like OGame and others), but since it is single-player I do not need a server to compute everything while the game is closed. Instead, the calculations would be performed upon the subsequent game run and based on the time difference. However, a player could easily hack the game mechanics by changing the time and date on their PC if I was to use the system time as a reference.

This is why I would need a more reliable source of the real-world time than the system one, hence the question about the web directory.

Any ideas?

Product Version: UE 4.8
more ▼

asked Jul 12 '15 at 12:31 PM in Blueprint Scripting

avatar image

51 16 21 25

avatar image eXi Jul 12 '15 at 02:26 PM

Uff, in Blueprints? I don't think that is possible. If you don't have a server to sync the time, you can only use the System Time. To prevent cheating, you always need a server. But even this can be cheated, because you will never actually check what time the player feeds the game. He could put something between the server and the game and fake the time.

So i would not really think about the cheaters. If it is a single player game, just accept that people like to cheat :X

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You would need at HTTP sever that you would provide with SSL encoded time, in which client would validate if data comes from right sever (since public key can only decode message from private key which only server has, so you sure it's message from right server), problem is even that is not fully secure (user could potentially replace public key to fit specific private key, even if it was hard coded in machine code), but it's harder to do for more casual user. Also you would need to use C++ for that as UE4 has cryptography functions wrapped in APIs but are not accessible via blueprint.

Much more secure solution is to run game instance on server and let server manage the time, client hacking would not work here as you would use server clock to do any computations

more ▼

answered Jul 12 '15 at 06:41 PM

avatar image

36.6k 931 169 1111

avatar image DarkLiquidus Jul 12 '15 at 09:54 PM

Ok, but is there any solution to do that without owning a server? I mean, is there no way to access another website's html code (like THIS) and retrieve the specified information from it - in this case the datetime?

avatar image Shadowriver Jul 13 '15 at 03:16 AM

If they give access to any API then yes, if they use JSON then you could use VaRest to access it in blueprints. Problem is some APIs are made for server only use, they give you key which has specific limit of requests, i don't know search, anything on HTTP that will simply output just time will be good, but you need to be sure that they let you use it in your game (check licence and rules).

There also NTP servers, but UE4 does not support them (Since they mainly used only by OS and other devices to sync time), you would need to code your own support in C++.

avatar image DarkLiquidus Jul 13 '15 at 11:37 AM

Ok. I just thought, maybe I could launch an external executable file and retrieve the html without JSON? The datetime would be then saved to a file and read by UE. That would make it slightly more flexible, as long as UE allows launching external applications.

EDIT: Or I could make a custom .exe file which would firstly run the programme saving the datetime and secondly launching the actual UE game.

avatar image Shadowriver Jul 13 '15 at 04:32 PM

If you know C++ then make it inside UE4, C++ in UE4 is normal C++ you can do anything that C++ let you, you practicly extending engine code, If you gonna make external exe it will be even more hackable. UE4 APIs have su[pport for low level Sockets and HTTP as well as retriving data JSON and XML (i think) you get from HTTP, so you can use UE4 for that

avatar image DarkLiquidus Jul 13 '15 at 04:37 PM

Ok, thanks for the support.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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