View Single Post
Old 14 December 2021, 14:44   #86
Daytona675x
Registered User
 
Daytona675x's Avatar
 
Join Date: Apr 2021
Location: Germany
Posts: 97
Smile

@Havie
Sure thing

@all
New wip video #23 (occlusion detection visualized)

https://www.youtube.com/playlist?lis...yr1OhOssiA0axW

This video visualizes one of the game's internal optimizations when drawing the players.
The players are of course blitter objects. You can configure the Amiga's blitter in various modes, some being more costly than others in terms of performance.

Here in this game you can often get away with a very cheap simple copy operation. Unfortunately there are also situations where you can't: if a player partially occludes at least one other player or the ball, then a masked copy which preserves the background has to be used.

So some sort of occlusion detection would do the trick. Because the blitter always operates on 16bit words and because all the objects are already sorted from top to bottom this can easily be achieved with just a handful lines of code and a bit of bit-fiddling, at practically no cost with perfect results

Here in this video the players which are drawn using the cheap copy are drawn sort-of inverted. You can easily see how the blitter works on 16 pixel boundaries and how it needs an extra word depending on whether an object's actual picture ends up between two 16-pixel blocks on the display. When an overlap is detected the respective object in front is being drawn with "transparency".

As you can see this is highly efficient. In a typical game situation most of the players can be drawn using the cheap straight copy mode. Among other optimizations this buys me enough frame time to always keep 50 frames per second while not sacrificing visual quality.

Cheers,
Daytona675x
Attached Thumbnails
Click image for larger version

Name:	Image1.jpg
Views:	153
Size:	265.9 KB
ID:	74084  
Daytona675x is offline  
 
Page generated in 0.05007 seconds with 12 queries