Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Glitchy Movement

Author
Message
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 6th Aug 2017 22:12
I've a few Sprites moving across the screen and I found that *most* of the time movement would be smooth, then once in a while a 'glitch' would ruin the smoothness.

So I thought I'd use the Tweening function, but it still get the odd glitch in movement. Can anybody improve on my code to remove the odd movement glitch?

Attachments

Login to view attachments
easter bunny
12
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 7th Aug 2017 11:20
Do you have any Bluelight filter software (like Iris or f.lux) running? I had issues with that causing glitches in my game a while back. The inbuilt one in Windows 10 doesn't cause any issues but the two I mentioned both caused the bug

My Games - Latest WIP - My Website: Immortal.Digital - FB - Twitter
130,000 installs with AppGameKit and counting
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 7th Aug 2017 11:36
No, nothing that shouldn't be running in the background.

It probably wouldn't be noticed in a busy game, but this test smoothly runs 3 sprites across the screen for 15 seconds - so the odd glitch is very noticeable to my eyes.
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 7th Aug 2017 21:42
I converted your code for tier 1, I'm not a tier 2 user, and when I ran it I didn't notice any glitches in the movement, I even messed about with the speed of the tweening and didn't notice anything. I might not be as exacting as you and it really does depend on what you mean by glitch but as far as I'm concerned the movement is smooth.

I did notice that you're setting the sync rate and also turning vsync on. Normally you do one or the other not both and, according to the help files turning vsync on is the more preferred method. Turning vsync on should override the SetSyncRate command but it might be worth removing either SetSyncRate or SetVsync and seeing what happens.

Quote: "It probably wouldn't be noticed in a busy game, but this test smoothly runs 3 sprites across the screen for 15 seconds - so the odd glitch is very noticeable to my eyes."


My advice would be to stop worrying about this glitch put some interactive element into your demo: take control of one of the ships and fly it around or try to shoot them down or what have you, and see if you find the glitch is still noticeable to you. There's a very good chance you're about to drive yourself nuts try to fix a problem that isn't really a problem.
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 8th Aug 2017 10:59 Edited at: 8th Aug 2017 11:23
SetSyncRate removed. It made no difference.

By glitch I mean it's as if Vsync was turned off for a fraction of a second - so you get tearing (and judder).

Haha yes it might drive me nuts over this (blink and you'd miss the glitch). I did notice the BASIC version was a fraction smoother, however.

Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 8th Aug 2017 11:34
Are you sure your PC CPU is not spiking cus' of an unrelated process or program? try keeping one eye on task manager, not best practice but maybe try adding Sleep(10) https://www.appgamekit.com/documentation/Reference/Core/Sleep.htm in your main do loop, In the old single core days I'd do this.
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 8th Aug 2017 12:15
Sleep(10) made it much worse.

Well if you run the code, do you notice the couple of times it glitches on your system?
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 8th Aug 2017 12:38 Edited at: 8th Aug 2017 12:38
I just ran it 3 times and noticed no jumps or stutters, running smooth between 59-60FPS, I also tried after adding sleep(10) and yes it did make it worse, not massively so.

I ran this on my works computer which is hardly a powerhouse with an i3 CPU, 8GB RAM and two 1080p screens, I have 2 VM's running, Outlook, Lync, Excel, Phone software, notepad++ and a couple of chrome tabs.

My idle CPU is around 0-7% spiking to 20-25% occasionally. How does your idle CPU match up? my first thought as above is your CPU usage spiking.
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 8th Aug 2017 13:09 Edited at: 8th Aug 2017 13:26
I guess you must be running the demo in a window ( SetWindowSize(1024, 768, 0) ) instead of full screen.

I've just done the same, and the glitch doesn't happen in a windowed mode - but it does in a full screen mode.
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 8th Aug 2017 14:07
I just copy and pasted your code from a few posts up and didn't change any of the settings. It would have been running fullscreen.
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 8th Aug 2017 14:25
Then how are you reading the Task Manager Window information?

I've some people I know on another site test and they are reporting mild to severe tearing on the Full screen version, and the windowed version as smooth and no glitch.
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 8th Aug 2017 14:46 Edited at: 8th Aug 2017 14:56
I just open up Task-manager and open the performance tab, if i notice a judder and the graph has a spike at that time then there must be something going on, I'd be worried if my CPU idled above 10%, you can go into the processes tabs and sort the CPU column to see if any background process is hogging your CPU.

I ran your code again in window and fullscreen and saw no performance difference, I also tried with VSYNC off and there was a small amount of tearing and it was running at 100FPS, tearing to be expected ofc cus of refresh rate.

Have you tried using setsyncrate(60,1) to lock frame rate to 60?
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 8th Aug 2017 15:21 Edited at: 8th Aug 2017 15:55
What I'm saying is Task Manager only runs in a Window doesn't it? It runs at 4% capacity, that's not the problem - AppGameKit is.

Yes I've tried SetSyncRate(60, 1).

You're not getting what I'm saying, it is silky smooth running in a window with SetWindowSize(1024, 768, 0) But it glitches slightly in full screen mode. Maybe you're just missing it (it is very subtle) or your system is ok.

Therefore it is either a bug in the full screen mode, or a driver problem. A few people have reported it silky smooth in windowed mode - but slight to very glitchy (tearing) in full screen mode and judder.

Here's the exe:

Attachments

Login to view attachments
Supertino
7
Years of Service
User Offline
Joined: 22nd Jun 2017
Location: Behind you!
Posted: 8th Aug 2017 15:54
I hear what you saying, I simply don't see the issue in window or full-screen that you describe.

The only difference between running in window and full-screen would be that in full-screen (assuming you're not running a 1024x764 native screen) is that the virtual-res is kicking in to upscale the graphics which will introduce some additional interpolation into object movements which might appear as jerky? Does the same effect happen if you set the resolution to your native screen resolution and run in full screen? out side of that I'll have to tap out , I am new round here and still learning the quarks of AGP myself.
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 8th Aug 2017 15:59 Edited at: 8th Aug 2017 16:35
In native 1920 x 1080 full screen we have the same problem - but not in window mode. The frame-rate really should be rock solid in any mode (even if CPU spikes) because this is a tweening system.

Clearly full and windowed modes work slightly different, because (as an example) I was told to use GetScreenBoundsLeft() and GetScreenBoundsRight().

Thanks for your help Supertino.
smallg
Valued Member
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location: steam
Posted: 8th Aug 2017 18:16
there's a known screen tear in full screen mode, are you talking about this?
https://forum.thegamecreators.com/thread/219910
life\'s one big game
spec= 2.6ghz, 1gb ram, 512mb gpu, directx 9.0c, dbpro and classic
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 8th Aug 2017 18:34
Aha! Thanks smallg, good news it will be fixed
Stephen Elliott
7
Years of Service
User Offline
Joined: 31st Jul 2017
Location:
Posted: 18th Aug 2017 09:57
Fixed in the latest version

Login to post a reply

Server time is: 2024-11-22 20:29:28
Your offset time is: 2024-11-22 20:29:28