|
CircleOccludeMap | |
State = CircleOccludeMap(ThisMap, TheLevel, CircleX, CircleY, Radius) | |
Parameters: ThisMap = The Index of the map you wish to occlude TheLevel = The level within the map CircleX = The X coordinate of the circle CircleY = The Y coordinate of the circle Radius = The radius of the circle to occlude |
|
Returns: State = The status of occlusion function |
|
The CircleOccludeMap() function checks if a circular region is occluding the equivalent area within a map level. The CircleOccludeMap function will clear this area on the selected map level, this helps reduce the amount of overdraw your game is performing. So the map occlusion commands help us even out the amount of rendering time our game is doing each update. For example, If we imagine a game scene with 2 or more map layers, then normally we'd draw them all over each other, regardless of what is actually visible in screen. So with three layers we're potentially drawing every pixel on the screen three times. With modern hardware, this may not be such of big deal (assuming a medium screen resolution), but what if you want your games to run older systems, or you just want to squeeze every drop of rendering performance you can ? - Well, then it's worth seeing if we can cull out any of the redundant background drawing by removing anything in the background that's being occluded by foreground graphics. We could do this by previously calculating the hard regions of the foreground. These might be stored in list for example, then before rendering the back layers, we mask those layers with out hard foreground region, using some of the map occlusion commands. This is remove any blocks in those that layers that would have been being drawn, but never visible to the player. You could do the same thing with sprites too. It's really up to you. The key to occlusion, is that when we remove the hidden background elements, this area has to be covered with something solid in the foreground. It doesn't work if the foreground area is translucent, this breaks the illusion, as the player can see both the foreground and the missing background segment. However, we don't want to get too excited and try to implement too much occlusion, As with all optimizations, there's a fine line between getting meaningful rendering performance gain, and losing that potential gain by adding bunch of clunky calculations in their place. So remember, we're trying to remove work from our game, not add more to it. FACTS: * CircleOccludeMap will alter the level if any block is clearly within the bounds the commands region. It's up to the user to restore this (if required). See CopyLevel, CloneLevel |
|
Example Source: Download This Example
|
Related Info: | EllipseOccludeMap | QuadOccludeMap | RectOccludeMap | TriangleOccludeMap : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |