25 July 2020, 15:48 | #1 |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Getting screen flicker on my HUD screen
I'm having a little bother managing my screens. The HUD screen I have is flickering like crazy and I've no idea why. It's odd because the flickering parts are Bobs, but the Yellow outline to the screen and the actual yellow health bars are a drawn Box and a Bar which don't seem to be affected.
[ Show youtube player ] If I take out the player and enemy procedures from the main loop it seems to help, but I'm unsure why they are affecting what's on the HUD screen. It may be how I'm organising my main loop, which is something like this: Code:
Do Wait VBL Screen 1 Proc Screen 1 Update Stuff (Healthbars, Timer, Lives etc) Screen 2 Main Game Stuff (The actual game screen: Players, enemies, priority etc.) Loop I'm kind of stuck, so any help would be great! Thanks. |
26 July 2020, 14:20 | #2 |
Registered User
Join Date: Feb 2017
Location: Oslo
Posts: 90
|
The Double Buffer command only works on the current screen, so if you need several double buffered screens you need to call Double Buffer once for each of them. If I'm not mistaken the flickering is due to one such missing Double Buffer statement.
I think it is unnecessary to double buffer the HUD screen though, because you don't really need Bobs in it. Paste the images once during setup instead, and update the time and health bar whenever the game data differs from the displayed data (i.e. compare the game data with a dedicated variable for the currently displayed health of each player, the currently displayed time, etc.). |
27 July 2020, 11:22 | #3 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
That's good to know about the HUD screen. I'm kind of guessing what to do as I've never handled any kind of panel/score/timer screen before. So would it be like just some timers in the main loop which triggers a clear and re-draw of the screen when necessary? Maybe call a procedure? EDIT: Yep it's working now. Just calling the procedure to update info and re-draw when needed. It's a teeny bit flickery although almost unnoticeable, but I'm just using the automatic Double Buffer setting so I may try experimenting with doing it manually. Last edited by Brick Nash; 27 July 2020 at 18:12. |
|
27 July 2020, 20:20 | #4 |
Registered User
Join Date: Feb 2017
Location: Oslo
Posts: 90
|
The central idea which I failed to communicate (oops), is that you never need to clear the entire HUD screen at any time during the game loop. Instead you can just modify small bits of it whenever a change occurs, for example by applying Bar to the end of a health bar to make it shorter.
When and how to check for changes? I imagined you could keep the same basic program structure as you showed in the first post, and let the check for changes be done in a procedure/gosub HUDSCREEN at "Update Stuff". Changes are detected by comparing the game variables with a duplicate set of variables managed by HUDSCREEN. A little example to clarify: Code:
Dim HEALTH(4) : Rem Remaining health of each player Dim HUDHEALTH(4) : Rem Duplicate of HEALTH(), managed by HUDSCREEN HUDSCREEN: If HEALTH(1)<HUDHEALTH(1) HUDHEALTH(1)=HEALTH(1) : Rem Dec HUDHEALTH(1) for a gliding reduction 'Update the Health Bar of Player 1 [to match HUDHEALTH(1)] End If 'Repeat the above code for each active Health Bar Return An easy thing to try as remedy against the remaining slight flicker is to switch the order of Update Stuff and Main Game Stuff in the game loop. (Where the idea is that the video beam gets time enough to travel below the HUD screen before Update Stuff starts messing with it). |
29 July 2020, 10:27 | #5 | |
Prototron
Join Date: Mar 2015
Location: Glasgow, Scotland
Posts: 411
|
Quote:
Thanks! |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A1200 screen flicker | ItsTheSmell | support.Hardware | 3 | 18 May 2019 12:35 |
Screen flicker on floppy access | gazj82 | support.Hardware | 5 | 11 April 2016 01:14 |
Amiga 600 not booting... Yellow screen, and Red screen when turning PSU off | jbenam | support.Hardware | 34 | 20 March 2011 22:10 |
DCE: Flicker Magic screen modes | Mick_AKA | support.Hardware | 6 | 16 June 2005 04:42 |
Who here has the dodgy A1200 with screen flicker? | Bloodwych | Retrogaming General Discussion | 0 | 30 December 2001 22:36 |
|
|