05 October 2022, 01:17 | #641 |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
@pipper
I have raised a PR for the changes made to try and fix the double buffer sync issue, feel free to reject it if you have ideas for a better (more correct) solution |
05 October 2022, 09:47 | #642 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,918
|
When did this double buffer sync problem start or has it been there all the time?
|
05 October 2022, 10:59 | #643 |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
I think (and could be wrong) it started when the double buffering method was changed from using ScrollVPort to ChangeScreenBuffer. or at least that is when the issue became obvious visually. pipper could answer this better.
|
05 October 2022, 12:10 | #644 |
Amiga Games Database
Join Date: Jun 2006
Location: South West England
Posts: 1,240
|
(Disclaimer: I don't know nuffink.)
It couldn't have any relationship with the hardcoded mouse/keyboard controls? P.S. I will try to run the latest exe later today. (1200 060) |
05 October 2022, 21:50 | #645 |
Amiga Games Database
Join Date: Jun 2006
Location: South West England
Posts: 1,240
|
I'm probably doing something daft (again) but I just get an iconx shell opening which says, EXECUTE invalid directive. I basically just put the new exe into the drawer which has a working exe, copied the working exe's icon and renamed it to the new executable's name. hiresBUFF.info The older exe still works very well.
|
05 October 2022, 22:38 | #646 | |
Registered User
Join Date: Jul 2017
Location: San Jose
Posts: 652
|
Quote:
It started with me trying to switch from ScrollVPort to ChangeScreenbuffer as method to switch the bitmap pointers. This was to solve two problems 1) prevent occasional visible glitches when switching the bitmap mid frame 2) sync the switch to Vsync an thereby limit the frame rate on extremely fast setups like WinUAE JIT I had reverted the patch in meantime in the master branch. Something about ChangeScreenbuffer doesn’t work right in our context and it’s documentation is not helping. |
|
06 October 2022, 09:01 | #647 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,918
|
Does the code have more than one task running in parallel? I wonder how the screen computation / display routine could get out of sync if not. The screen computation (or c2p / fastmem-to-videomem-copy routine) should load the pointers much in the same way it gets loaded for the ChanceScreenBuffer() call. If all of this happens sequentially, I don't see how it could get out of sync.
|
06 October 2022, 10:03 | #648 |
Registered User
Join Date: Jul 2017
Location: San Jose
Posts: 652
|
Some parts of the engine run in the vblank interrupt. I have not yet determined which parts those are. One could say this is effectively running two threads…
|
06 October 2022, 10:08 | #649 |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
Maybe the screenbufferindex flip should be moved to after the call to changescreenbuffer?
Code:
move.w ScreenBufferIndex,d0 lea ScreenBuffers,a1 ;eor.w #1,d0 ; flip screen index ;move.w d0,ScreenBufferIndex move.l (a1,d0.w*4),a1 ; grab ScreenBuffer pointer move.l MainScreen,a0 CALLINT ChangeScreenBuffer ; DisplayMsgPort will be notified if this image had been fully scanned out ***************************** move.w ScreenBufferIndex,d0 eor.w #1,d0 ; flip screen index move.w d0,ScreenBufferIndex ***************************** Last edited by abu_the_monkey; 06 October 2022 at 11:23. |
06 October 2022, 22:41 | #650 | |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
Quote:
|
|
10 October 2022, 00:26 | #651 |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
did anyone get a chance to test the exe I posted with a 'hack' to try and keep the double buffering in sync? Angus said he had not seen issues but it felt slightly slower, would be nice to know of any other experiences good or bad.
|
12 October 2022, 23:07 | #652 |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
clearing the DisplayMsgPort and setting ScreenBufferIndex to 0 (so the start conditions are always the same) before entring the main game loop seems to be a better solution to the stuttering double buffering.
pre main game loop Code:
syncDblBuffer: move.l a6,-(sp) ;empty DisplayMsgPort and set ScreenBufferIndex to 0 ;so the starting point is the same every time .clrMsgPort move.l DisplayMsgPort,a0 CALLEXEC GetMsg tst.l d0 bne.s .clrMsgPort move.l #0,ScreenBufferIndex ; Flip screen once, to initiate the message queue. ; Otherwise we'd be stuck on the very first frame ; waiting on DisplayMsgPort for a message that'll ; never arrive. .nok lea ScreenBuffers,a1 move.w ScreenBufferIndex,d0 move.l (a1,d0.w*4),a1 ; grab ScreenBuffer pointer move.l MainScreen,a0 CALLINT ChangeScreenBuffer ; DisplayMsgPort will be notified if this image had been fully scanned out tst.l d0 beq.s .nok move.w ScreenBufferIndex,d0 eor.w #1,d0 ; flip screen index move.w d0,ScreenBufferIndex move.l (sp)+,a6 rts Code:
doDblBuffer: move.l a6,-(sp) ; Flip screens ; Wait on prior frame to be displayed. ; FIXME: this could waste time synchrously waiting on the scanout to happen if we manage ; to fully produce the next frame before the last frame has been scanned out. ; We could move the screen flipping into its own thread that flips asynchronously. ; It does not seem very practical, though as this scenario move.l DisplayMsgPort,a0 move.l a0,a3 CALLEXEC WaitPort .clrMsgPort move.l a3,a0 CALLEXEC GetMsg tst.l d0 bne.s .clrMsgPort .nok lea ScreenBuffers,a1 move.w ScreenBufferIndex,d0 move.l (a1,d0.w*4),a1 ; grab ScreenBuffer pointer move.l MainScreen,a0 CALLINT ChangeScreenBuffer ; DisplayMsgPort will be notified if this image had been fully scanned out tst.l d0 beq.s .nok move.w ScreenBufferIndex,d0 eor.w #1,d0 ; flip screen index move.w d0,ScreenBufferIndex move.l (sp)+,a6 rts Last edited by abu_the_monkey; 08 November 2022 at 23:56. |
13 October 2022, 00:19 | #653 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,135
|
@Abu
I'll add your fork as a remote and test tomorrow. I've been totally unable to make time for it. You have two open pull requests against the main repo. Which branch would you like me test our first? Pipper granted me collaborator access so Incan merge approved work. We are quite a few hours apart timezone wise. |
13 October 2022, 00:49 | #654 |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
@Karlos
see what you make of the double buffer 'hack' first as I could be beating a dead donkey and miss understanding all of it, but, the last changes (in the post above) made sense to me in my tiny little mind . The other branch was for pipper to cherry pick any useful ideas from, not necessarily the way I (with help from others) implemented them, like the fps counter and timed lighting etc. most of which I felt would be made redundant soon with the rate of progress you two are making. |
13 October 2022, 09:17 | #655 |
Registered User
Join Date: Jun 2015
Location: Germany
Posts: 1,918
|
@Abu: didn't see where you are setting the framebuffer index to zero and I'm not sure it's a good idea. But it is a very good idea to empty the message queue! The code you posted looks good.
One thing that has been lurking in my brain for some time now is the fact that the swapping of the index (the instructions around the EOR) isn't protected against an VBL interrupt happening right in the middle of it. Perhaps this seems academic but if frame computation time is nearly 1/50 seconds or an integer multiple of it this could become a factor. Perhaps even the whole framebuffer swapping thing needs to be protected. I haven't really spent much thought on the whole thing yet. |
19 October 2022, 00:38 | #656 |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
odd but I thought interesting, ab3d2 (with the original game levels) only requires 512kb of chip ram + 4mb of fast to run (the first levels at least and in winuae), Karlos' mod (and maybe others) require 1mb chip ram + 4mb fast.
I may have to test this on real hardware using TUDE (a Degrader) at some point. I guess it is just using the chip ram as a frame buffer and to hold sound for paula? Last edited by abu_the_monkey; 19 October 2022 at 00:45. |
19 October 2022, 01:19 | #657 |
Registered User
Join Date: Oct 2020
Location: Bicester
Posts: 1,942
|
@Angus
here is a rebuild of the double buffer version I posted before but with the fps counter which can be enabled/disabled by pressing 'F8' if you feel like comparing it to previous builds Last edited by abu_the_monkey; 08 November 2022 at 23:56. |
20 October 2022, 10:56 | #658 |
Registered User
Join Date: Aug 2013
Location: Marseille / France
Posts: 1,418
|
Just tested the 2 versions (AB3D2 optimized and Karlos mod) on an A1200 with Blizzard 030/50Mhz and this is amazing. The game is now perfectly playable with this configuration, even in full screen with details lowered.
What a shame they didn't release it as such, it is really a nice old school FPS. Thanks everyone here for the great work (now waiting an WHD version to properly put it in my WHD games repertory ) |
20 October 2022, 21:59 | #659 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,135
|
I made the mistake of downloading project Osiris to remind myself of some of the great AB3D levels. And suddenly the time id set aside to actually test the latest build disappeared. The two may be connected.
|
20 October 2022, 22:06 | #660 | |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,135
|
Quote:
You can hear it here after I go through the teleporter. Though the audio capture is a bit screwed up... [ Show youtube player ] Last edited by Karlos; 21 October 2022 at 09:10. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Alien Breed 3D II The Killing Grounds RTG patch | Angus | Retrogaming General Discussion | 63 | 14 December 2022 15:20 |
Alien Breed & Alien Breed '92: SE - delay when picking up items / opening doors | Ian | support.WinUAE | 16 | 23 December 2016 15:50 |
Alien Breed 3D II : The Killing Grounds code booklet | alexh | support.Games | 19 | 10 October 2012 22:17 |
Alien Breed 3D 2 - The Killing Grounds | Ironclaw | support.Games | 12 | 13 September 2005 13:07 |
HD Version of Alien Breed I ? | Kintaro | request.Old Rare Games | 20 | 31 July 2003 10:48 |
|
|