0 Favourites

Construct 2 in a research environment

  • Hello, comunity .

    I'm a neuropsychologist. I study brain and cognition. A neuropsychologist's main weapon in study, are the psychological tests.

    Yes, you may have seen some psychological tests online. Forget about them. We work with precision and scientific validation. If there is no evidence, it's not worth using. And if the evidence is weak, we must polish the test.

    I chose construct 2 because it's awesome. And easy to use. But i'm very worried about one thing: The timer's precision.

    How precise is the timer in construct 2? It's known for us, psychologists, that a 2ms difference is a difference that cannot be ignored.

    So I ask you... How precise is the timer in Construct 2? Should I use it for research? Keep in mind that the precision cannot be too oscilating. I know that there are a lot of factors involved, like responsiveness of the keyboard and the computer's processor. But i'm not a programmer, so I don't know it for sure. Can you please explain it to me, or give some reference? (it VERY important for me)

    In a matter of information, there is only one scientific article showing that Flash's timer precision is reliable for research propourses, so, to make your life easier, you may tell me: Is Construct 2 more reliable than Flash in this aspect?

  • As I know, (less then) 2ms is hard to reach, even in os timer.

    You might need a special hardware or using a hard-real time os, I guess.

    Maybe I'm wrong.

  • Contruct 2 currently can't work above 60fps. That means, at best, you're going to be working in about 17ms 'steps' per frame regardless of the accuracy of the input with the keyboard.

    I would recommend construct classic for this task. It has an 'unlimited' mode where the exe runs as fast as possible. My computer is nowhere near top of the line and it gets about 4,000 fps using this method with a blank .cap, and I seem to recall someone mentioning getting over 10,000 fps. If you keep the content and code simple and keep all unnecessary code deactivated, hopefully it would be fast enough for you.

    Construct classic also has a very high precision timer in its 'profiler' plugin. Use that and the unlimited mode together to get high precision data.

    Keep in mind though that the larger the window, the more pixels the graphics card will need to redraw. Keep the window small and deactivate as much code as possible to keep the fps high.

    At 5,000 fps, you're getting a precision of about 0.2 ms per step, which I hope would be adequate. If you want faster than that, you're probably going to have to use something else like raw C++.

  • I should explain - the timer in the profiler can work, far, far faster than the framerate in much smaller bits of time than 0.2 ms. However, I'm not quite sure how to set something like this up properly because in unlimited mode, the graphics card is probably going to be the bottleneck and the cpu might end up waiting for it to draw to the screen, as there's no way to decouple running the logic from rendering.

  • Excellent answer, Arima. Thanks a lot. Is it possible that construct 2 will get a plugin wich does the same thing that construct classic does?

  • I doubt it, Construct classic is a entirely different category. C2 is an HTML 5 game editor (WebGL), while Construct Classic relies on your system rather than your browser. Someone else can explain this much better than I can, but I think that gets the point across.

  • I'm not sure. I think it would probably need to be coded into the program itself, but you could post in the plugin development forum asking if it's possible, or wait for an answer here from someone more knowledgeable than I about plugin development.

    Even if C2 gets the ability to run logic and render faster than the screen refresh though, it won't be as fast as construct classic, because C++ is far faster than javascript. Also C2 currently lacks a profiler with a high-resolution timer.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Hey Zerei,

    Are you planning on doing all this testing on one machine? or are you looking for software to be loaded on many computers to test in groups?

    I would have thought that using Dt in C2 would be sufficient for this (as it is supposed to be the same time regardless of computer speed right?). Maybe im missing something here.

    Edit: just did a little research, seems like dt is affected by too many factors (if only slightly). Unless you intend to do a study on the accuracy of C2's or CC's timers first, I would use the flash timer to be honest.

  • Zerei : I worked with users' reaction time on computers, during my PhD. No Javascript can give you a timer more precise than 4 ms, it's in the W3C specification. Only the Chrome, 1st build used a 1 ms timer (which made the CPU getting hot like crazy). Keep in mind that on any OS apart from QNX and RTLinux, when you set a timer resolution, it's an at best promise from the OS. For example, on Windows below win7, you won't get anything below 10 ms in real world usage.

    For your reaction loop : frame display = 16 ms (at 60fps) + eye processing, arm movement and finger click on mouse/keyboard ~= 150-200 ms + USB port rate, at 125 Hz = 8 ms + OS HID stack processing ~= 1 or 2 ms (depends on what's the CPU's doing at that moment => IRQ interruption mechanism) + next frame updated onscreen = 16 ms...

  • Contruct 2 currently can't work above 60fps.

    I don't think that's true, Ash told me somewhere that the 60 limit is dependant on refresh rate so if you have a 120hz monitor it could go higher than 60.

  • Both Javascript and Flash are definitely the wrong tools for the job if you need high precision timing for research, because of something nobody's mentioned yet: garbage collection pauses. Every few seconds or minutes they will pause everything and go and clean up memory, and this can take 10 - 1000ms. A 100ms pause isn't uncommon and it essentially be happening randomly, whenever the memory usage conditions become suitable for collection. So if you are making high precision time measurements, you will basically get random delays added in to your results, and not all of them will even be noticable.

    You could use Construct Classic, but it is still a step-based game engine and not really designed for high accuracy measurements. For example, it uses double-buffering, meaning there is another one frame latency before visual feedback appears on the screen, and in some circumstances it may even use triple buffering.

    Computers are capable of microsecond precision in their timers, which might be supported in Javascript depending on the browser, and is supported in Construct Classic. However, I've heard that PC input is sampled for the mouse, so mouse input will only update at 50-100 Hz, so if you are using mouse input your results will only be coming in at 10-20ms increments anyway. I don't know about keyboard input though.

    TBH I don't know much about extreme precision measurements on PC - we make game engines which generally are designed to smooth out inaccuracies over time and are optimise to look good rather than be perfectly accurate. I'd recommend getting specialist advice and tools, I don't think any of us can give you the necessary information you need.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)