Author Topic: Need some kind of constant motion.  (Read 1151 times)

Offline nstgc

  • Member
  • Posts: 7758
    • http://www.justfuckinggoogleit.com
Need some kind of constant motion.
« on: September 07, 2010, 08:52:08 PM »
I need something to display a constant, predictable, uniformed motion. Ideally a bouncing white black that moves around a screen. There is a Java program that does that. I'm checking for a specific problem. My new monitor seems to be a bit jerky. Its not the video card, and xShadow isn't have trouble with it. Google also doesn't enlighten me any aside from informing me that no one else seems to have this problem. Given that I do have a used monitor, it doesn't seem too far fetched to think that there may be something wrong.

Offline billlanam

  • Member
  • Posts: 316
Re: Need some kind of constant motion.
« Reply #1 on: September 08, 2010, 06:06:00 AM »
You can check your monitor with another computer, to see if the monitor is at fault.

There are screen savers that do constant motion.
« Last Edit: September 08, 2010, 07:09:44 AM by billlanam »

Offline K7IA

  • Member
  • Posts: 884
  • :)
Re: Need some kind of constant motion.
« Reply #2 on: September 08, 2010, 01:12:05 PM »
a simple javascript could do the trick as well...

<html><body><div>

div as a whitebox with your desired dimensions, body with a black background (or vice versa)

move it along the x for every y with a simple timer or a mouse/keyboard event

run the code on browser in fullscreen.

... you got a very simple testing tool

Offline nstgc

  • Member
  • Posts: 7758
    • http://www.justfuckinggoogleit.com
Re: Need some kind of constant motion.
« Reply #3 on: September 09, 2010, 08:33:06 PM »
I don't know Java and am not interested at this time to learn it. Maybe I can ask someone who does know Java to write a script like that.

Offline K7IA

  • Member
  • Posts: 884
  • :)
Re: Need some kind of constant motion.
« Reply #4 on: September 10, 2010, 07:13:55 AM »
^ sure  ;) just save it an .html and open it with your browser.

Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function move(i)
{
var box = document.getElementById("box");
var o = {interval: 20, step: 5}
o.x = Math.floor(window.innerWidth / o.step);
o.y = Math.floor(window.innerHeight / box.clientHeight);

box.style.left = (i % o.x) * o.step;
box.style.top = (Math.floor(i / o.x) % o.y) * box.clientHeight;

setTimeout("move(" + (i + 1) +")", o.interval);
}
</script>
<style>
#box {width: 50px; height: 50px; position: fixed; display: block; background-color: white;}
body {background-color: black;}
</style>
</head>
<body onload="move(0);">
<div id="box"></div>
</body>
</html>

Offline nstgc

  • Member
  • Posts: 7758
    • http://www.justfuckinggoogleit.com
Re: Need some kind of constant motion.
« Reply #5 on: September 12, 2010, 05:35:56 PM »
Not exactly what I was asking for, but it provided exactly what I needed. Thanks!

Just to make sure, I have two questions.

1) It is suppose to be smooth
2) the block should not change shape

I'm pretty sure the answers are both yes, but I figure I'd ask anyway.

It definately seems as if there is a problem.

Offline K7IA

  • Member
  • Posts: 884
  • :)
Re: Need some kind of constant motion.
« Reply #6 on: September 12, 2010, 06:15:50 PM »
You are welcome :)

The code is very simple, as such, it can be configured very easily. (it seems I didn't include any comments for interpretation of code)

1) speed can be adjusted by decreasing/increasing interval and/or step
Code: [Select]
//just modify this line in the original code (interval in milliseconds, step in pixels)
var o = {interval: 20, step: 5}

2) The block will never change shape.

« Last Edit: September 12, 2010, 07:06:44 PM by K7IA »

Offline nstgc

  • Member
  • Posts: 7758
    • http://www.justfuckinggoogleit.com
Re: Need some kind of constant motion.
« Reply #7 on: September 12, 2010, 07:42:55 PM »
By smooth I meant constant. I'm sure it is as that was what was requested.

ANyway, I'm hoping xShadow will run that. As mentioned he has the same monitor.

Offline xShadow

  • Member
  • Posts: 1503
  • No
Re: Need some kind of constant motion.
« Reply #8 on: September 12, 2010, 10:30:41 PM »
I'm not sure what you're trying to get out of this test, because I'm pretty sure that it's going to be a little jerky simply because of the way this is using a browser (as opposed to something made for 2d graphical movement...).


Anyway, mine moves across smoothly most of the time, but there are little jerks in between (in Chrome). It also depends on which browser I'm using. Chrome does small jerks every several seconds (a series of them) and then stays smooth the rest of the time, whereas Firefox has very tiny jerks with a big jerk every several seconds. In IE, it doesn't move at all. >_>;

