Mail Archives: djgpp/1998/01/01/08:38:01
Dave Nugent wrote:
>
> Hello, can anyone tell me if they see a way to optimize this code at
> all.
> I am trying to write a scrolling style game. Nothing fancy.
> I have a large buffer set up around 1.2MB called screen_hold that holds
> the
> entire level (draw). I then copy 160 lines*320 bytes of this to a
> secondary
> buffer called screen where I will then add sprites to the background and
> blast to vga memory screen mode13. I am using 160 lines, because the
> bottom
> 40 lines will be used for a score bar & other info that will not always
> need
> to be redrawn constantly. I am just new to DJGPP and have been using
> Borland
> C++ v3.0 for DOS up til now, but figured I could really increase the
> speed
> with a 32 bit compiler, but with the code I am using, there is not much
> difference (speed wise) between the code generated by DJGPP and
> Borland's
> Turbo C++ 16bit code. Is there a way that would be faster? I'm trying
> to get speed similar to that in Jazz JackRabbit.. I can't think of a
> faster
> way than this in 32 bit!!
>
<...snip, code section...>
> I would appreciate any optimization suggestions, or any different
> approaches
> you may have.
>
> Thanks!
> Dave.
How about using those features of the vga card usually revered to as
Mode-X
or something like that... It will enable you to use hardware scrolling
and
more nifty thingies....
Setup a virtual screen, with an extra 2 sprites high and width, this
will
save you a LOT of moves.
You might also play with the XOR write mode, this mode enables you to do
some nifty tricks like transparants and saves you the -if zero dont plot
pixel check- so you can blast away 32bits per move. It does require some
pre-processing and palette tricks...
Use two virtual pages for double-buffering, dirty rectangles etc...
Hope I make some sence,..
Peter
- Raw text -