Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: hubertMichael on September 24, 2012, 05:54:48 PM

Title: vsync issue
Post by: hubertMichael on September 24, 2012, 05:54:48 PM
Hi

I know that this issue was already discussed but it didn't help me. I got problem with vsync. My adventure is fully 2d poin't and click. In full screen mode my game is working much slower than without full screen mode. I am one hundred percent sure that this is vsync problem.

In fullscreen mode Wintermute works with vsync on and in window mode vsync is off. I know that there is no control of vsync from scripts.

What can I do?? This is huge showstopper for me. With this issue I can't finish my open demo.

Sorry for my english.
Title: Re: vsync issue
Post by: Mnemonic on September 24, 2012, 06:01:10 PM
Why is it such a big problem? With vsync the game runs typically at 60 FPS. That's not enough for you?
Title: Re: vsync issue
Post by: hubertMichael on September 24, 2012, 10:25:44 PM
Of course it should be enough. Therefore it's strange that in fullscreen mode game is much slower.

People who played my closed demo complained about the actor comes slowly and the screen scrolls slowly. There were issues about "vibration" of actor when screen is scrolling.

However in window mode this problems doesn't exist.

I know it's vsync because when I told my friends to turn off vsync in graphic drivers this problems disappeared.

I love this engine but this only thing is what I'm worried about. I need find a solution but I ran out of ideas.
Title: Re: vsync issue
Post by: hubertMichael on September 24, 2012, 11:01:26 PM
Hey I know it's not only my problem. Maybe together we could find some solution once and for all.
Title: Re: vsync issue
Post by: metamorphium on September 24, 2012, 11:05:52 PM
it's quite usually bound to bad scripting. Constructions like Sleep(1); and the likes. You should always count with some FPS to boot and adjust wait cycles accordingly. Then you don't have this problem.
Title: Re: vsync issue
Post by: hubertMichael on September 24, 2012, 11:09:37 PM
Quote
You should always count with some FPS to boot and adjust wait cycles accordingly.

Could you develop this idea?
Title: Re: vsync issue
Post by: hubertMichael on September 25, 2012, 12:09:25 AM
Alright, I have started new project (just for test) with template "bacis project". I've changed only two things.
First: Instead of loading molly I'm loading my actor. My actor walk.sprite has delay 40 ms, move by 10 and has 30 frames.
Second: Changed resolution from 800 x 600 to 1280 x 720.

Everything else is the same as in template. So in window mode my actor walks with desired speed but in full screen actor walks much slower. Then just to be sure I turned off vsync in graphic driver settingns and this helped. Of course this is not solution. What is wrong? I don't believe that there is no solution. And this is not bad scripting because it's template. I didn't do any scripting.
Title: Re: vsync issue
Post by: odnorf on September 25, 2012, 12:55:10 AM
Unfortunately this is caused by the many frames of the character and the difference of monitor's speed (60hz usually) and delay (40ms) of your frames. It's a known issue for 2D graphics when v-sync is enabled (not related to wme). Check the paragraph V-Sync (https://en.wikipedia.org/wiki/Screen_tearing) of this page. Yes I know it mentions video but it's valid for moving 2D. You either have to remove many of the character frames or instruct the players to disable v-sync. Best option would be if you could disable v-sync through scripting which is not possible in current wme. But even that wouldn't be a universal solution as gpu drivers have options to always have v-sync no matter what a game asks.
Title: Re: vsync issue
Post by: hubertMichael on September 25, 2012, 01:22:46 AM
Thanks for your answear. Now I'm felling that I'm lost. Could you give me some tips how I could set delay in my walk.sprite, how many frames and how to set move by? I don't want exactly number because it depends on my actor but what are the optimistic sets? I need some tips according to I will redo animations.
Title: Re: vsync issue
Post by: odnorf on September 25, 2012, 08:29:34 AM
I'm afraid you'll have to do some testing but you won't need to redo graphics for it. Just use the frames you currently have and start with 15 frames.

As a desperate measure there is a third party mod of wme (http://forum.dead-code.org/index.php?topic=4025.msg29427#msg29427) which ads the ability to disable v-sync through scripting. But using this version has some differences. It's LGPL only so you'll need to comply with it (please ask if you need for info), it's not as tested as official version and last we offer no support for it in those forums (you'll have to ask the developer of this version if you get a problem not available in official wme).
Title: Re: vsync issue
Post by: hubertMichael on September 25, 2012, 07:28:23 PM
s.belov: Thank you. I've tried but this crashes my computer. I will stick to orginial wme version.
Title: Re: vsync issue
Post by: hubertMichael on September 25, 2012, 09:19:39 PM
Finally I have found solution.

It is very crazy I know but it works. Now my actor in full screen walks much better then in window mode before.

I doubled animation frames. So I had 30 frames per walk now I got 60 frames. I didn't add new frames. Simply in SpriteEdit I added a double each frame. This allowed me to reduce delay from 40 ms to 15 ms.

Works like a charm :D :D
Title: Re: vsync issue
Post by: Krosad on October 08, 2012, 01:59:55 PM
hubertMichael, I had same problem. As you advised I made actor animation with 60 frames and "vibration" of actor disappear.
Also I added this code "if (Game.WindowedMode == false) Scene.ScrollPixelsX = 2;".

thank you very much.