Posts: 6,419
Threads: 74
Joined: Mar 2002
Before your loop:
To plot a pixel:
Code:
POKE y%*320& + x%, colour%
After your loop:
Faster in compiled mode, but gives an error on the IDE is this:
Code:
POKE y%*320 + x%, colour%
(odd, but in EXE form integers seem to be unsigned sometimes
)
Posts: 3,616
Threads: 287
Joined: Jan 2003
Combination of double buffering and direct vid mem access should do it. Excellent. This game just might shape up.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Make a lookup table to avoid the mults and it will go faster:
Code:
SUB Put (bleh...)
STATIC init%, table&()
IF NOT init% THEN
DIM table&(199)
FOR i%=0 TO 199
table&(i%) = 320&*i%
NEXT
init%=-1
END IF
DEF SEG=&HA000
' Your PUT routine here
' ...
POKE table&(y%) + x%, c%
' ...
DEF SEG
END SUB
Posts: 3,279
Threads: 170
Joined: Nov 2003
[semi-offtopic]
Wow. Surprised I never thought of doing that. :o (lookup tables) Something like that might speed up Useless Sock even faster than it already is...
[/semi-offtopic]
I'd knock on wood, but my desk is particle board.
Posts: 3,288
Threads: 167
Joined: Nov 2001
Quote:Okay, I tried that IF thing of yours Nath. It's faster, but still not...fast. My main problem now is that you can kinda see it's being drawn. If I was using SCREEN 7,0,1,0 and PCOPYing, it would be fine. Is that what Double Bufferring does?
Btw all, about the high-speed PUT, sorry - I'm stuck with my own PutSprite routine.
Try SuperPut
It flips and clips and is faster than QB's PUT. Although you use PUT itself. :*). And yeah, transparency is supported.
If you don't want to use Supeput(I don't see why you won't) here's a mini scroller:
http://rel.betterwebber.com/junk.php?id=16
If you don't understand something just PM me. :*)
I would recommend you use SuperPut though. :*)
Here's also a preclipped-pokebased sprite routine:
http://rel.betterwebber.com/junk.php?id=4
Rel.Sprite SUB.
Posts: 2,020
Threads: 24
Joined: Jun 2002
Superput is a library in denial
There's actually several tricks to speed up pure qb programming... unrolling loops, etc. But libraries are so much easier and they involve soooo little work in comparison...
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Posts: 3,616
Threads: 287
Joined: Jan 2003
Rel: Ah, haven't I said it enough? I gotta use PutSprite, PJ's own little routine. However! It uses PSET, so I think that if I do two things:
1) Shrink the active screen area to be redrawn (from 30x18 to 12x10).
2) Replace PSET with the faster method.
I think it'll run just dandy.
But for now, I'm celebrating since I learned scrolling.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Posts: 3,288
Threads: 167
Joined: Nov 2001
Quote:Superput is a library in denial
There's actually several tricks to speed up pure qb programming... unrolling loops, etc. But libraries are so much easier and they involve soooo little work in comparison...
Heh. :*)
Zack: then Rel.Sprite might be of interest to you. It preclips and can handle offseting. It's still straight QB .:*)
Link above. :*)
Posts: 1,688
Threads: 119
Joined: Jun 2003
Zack, i high, highly recommend looking at relgfx, and minirpg. VERY useful.
also, i prefer this tut on db myself.
http://faq.qbasicnews.com/?blast=ZipsDou...ngTutorial
Jumping Jahoolipers!
Posts: 3,616
Threads: 287
Joined: Jan 2003
Back offffff, guys, about all these libs. :wink:
I did what I said I would do, and it works
perfectly. Expect enormous maps in Operation Pong.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.