WAIT and *REFRESH

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
mikeg
Posts: 101
Joined: Sat 23 Jun 2018, 19:52

WAIT and *REFRESH

Post by mikeg »

If you have viewed the video showing my animated character running around and even bouncing on a animated spring, there is no *REFRESH or SPRITE commands used. I mostly use well timed WAIT commands and have heavy control of action changes. A good WAIT appears on both of my computers very smooth with no flashing.. I will try it on my Raspberry Pi3 and see how it does.

I use this for my image animations and have a black overlay image to clear previous movements.. So its fast.

Code: Select all

      REM The image can be stretched or shrunk by increasing h% and v% over the size of the image
      REM same applies if you make it smaller than the original (cool eh?)
      DEFPROCloadbmp(name$,x%,y%,h%,v%)
      OSCLI "DISPLAY """+name$+""" "+STR$(x%)+","+STR$(y%)+","+STR$(h%)+","+STR$(v%)
      ENDPROC

Focus is on code subject. Feel free to judge the quality of my work.
guest

Re: WAIT and *REFRESH

Post by guest »

mikeg wrote: Sat 24 Nov 2018, 21:33there is no *REFRESH or SPRITE commands used. I mostly use well timed WAIT commands
The big difference is that (in BBCSDL) *REFRESH synchronises with display refresh (Vsync) whereas WAIT doesn't, so whilst you might think your motion is 'smooth' it's likely that somebody who is sensitive to motion artefacts wouldn't agree! Even if you try to 'tune' your WAITs to approximately match the display refresh period, you are going to come unstuck when running at a different frame rate (for example my Raspberry Pi feeds a TV so it is running at 50 fps rather than the more common 60 fps).

Unfortunately this is an area where there is poor compatibility between different BBC BASIC dialects. In Acorn's BASICs (and Matrix Brandy) WAIT synchronises to display refresh, whereas in my BASICs it doesn't. BB4W has no built-in display sync capability at all: neither WAIT nor *REFRESH lock to Vsync. In BBCSDL *REFRESH generally does wait for the next display refresh, but is not guaranteed to (for example owing to a bug introduced by Apple there is no vsync when running on MacOs Mohave). It's all rather a mess. :?
David Williams

Re: WAIT and *REFRESH

Post by David Williams »

guest wrote: Sat 24 Nov 2018, 22:03 (for example owing to a bug introduced by Apple there is no vsync when running on MacOs Mohave). It's all rather a mess. :?
Are you aware of any indication by Apple that that bug will be fixed in an update at some point?


David.
--
guest

Re: WAIT and *REFRESH

Post by guest »

David Williams wrote: Sun 25 Nov 2018, 00:24Are you aware of any indication by Apple that that bug will be fixed in an update at some point?
Nobody knows, but Apple have 'deprecated' OpenGL (in favour of Metal, which BBC BASIC can't use) and there is a suspicion in some quarters that as a result they won't be prepared to fix any problems with it. Those who favour conspiracy theories find it worrying that a serious bug in OpenGL seems to have been introduced just at the point that it has been deprecated, but I'm more inclined to think it's a cock-up.

The SDL maintainers certainly take it seriously, because they know the extent to which OpenGL is relied upon as the only 3D framework supported on every major platform (Windows, Linux, MacOS, Android, iOS). They are looking to see if there is a workaround that they can incorporate in SDL, but it has to be said that some people believe that Apple will drop OpenGL on MacOS altogether (even though that would be stupid) and many games developers are considering abandoning that platform altogether.

Apple seems to have total disregard for compatibility, either with other platforms or earlier versions of their own platforms. They seem to think that the loyalty of their users and developers is such that they will go along with every idiotic decision they take. But I have ascertained that there is no support at all for AND, OR and XOR plotting in Metal so even if I was inclined to go to the trouble of adapting BBC BASIC to work with it, I can't.
guest

Re: WAIT and *REFRESH

Post by guest »

guest wrote: Sun 25 Nov 2018, 10:18Nobody knows, but Apple have 'deprecated' OpenGL (in favour of Metal, which BBC BASIC can't use) and there is a suspicion in some quarters that as a result they won't be prepared to fix any problems with it.
It turns out that the problem that causes vSync to fail in MacOS Mojave isn't in the OS itself but in the Frameworks and/or other SDK tools supplied with that version, so it only manifests itself if the application is built on Mojave, which of course BBCSDL isn't. So for the time being, at least, BBC BASIC programs won't experience this fault and you can assume with reasonable confidence that vSync will work in MacOS.