How do I make REAL TIME EVENTS?

Get help using Construct 2

Post » Wed Nov 05, 2014 12:18 am

Hello everyone! :D time withouth posting here!

i got a little question, is there a way to make a game to use real time? for example:

i build a house, but it took 30 minutes to build.

its there a way to turn off my phone, wait the 30 minutes and get back to play and see the house already builded??

thanks!
Image

Image
B
38
S
14
G
7
Posts: 408
Reputation: 8,338

Post » Wed Nov 05, 2014 12:39 am

Nothing will happen in your app when the phone is off. You can store the current clock time on exit (e.g. webstorage), then compare it with the time when it's restarted to see how much time has passed in the real world, and then do what you want.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Nov 05, 2014 2:10 am

Clash of Clans way (?)

Well, you could do what @codah told you to, but that would be insecure, as values would be saved (I think) on your phone and that would make it easy for somebody with good knowledge of programming, to change those values at will, and thus cheat

What games like Clash of Clans do is keep up a server on another PC, that the device calls via the internet, to give it all the information about your houses and how much time they need to finish up building

It is certainly possible in C2 via maybe Websockets, but that's a long story ... You might want to check out the manual on multiplayer servers and such
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Wed Nov 05, 2014 2:28 am

I didn't see any mention of multiplayer or security :shock: But yeah that's a whole other thing.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Nov 05, 2014 2:31 am

@codah

Oh don't worry, it's all in there under the hood, just waiting to jump scare you with 500+ additionnal lines of code
Trust me, i've been there and I coded that :D
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,461

Post » Wed Nov 05, 2014 4:09 am

Thanks a lot for the answers!

i will start to read more about how to use websockets and multiplayer!

cheers!
Image

Image
B
38
S
14
G
7
Posts: 408
Reputation: 8,338


Return to How do I....?

Who is online

Users browsing this forum: YoHoho and 7 guests