English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Releases

 
 
Thread Tools
Old 05 October 2022, 02:17   #641
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
@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
abu_the_monkey is offline  
Old 05 October 2022, 10:47   #642
grond
Registered User

 
Join Date: Jun 2015
Location: Germany
Posts: 1,387
When did this double buffer sync problem start or has it been there all the time?
grond is offline  
Old 05 October 2022, 11:59   #643
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
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.
abu_the_monkey is offline  
Old 05 October 2022, 13:10   #644
Angus
Amiga Games Database
Angus's Avatar
 
Join Date: Jun 2006
Location: South West England
Posts: 909
(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)
Angus is offline  
Old 05 October 2022, 22:50   #645
Angus
Amiga Games Database
Angus's Avatar
 
Join Date: Jun 2006
Location: South West England
Posts: 909
Quote:
Originally Posted by Angus View Post
P.S. I will try to run the latest exe later today. (1200 060)
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.
Angus is offline  
Old 05 October 2022, 23:38   #646
pipper
Registered User

 
Join Date: Jul 2017
Location: San Jose
Posts: 491
Quote:
Originally Posted by grond View Post
When did this double buffer sync problem start or has it been there all the time?

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.
pipper is offline  
Old 06 October 2022, 10:01   #647
grond
Registered User

 
Join Date: Jun 2015
Location: Germany
Posts: 1,387
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.
grond is offline  
Old 06 October 2022, 11:03   #648
pipper
Registered User

 
Join Date: Jul 2017
Location: San Jose
Posts: 491
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…
pipper is offline  
Old 06 October 2022, 11:08   #649
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
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
                                *****************************
edit: missed a line out

Last edited by abu_the_monkey; 06 October 2022 at 12:23.
abu_the_monkey is offline  
Old 06 October 2022, 23:41   #650
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
Quote:
Originally Posted by Angus View Post
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.
check your PM's and the zone
abu_the_monkey is offline  
Old 10 October 2022, 01:26   #651
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
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.
abu_the_monkey is offline  
Old 13 October 2022, 00:07   #652
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
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
main game loop
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; 09 November 2022 at 00:56.
abu_the_monkey is offline  
Old 13 October 2022, 01:19   #653
Karlos
Registered User

 
Join Date: Aug 2022
Location: UK
Posts: 432
@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.
Karlos is offline  
Old 13 October 2022, 01:49   #654
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
@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.
abu_the_monkey is offline  
Old 13 October 2022, 10:17   #655
grond
Registered User

 
Join Date: Jun 2015
Location: Germany
Posts: 1,387
@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.
grond is offline  
Old 19 October 2022, 01:38   #656
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
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 01:45.
abu_the_monkey is offline  
Old 19 October 2022, 02:19   #657
abu_the_monkey
Registered User

 
Join Date: Oct 2020
Location: Bicester
Posts: 428
@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; 09 November 2022 at 00:56.
abu_the_monkey is offline  
Old 20 October 2022, 11:56   #658
sokolovic
Registered User

sokolovic's Avatar
 
Join Date: Aug 2013
Location: Marseille / France
Posts: 427
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 )
sokolovic is offline  
Old 20 October 2022, 22:59   #659
Karlos
Registered User

 
Join Date: Aug 2022
Location: UK
Posts: 432
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.
Karlos is offline  
Old 20 October 2022, 23:06   #660
Karlos
Registered User

 
Join Date: Aug 2022
Location: UK
Posts: 432
Quote:
Originally Posted by abu_the_monkey View Post
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?
The latest version of the mod takes advantage of pipper removing the restriction on the music .mod file. It has probably gone unnoticed that the original bass pulse transforms into the weird breaks I had before and then back. It was all done in OctaMED SS, rendered to disk, chopped back to samples that could be sequenced and then converted back to a mod. It's bigger than it was

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 10:10.
Karlos is offline  
 


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 62 07 July 2021 00:30
Alien Breed & Alien Breed '92: SE - delay when picking up items / opening doors Ian support.WinUAE 16 23 December 2016 16:50
Alien Breed 3D II : The Killing Grounds code booklet alexh support.Games 19 10 October 2012 23:17
Alien Breed 3D 2 - The Killing Grounds Ironclaw support.Games 12 13 September 2005 14:07
HD Version of Alien Breed I ? Kintaro request.Old Rare Games 20 31 July 2003 11:48

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Page generated in 0.15317 seconds with 16 queries