[Paid]Someone to integrate time based progression

Looking to build a team or have a job to offer?

Post » Thu Dec 05, 2013 3:08 pm

I have a simple game I'm making for a client. The game needs to run while the app is not open or at least appear too. It is an android app. There is a plant growing that has to grow while the app is not running. I'm thinking of checking the time online using the web-socket, browser, or AJAX object. Then use that time to calculate how much time has elapsed since the last time and affect object accordingly. I need someone to show me how to do this and host whatever the method for checking time is used. I've got $20 for anyone who can do this.

Looks like we've got it working now with web-sockets.Draspur2013-12-05 18:23:44
B
71
S
24
G
11
Posts: 452
Reputation: 12,343

Post » Thu Dec 05, 2013 4:19 pm


-- use this to get the system time
set variable = Browser.ExecJS("var d = new Date(); d.getTime();")


-- use this to set a target time
set finish_time = Browser.ExecJS("var d = new Date(); d.getTime();") + ( time_in_milliseconds )


-- use this to get the time difference
set var difference = finish_time - Browser.ExecJS("var d = new Date(); d.getTime();")

-- compare time. you can also check if difference is -/+ value
If (browser_time > finish_time) then tree is finished growing.


This will let you use the local clock rather than calling than making an internet connection
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Thu Dec 05, 2013 4:53 pm

Well I didn't know this! Very cool!
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 963
Reputation: 10,721

Post » Thu Dec 05, 2013 5:37 pm

Oh I forgot if you need to know a percentage of growth.

then also add the
var start_time = Browser.ExecJS("time stuff")

and do an easy
unlearp(start_time, target_time, browser.execjs("gettime") )

this will give a 0.0 to 1.0 value to use as a percetange. unlerp() * 100.
you can then use the % to compare the period of growth of your tree.


jayderyu2013-12-05 17:38:59
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Thu Dec 05, 2013 6:28 pm

@jayderyu

After I posted this we got our web-socket server working with date. I couldn't use system time as that would be manipulated. I went to lunch and wasn't able to update the thread so I kinda feel bad sorry, want some free games?Draspur2013-12-05 18:28:59
B
71
S
24
G
11
Posts: 452
Reputation: 12,343

Post » Thu Dec 05, 2013 6:31 pm

I wouldn't use system time, as it can be cheated. Server time should be more reliable. Of course if you don't want to use an internet connection, then system time is your best bet.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Fri Dec 06, 2013 1:16 am

Unless your doing an online multi-player game. I personally wouldn't really have any concern over it. If however you are doing a online multiplayer game. Then I would agree that you should focus an online check.

mindfaQ point is also valid. As an example I only have an iPod Touch and if I don't have wifi access then your online time is pretty much near useless :( in fact you have to build redundancies to NOT let the tree grow. while it's off line even if the time would have pass accordingly.


And on a final note. If they want to cheat they will. The best anti-cheat is a game that's not popular.

I'm good :) but thanks for the offer.jayderyu2013-12-06 05:08:42
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Fri Dec 06, 2013 1:24 am

Game design-wise you could put in a "feature" that the tree doesn't grow unless its been visited within a 3-6 hour time frame. So maybe people could cheat the system, but it is alot of hassle.

Everyday do a date+time check, so if date/time ever becomes earlier than what has previously been set you can impose a punishment, like stunting the trees growth for a short while.

The new android star wars game has a similar feature where the game stops making money for you if you don't visit back every 6 or so hours.
(The stock in the shops runs out, until you load up game and manually re-stock the shops.)
B
21
S
6
G
2
Posts: 188
Reputation: 3,450

Post » Sat Dec 07, 2013 2:34 am

[QUOTE=Discmach] Game design-wise you could put in a "feature" that the tree doesn't grow unless its been visited within a 3-6 hour time frame. So maybe people could cheat the system, but it is alot of hassle.

Everyday do a date+time check, so if date/time ever becomes earlier than what has previously been set you can impose a punishment, like stunting the trees growth for a short while.

The new android star wars game has a similar feature where the game stops making money for you if you don't visit back every 6 or so hours.
(The stock in the shops runs out, until you load up game and manually re-stock the shops.)[/QUOTE]

We have a sun that stops tree growth after 6 hours actually!

@jayderyu

I didn't want it to be online either, but we have a leaderboard and the client was concerned with cheaters. The date comes in 2013-12-07 03:33:11 format, how would you advise calculating with that?
B
71
S
24
G
11
Posts: 452
Reputation: 12,343

Post » Sat Dec 07, 2013 5:24 pm

Well you have an online system. Then you really don't have a choice. So yeah stick with the online system.

Now are you saying you need to out put that format or do you need to interpret the string into usable number?

Personally either way I would suggest going to where your getting the number and changing the way your getting the time.
in PHP using
mixed microtime ([ bool $get_as_float = false ] )
would return the time in milliseconds as of . which would be more fine precision for games.(http://php.net/manual/en/function.microtime.php). I really wouldn't suggest working with a full calender time stamp, but instead a numerical one where time is measured off of unix epoch.

If you need to work with the string value. I would suggest using this as as a starting sample.

time = tokenate(date, 1, " ")
hour = int(tokenate(time, 0, ":"))
min = int(tokenate(time, 1, ":"))
sec = int(tokenate(time, 2, ":"))
*to note it might be stringtoint() or toInt() or something like that.
sec += min * 60
sec += hour * 60 * 60
... keep going for day, month and year. except I would get the difference of year as of launch year of the game.

I really suggest getting time in ms or seconds of the epoch. Doing so will reduce your work, the server programmers work, bugs and headaches.
<?php $t=time(); echo($t); ?>
That would be the easier.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Next

Return to Job Offers and Team Requests

Who is online

Users browsing this forum: No registered users and 1 guest