As for the box shape, it depends on how quickly I make it move. Occasionally, the one of the sides (left and right, not up and down) seem to kind of "go inwards" for a bit (ie, the box looks rectangular-ish, since the sides go in a bit), but I think that's (again) simply because of how this is executing in a browser, and the movement isn't necessarily that smooth. Kind of reminds me of when I made some C code that went into a gameboy emulator. Basically, you had to clear off the screen once after every time the box moved, because otherwise it would leave a trail behind. I think there's a similar effect at work here, and that's what's causing the box to "change shape" as it moves. I also notice that there's a few "floors" included in there somewhere. I don't have time to trace the code, but I think that might affect its movement.

Edit: I think it would be more helpful if we did a test that was more easy to relate. If you want, you can download Wolfenstein ET (it's a free game), and then try playing with some people. Aside from obvious occasional FPS drops because of huge firefights in the engine (or internet lag), tell me if you notice anything strange. I can play that game without any problems...
« Last Edit: September 12, 2010, 10:34:00 PM by xShadow »

Cute, huh?

Offline nstgc

  • Member
  • Posts: 7758
    • http://www.justfuckinggoogleit.com
Re: Need some kind of constant motion.
« Reply #9 on: September 12, 2010, 11:31:46 PM »
As for this test, I think I see the problem. I turned off compositing which also turned off v-sync. in a one minute period it will "blink" (tear) 68 times (I used a stop watch and counted). This is the same frequency observed with the dropped frame (in another thread I said "every other frame" but that was wrong).

Considering the screen is set to  60hz and the GPU is sending data at 59hz. I guess that last frame each second is used as catch up or something. What is odd, however, is that I can't set it to 60hz when the resolution is set to 1680x1050.

In anycase, thank you xShadow and K71A.

Offline xShadow

  • Member
  • Posts: 1503
  • No
Re: Need some kind of constant motion.
« Reply #10 on: September 12, 2010, 11:55:45 PM »
Maybe that's because it's not its native frequency. Well, whatev. Mine's refresh rate always stays at 60Hz, at least when I go into its option menu (1920x1200).

Also, you mentioned washed out colors. The monitors by default come with their brightness and contrast set to zero (in the monitor settings). Try setting both of these values to about 50, and you should notice a pretty colossal change. Also, run that HP display helper utility I gave you in a PM, it'll further help you get a better display.

Cute, huh?

Offline nstgc

  • Member
  • Posts: 7758
    • http://www.justfuckinggoogleit.com
Re: Need some kind of constant motion.
« Reply #11 on: September 13, 2010, 01:29:51 AM »
Oh, the thing with the "drivers", I installed that the day after I got the monitor. The colors are fine now. I should have mentioned that.

Since you brought up the refresh rate, where does it say 60hz? Under information on the monitor, or on the computer? My monitor's information screen displays 59.7hz, however under the nVidia control panel it lists 59hz.

[edit] DXDiag says its running at 59hz as well.

Acording tho this its a case of bad rounding. Furthermore, its not a problem. Well, it sure as hell seems to be a problem for me.

[edit2] At the bottom of this page someone else concluded that a similar problem is resulting in dropped frames.

[edit3] For those who don't want to have to make their own file (which is easy) I have a page for you where you can test the same thing block test
« Last Edit: September 13, 2010, 02:03:57 AM by nstgc »

Offline xShadow

  • Member
  • Posts: 1503
  • No
Re: Need some kind of constant motion.
« Reply #12 on: September 13, 2010, 04:00:02 AM »
Hmmm...

I looked at my monitor's settings, and it had a flat 60 for the vertical, and 74.1k for the horizontal. I then went into dxdiag, and it also listed my display mode as a flat 60Hz on the refresh rate.

I'm not really sure what's up with that, maybe a difference between ATI and Nvidia drivers. I think I actually have gone into my monitor's settings and noted that it had a 59.7 or so at some point, but I haven't seen it since then (it's at 60 right now). By the way, seriously, if you haven't tried turning your brightness and contrast to (around) 50 in the monitor settings, I highly suggest doing so. The difference is pretty big (at least in my opinion).

Cute, huh?

Offline namaiki

  • Member
  • Posts: 1151
Re: Need some kind of constant motion.
« Reply #13 on: September 15, 2010, 04:35:43 AM »
[edit3] For those who don't want to have to make their own file (which is easy) I have a page for you where you can test the same thing block test
Doesn't play completely smooth for me either. It goes: tick, tick, tick, etc.
Kaoru + Aoi + Shiho = Infinity
For video playback: madVR + CCCP 2011-11-11 (use the bundled version of MPC-HC)
https://www.youtube.com/watch?v=jXBQ

Offline bloody000

  • Member
  • Posts: 1401
Re: Need some kind of constant motion.
« Reply #14 on: September 15, 2010, 04:09:47 PM »
All you have to do is study it out. Just study it out.

Offline nstgc

  • Member
  • Posts: 7758
    • http://www.justfuckinggoogleit.com
Re: Need some kind of constant motion.
« Reply #15 on: September 15, 2010, 09:39:31 PM »
I finally got it to work.

The problem that I was having, it seems, was getting the custom timing to stay. For some reason it wasn't being applied properly. Now that the monitor and Windows are both running at 60hz, there are no dropped frames.