Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xpm slow?




We have been fighting over this in private mail to save bandwidth.  I
just happened to write such a long article that I decided to post this
on the list.

Philip Brown writes:
>>>>>[From Niilo Neuvo]
>    step a)
>    	translate pixmaps into a 'local format'
>    step b)
>    	copy 'local format' with bcopy/memcpy to your 'huge' shm-pixmap
>    step c)
>    	run shm-x-command to show the 'huge' pixmap on screen
>
>You weren't paying attention. I already posted that to the list , before
>we started "conversing" :->

It is extremely difficult to remember who posted and what, with the
amount of traffic the list has been getting.

>    I have not tried this on a 1 bit display, but I have tried this on a 8
>    bit display.  Speed increase was noticeable.  Especially if you do
>    your own optimized (ignoring gc's) drawing operations (which is what
>    the bcopy/memcpy stuff was doing).
>    Do you have any figures to prove that you are correct?
>    
>
>I asked for figures in my post.
>
>SO anyways.. what exactly is your program doing, and what are you
>comparing it to (exactly)
>
>You actually have two version of the same progam, but one uses the SHM
>stuff, and one uses pixmaps diretly?

Yes.  #ifdefs to use shm or non shm approach.  So I had two binaries
and the only thing I was intrested in was the frame rate, when running
the client locally and the server on another machine.  This is what
crossfire seems to be heading towards.

It is a battlezone like game that I wrote 5 or 6 years ago for the sun
3/60's we had here.  Last year I fixed the game a bit and added shm
stuff for the double buffering instead of drawing into pixmaps and then
copying them. I also fixed the gameplay so much that it would require a
week or two of coding to get it working again :)

The speed increase was quite noticeable, we are talking about 4x here.
Some of the speedup does come from the fact that I use a customized
bresenham line drawing algorithm that slightly cheats instead of using
the standard Xlib calls (which wouldn't work for shm images anyhow).
And yes, the original version (non shm) does keep the pixmap in the
server, it does not send a 500x600 image over Xlib.

I presume we could do a similar thing to optimize pixmaps on
crossfire, especially if we use masks and things like that to make the
game look a lot better.  If not faster, at least just as fast as the
fonts, but with good colour and masked graphics.

I see no reason to use the shared memory on 1 bit displays.  The
amount of data to draw is so minimal.

++Anipa