Can I embed some sort of mouse movement log in my game?

Get help using Construct 2

Post » Wed May 27, 2015 12:11 pm

Hello,

I'm a new user here at the Consctruct 2 forums. I'm building a 2D scrolling collector game for a scientific experiment on decision making on induced states of flow. I work with a post doc and am in charge of designing the game with him. One of the things we look to achieve with this game is mapping the movements made by the players (using mouse or fingers on mobile) to cross-reference them with timestamps from the game (it's a timed level based game) and also save other things on this log file like the score of the player.

We know this can be made in unity, but we are enjoying Construct 2 a lot and are wondering if this is possible to accomplish on this engine (provided we get permission from each player to record this data, of course).
Ask away if you have any questions. If needed I can pm with more details on the study so you know I'm legit.

Thank you very much,
Quendera
B
10
S
2
Posts: 27
Reputation: 617

Post » Wed May 27, 2015 4:28 pm

Yes, this is possible.

How much accuracy do you need in your timestamp?

If you just want to use local time, Rex Date plugin will give you timestamps from the system clock that the JavaScript is running on presently. If you need to access a more accurate time source (like a timing server), you can do an AJAX call and parse the time using a modified version of the Rex Date plugin that I can send you.

Rex Date: http://c2rexplugins.weebly.com/rex_date.html

Then you could just store the timestamp, mouse.X, mouse.Y in Arrays, Hashmaps, etc. every tick (per ~1/60 sec), or once per second.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed May 27, 2015 4:32 pm

Wouldn't it be as easy as setting mouse.x and mouse.y or touch.x and touch.y to an array at times specified by you?
Every tick would also be possible ofcourse, or every tick during a certain period..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed May 27, 2015 4:45 pm

gumshoe2029 wrote:Yes, this is possible.

How much accuracy do you need in your timestamp?


Hello, and thank you for the reply.
Sorry if I didn't explain myself correctly but the timestamp I meant is the in game time. Imagine level 1 at 30 seconds into the level the mouse (i'm using the touch object command) was on XY coordinates. Other then that, and ruling out mobile for now, do you know if there will be a limit to the number of measures I make (vs I can record 1 million playthroughs if I have enough space to store output files), and (assuming they will output to a txt file) could the engine create a different file for each player (perhaps based on ip, or whatever other criteria there is)?

Thank you!
Last edited by quendera on Wed May 27, 2015 5:13 pm, edited 1 time in total.
B
10
S
2
Posts: 27
Reputation: 617

Post » Wed May 27, 2015 5:03 pm

Yea, you can do the same thing with the Rex Date plugin too (the Timer functionality at the very bottom of his documentation page). Or you can track the in-game time yourself using a 'currentTime' variable (or whatever) and just update every second or so.

As far as storing in-game time/x/y, it sounds like you will want to ship them back to some server and write them to a text file.

As far as I know no one has ever implemented a text-file-writing plugin, so you would have to either use a server side program or implement something like this: http://stackoverflow.com/questions/1605 ... javascript in a Construct plugin.

The problem with using in-game storage for storing data is that it will be wiped everytime you start the game over (and it will be exclusively local to the running client).
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed May 27, 2015 5:15 pm

gumshoe2029 wrote:The problem with using in-game storage for storing data is that it will be wiped everytime you start the game over (and it will be exclusively local to the running client).


This is exactly what I thought and thus my question...
Ok thank you for now guys, let me know if someone happens to know of a solution to this. Hopefully I can do it and we can all make some science together in the near future!
B
10
S
2
Posts: 27
Reputation: 617

Post » Wed May 27, 2015 5:40 pm

gumshoe2029 wrote:The problem with using in-game storage for storing data is that it will be wiped everytime you start the game over (and it will be exclusively local to the running client).


Fisrt part not completely true, for you can store anything in localstorage, which will return that info when requested, second part true, but there is the Ajax-plugin for that, how would something go anywhere else than the original device without sending it over the net?

Also using a third party plugin like

viewtopic.php?f=153&t=109399&p=838705&hilit=plugin+social+mail#p838705

you could send a mail through Mandrill, setting the text to the desired info..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed May 27, 2015 5:44 pm

LittleStain wrote:Fisrt part not completely true, for you can store anything in localstorage, which will return that info when requested.


Yea, I was referring to the C2 arrays/hashes. If you use browser webstorage, then you are correct.

The Mandrill solution is clever too.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Post » Wed May 27, 2015 6:03 pm

gumshoe2029 wrote:
LittleStain wrote:Fisrt part not completely true, for you can store anything in localstorage, which will return that info when requested.


Yea, I was referring to the C2 arrays/hashes. If you use browser webstorage, then you are correct.

The Mandrill solution is clever too.


Guys, thank you so much. I'm off for the day now (I'm european) but I'll check on your comments and update you tomorrow on what I end up doing.
Thank you,
Quendera
B
10
S
2
Posts: 27
Reputation: 617

Post » Wed May 27, 2015 8:18 pm

I found this too just now:
https://www.scirra.com/manual/126/system-expressions
Under "Time" near the bottom.

time
The number of seconds since the game started, taking in to account the time scale.

timescale
The current time scale.

wallclocktime
The number of seconds since the game started, not taking in to account the time scale (i.e. the real-world time).
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,415
Reputation: 4,824

Next

Return to How do I....?

Who is online

Users browsing this forum: rayolf and 17 guests