Holly - Multi Pass Map Rendering This is my demo of the Steve's Holly map rendering from way back in 2010. This was written on my classic Duron 800mhz system (currently 18years old) and shows four different approaches for drawing a scrolling alpha blended map on top of high resolution backdrop. The four methods come down to combination GPU and CPU rendering together, to improve the end through put of your program.
Unfortunately, as time has gone on and Windows shows less interest in support direct draw as do hardware vendors the approach today (Windows 10 era) chokes...
PlayBASIC Live - Running the Holly Map Opt's on 18YO Duron 800 (2021-03-28)
Related Links
Holly _ Platformer Adventure Demo (https://www.underwaredesign.com/forums/index.php?topic=3144.0)
Tutorial - A Crash Course In BASIC program Optimization (https://www.underwaredesign.com/forums/index.php?topic=2548.0)
Dirty Rectangles (Combined Video & Fx Rendering) (https://www.underwaredesign.com/forums/index.php?topic=3395.0)
Script - English Captions
hi
welcome back
what you're looking at is
a phone capturing my duron 800
system which is 18 years old
it's 2002 vintage it's pretty
underpowered
but what i found on this before i'm
having to recall this
with a phone i can't see with the screen
very well
i'll go with the pb test
i don't think the framing's very good
but we'll stick with it
i'll go up here to reopen and
it's the platform and test okay
i found this version of the plat steeps
platformer demo
but this one's running or laid out
to be more optimal for the this much
older system
so single core of course
not a lot of memory in this thing low
end gpu
i think i think this one has a geforce 2
in it there's some description
and that was a replacement for one that
blew up that's right yeah
i used this system for this was all the
first versions of pb were written on
this system
and then i switched across to the athlon
system
uh some point in the i don't know when
that was now
so this thing right here i want to go
back and see how
well we can make this run on a low end
system such as this
is the right version i think it is
it looks a bit distorted on the camera
but we'll put up with it
so we have blocks uh
and keyboard to scroll you can't see the
the display on the camera i don't think
no it's kind of frames per second rating
up the top corner it's got a few
different modes for the scrolling
so this is called standard and
it's taking 52 ticks or milliseconds to
render the frame
so we're getting nine frames per second
so we've got alpha blending foreground
blocks over a background picture
in 32-bit let's try the next mode this
is called single pass occlusion
with effects four rounds so we've
improved the frame rate straight away
we're in the mid to mid-20s now
we've got 45 ticks to render the frame
so we've got blending around these kind
of edges around here
look this feathering around here that's
all
blending i'll blend it there so we're
using a trick here
because the foreground is opaque this
section here is all opaque
we can just draw that without any
blending at all and i draw the edge
cases with blending which works out to
be much easier
on the processor this is method one
i've got a method two which is called
single pass occlusion with video map
foreground now we're a game where the
24 frames per second range
uh which i'm quite happy about actually
to be honest with you
this is with video map foreground now
we'll try the next mode
this is two pass occlusion about 26
frames per second
with 38 ticks now to render the frame
it does have vsync enabled so we are
losing some time there
it's quite good
uh two boss occlusion with matt fulgrant
that yeah we're approaching about 30
frames per second now
which is pretty good for 22 sorry 18
year old system
now most of the 2d games for this kind
of system here would have been
just purely lit face
so standard mode is 16 frames per second
go forward and compare
the the quickest one
we've doubled the frame rate pretty much
it's pretty cool i'm pretty happy with
that
let's try it with our v-sync enable
i'm not sure how this demo is set up to
be honest
drawing the screen to the background
no i don't think it is yeah that's right
so kind of screen mode that we're
running this in
settings uh screen
[Music]
well there you go we're running 1024 by
768
now on this system here
there are very few old 2d games that run
in that resolution
uh let's just try and play the screen
mode there a bit we'll try and drop it
to 30
16 bit
uh and just see what we get
the desktop of the system is a mess now
complete mess
okay so we've doubled the frame rate
by going a 16-bit frame buffer
we barely noticed the difference on
screen at all
this is mode 0 which is the slowest
method
single pass is now 43 frames per second
44 frames per second
the other single pass occlusion with
within
with video map four ram about the same
48 frames per second now
it's quite smooth and
2 pass occlusion with here
that's what that means i'm not quite
sure now i noticed
that um
the principal idea here is is to
pre-calc
what blocks you need to draw and how you
need to draw them
so mode four yeah i've got a nice
44 45 frames per second
it's pretty cool so what it's doing
is that it's actually it's bleeding the
background picture
in one asynchronous bleed it's using the
video hardware
to do that then the foreground here this
opaque section
inside the tiles this is just tiled and
drawn as video blocks as well
so if these tiles are too small that's a
bit of a clutch for the gpu but keeping
them with
decent size and a power of two helps but
these edges
that need alpha they're blended to the
background so
this this portion around here is drawn
to an effects buffer
blended with the effects buffer and then
copied to video memory
because that's starting 32-bit and
scaled down
we don't actually have any problem with
that
you would notice that the colored
limitations of 16 bit more
if you had you know a linear gradient
from one point to another
i don't know if this runs with if i
change the resolution
we'll soon find out let's have a look
if you just go back to 600
uh go to 960
960 is probably good compromise actually
if this monitor will support it i'm not
sure it does
there's your answer it doesn't so we
have no
there's no full screen exclusive uh
supported for this monitor so go back to
800 by 600 which is the default so we're
in 16 bit
800 by 600 uh
with foreground layer with alpha effect
with alpha blending on it anyway
yeah i think our uh i think our
loader is organized to work in uh
it expects the video frame to be
whatever was 1024 wide
so this was with no optimization at all
getting 35
frames per second on the 18 year old
system
just straight to the bleeding
a bit of messing around and now you've
got you know 60 frames per second
a single pass occlusion
about the same for for the second
variant
now for too fast occlusion you've got
frame rates in the
70s and 80s
now your rate will vary given the amount
of work that's included in the frame
stands to reason i would have thought
hmm
i don't know what version of pb we're
actually using i think it's
164 variant of some type anyway
so it's not as this is not as quick as
like a 164p for example
so there's probably some performance
laying on the table just through the
interpreter
itself
probably not a lot but some yeah
hmm that's pretty cool sorry you didn't
test
mode four
cool once you get
the blending effects off-screen you're
doing frame rates of almost 200 frames
per second but there's no
they're irrelevant because just timing
how fast
the blue can draw the background
there you go uh a bit of a trip to
memory lane
this example here was written in 2010.
i'm going to copy this now so i'll put
it on the
well put it i'll copy across to the
forum etc so you can have a
play with it yourself i don't know if i
release this or not i've no idea
not a clue i hope so
sometimes i mean to do those things but
don't get around to doing it
yeah which happens a lot happens way too
frequently unfortunately
but that's why i've got the system set
up at the moment i'm sort of copying
making sure i've got everything off this
machine
there's a whole bunch of files on here
that i think are
probably the only copies of those files
left
mostly things like you know downloads
from the forums that have now been
deleted
by because they're stored externally
but it means that those old threads
become useless because
all of a sudden some thread that's
talking about something you've just
searched for
has nothing in it
yeah the copy here just uses copyright
nothing special about that at all mouse
button
draw foreground over the background fill
in holes
oh that is interesting so i'll run that
again
and apparently if i hold the mouse
button down
it'll give us an indication of when
we're using the fill modes um
what what blocks are being
i'll just change the resolution back to
whatever it was
it's a bit of a massive system now it's
got stuff
everywhere so go back to 1024x768
in 16 bit
so over here go through one of these
block methods
there you go so if i hold down the right
mouse button
it shows the foreground blocks that are
currently being drawn opaque now if we
use it
we've used a smaller block size
we use two maps which is what what i
would probably do
and i would use two maps because these
blocks here
could really be blocks i think these are
i think the tiles are about 50 by 50 or
something
like like a weird size
so these blocks here could be you know
a nice even number like if they're 50
wide we make them 10 by 10
this would mean that this block here
could
we have much less fragments of it being
blended
and there would be more opportunity for
these background blocks here to be
just drawn opaque
yeah so all those methods have the same
limitation
same sorry effect in them
so we're not really even here we're
doing a lot of software blending
on this scene and we can improve this
by you know by altering
the block size which would actually help
them things like collision and storage
and
all those side side
sorry side effects as well
i not that it matters now really
but it's an interesting observation to
make in terms of optimization if you
want to draw maps efficiently
this is why we added some occlusion
functions into pv
for you to help you
if you've got multiple layers of blocks
and you want to clear out
backlash from being drawn you can use
the foreground occlusion to do that
anyway they'll have to do us thanks for
watching uh it's very late and i'll put
this together together quickly
uh in the morning or tomorrow at least
anyway
i'll get back to copying backing up the
files
so hopefully that was interesting i
don't know if it was or not
i hope you have a good time coding and
have fun for easter all that kind of
stuff and
we'll see you soon bye
Download
[plink]Download Holly Multi Pass Map Test (https://underwaredesign.com/requestfile.php?file=HollyMapTestAns9zjaglyphakd6fzz) [/plink]
hey kev
thanks for the demo. you used #include maps. i didn't use this, but i did have multi-pass method set up.
i originally had everything drawing to the video screen, which was super slow (fx blending to video screen).
then i learnt about fx memory (fx & afx images), then had everything draw to fx image (faster but solid tiles were drawn by cpu).
then i came across your demo on multi-pass (a mini platformer you made), then i made a multi-pass map too (divide fx to cpu and video to gpu, yay).
to run the holly demo: project2_5 on PB v1.65 , i needed to comment out line 694 in declare tab [seems it doesn't like ExitFunction there???].
*** to see multi-pass run game, then press F5 , then press 3 (above letters only) , then choose between pressing H , J , L.
it will display boxes around fx / video tiles for multi-pass.
also for some reason the game runs slower in normal mode, then runs faster when i press F5 where it displays text on screen ???
i may have to look into this. i will also check the newer version holly demo: project3_5 to see if it runs different, as this was a re-write.
Quotethanks for the demo. you used #include maps. i didn't use this, but i did have multi-pass method set up.
The map slib includes the Load/Save Map functions, I guess it was just dropped into your original code in order to save the map out and load into this.. not that i remember now
Quote
to run the holly demo: project2_5 on PB v1.65 , i needed to comment out line 694 in declare tab [seems it doesn't like ExitFunction there???].
*** to see multi-pass run game, then press F5 , then press 3 (above letters only) , then choose between pressing H , J , L.
That's a pretty old build, I think it ran without changes in the current editions. Which woold be C2 beta20 or whatever it was from a few weeks ago.
Quotealso for some reason the game runs slower in normal mode, then runs faster when i press F5 where it displays text on screen Huh
i may have to look into this. i will also check the newer version holly demo: project3_5 to see if it runs different, as this was a re-write.
This relies upon the GPU doing the bliting asynchronously, which just doesn't seem to be supported in Win10 and I guess Win8 as well... On my Win10 boxes, a pure FX scene runs quicker.
Porting it to g2D would get a better result for the adventurous