Qbasicnews.com
November 12, 2019, 03:48:09 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 ... 8 9 [10]
  Print  
Author Topic: 100% QB game  (Read 44244 times)
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #135 on: February 04, 2005, 03:09:42 PM »

Quote from: "Z!re"
Use real SUBS/FUNCTIONS.

Works just fine, although it doesent really matter that much.


GOSUB stores 4 bytes on stack, performs a jump. That's two integer PUSHes and a JMP. RETURN retrieves those 4 bytes from stack, and then performs a jump. That's two integer POPs and a JMP. That takes time. If you paste the code directly, you save that time.

Real SUBs FUNCTIONs take even more time, as parameters also have to be pushed/popped into the stack.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Z!re
*/-\*
*****
Posts: 4599


« Reply #136 on: February 04, 2005, 08:31:39 PM »

I know, for time critical you should always unroll, and call as few procs as possible.

Longer code is a cosmetic thing, doesent really matter to the compiler (unless QB, which chokes ofcourse)
Logged
Nemesis
Forum Regular
**
Posts: 118



« Reply #137 on: February 06, 2005, 08:12:43 PM »

Well I decided to optimize my V13hCPY subroutine a bit.
Taking into consideration to what na_th_an suggested to increase
the speed of this routine, and still keeping the routine at a favorable size to save memory. So, it was slightly faster and only slightly larger so it worked out well. I also whipped up a similar V13hCPY routine to work as a PUT routine. This routine amazingly is as fast as a QB's PUT (X,Y), 0,OR (Called through the V13hPUT subroutine as "ANDXOR"....
Check out in my previous posts for the source code of the whole lib! (The new improved routines will be included with my newest edit of the post containing the source code!)

Cya,

Nemesis
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #138 on: February 07, 2005, 05:38:49 AM »

I don't understand why you say that changing the  GOSUBs by the actual routine replicated 1000 times takes more memory. It takes less: you are not pushing anything to the stack.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Nemesis
Forum Regular
**
Posts: 118



« Reply #139 on: February 07, 2005, 12:25:50 PM »

Quote
I don't understand why you say that changing the GOSUBs by the actual routine replicated 1000 times takes more memory. It takes less: you are not pushing anything to the stack.


na_th_an...

(More $pace) = (more memory), period!

Nemesis


P.s...

na_th_an, if you just track the logic of my routine then you might get a better understanding for my reasoning of not unrolling these frequently accessed routines.(Or just review my previous posts where I discussed my reasoning.) And also, what's the point in using subroutines, functions, No GOTO's  :lol: , basic structured coding ethics, etc... I might as well just use another language if
I'm not going to utilize some of the better ascpects of the language I'm using.
 [/quote]
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #140 on: February 07, 2005, 12:30:41 PM »

What you have to save is data memory, not code memory. You have plenty of such.

Anyways, it was just a hint to make your engine faster. You may take it or not.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Nemesis
Forum Regular
**
Posts: 118



« Reply #141 on: February 07, 2005, 12:56:41 PM »

Quote
Anyways, it was just a hint to make your engine faster. You may take it or not.


Heh, obviously you don't comprehend all that you read... J/K  :lol:

READ MY POSTS!!! I DID CONSIDER IT!
(Actually I reconsidered...(Sting space was more of an issue than speed in this case, but ultimately when reconsidered, I used both
mine and yours ideas... SEE THE CREDITS!)
See, I always code in a matter that will utilize the best optimizations where and when needed, so you can have many optimization options at times. When you take all these ptimizations and weigh their total benifits towards what your routines main goal is then you might end up doing something similar to what I did here.

Bye.

Nemesis
Logged
Spotted Cheetah
Ancient QBer
****
Posts: 400



WWW
« Reply #142 on: February 11, 2005, 08:14:29 PM »

WHOA! What happened here while i was away! Smiley

(Sorry, i can visit the Web only 2 times in a month...)

I will download these and take a look at it. Now i had not got enough time to read it: it is after midnight, and Internet is not cheap...

(I just had seen one from Nemesis: Chain4 256 color modes are completely different from usual 16 color modes. They need a really different technique)

So now only what i wrote in Notepad (based on what i had seen here 2 weeks ago...):


Quote

Nemesis:

You was really right with POKE. It was strange for me that i got at around
110FPS with it since i was given up SCREEN 13 in QB far away in the past
exactly because i could not write a fast POKE based pixel - plotter for it
(On the same computer on wich i tested now). But it is true too that my
HLine sub runs nearly two times faster in ideal situations so to fill large
areas (what is needed many times) it is much better to use my HLine instead
of anything else (If the programmer wants to clear a memory page, not the
screen itself).

Now i think the best solution is to merge our libraries, and create a long
integer based memory page on which pixel plotting goes with POKE, but
filling certain areas being wider than 20 pixels goes with my HLine sub.
It would be not easy to create a similar thing for LONGs to HLine, and due
to many calculations it might lose some speed: i can not say anything about
this since i did not try it yet. But if it can be well written i except at
about three to four times greater speed than usual POKE when clearing the
entire memory page (On the other hand just for clearing it not too much is
needed: just a FOR cycle what runs from the start to the end. But many
times some big solid shapes like rectangles are needed what is only
possible with building up from a similar algorithm to HLine).

To create a HLine for long integer array i has got some ideas already since
i wrote a sub what achieved the same for 16 color screens. I did that
because it really annoyed me that QB is so slow with that, so i tried to
outperform it by creating a sub what does not need to access the VGA ports:
instead it just drew on the currently set page so i could collect some
lines before sending them to the VGA in one cycle. I failed with it yet
since the drawing algorithm was much slower so the overall speed was around
the same as usual QB lines.
Logged

fter 60 million years a civilization will search for a meteorite destroying most of the living creatures around this age...

There must be a better future for the Cheetahs!

http://rcs.fateback.com/
Spotted Cheetah
Ancient QBer
****
Posts: 400



WWW
« Reply #143 on: February 12, 2005, 02:46:16 PM »

I red what you all wrote here: it is really true that pure QB SCREEN13 libraries are out of date as the whole thing. I always would like to program retro in real mode using C or sometimes assembler, but that would have not been understood by anybody... Or i simply would not be able to post and talk about or compete with those sources anywhere as nobody is really interested in them. So QBasic. Here i got annoyed that everyone programs in QB, but they actually use tons of ASM or other languages, and just merge the results with QB. This is why i like to write here: if QB, do it perfectly without messing with anything else! Smiley

SCREEN 13 library: my comcept was to write a small library what supports only the most important features of graphic. I think more is not really important since it would just waste the code space for most of the programmers who not really need the extended features. And usually who gets a lib not tries to cut it in parts when she or he not needs some, just gets annoyed if the program won't compile because of it's size. In my opinion "most important" is a pixel plotter, a screen clearer, a PUT routine supporting transparency, and a fast hline sub to build up filled rectangles or triangles for 3D from it. Of course this all on one, or more not visible pages which can be sent to the screen when drawing is finished on them.
Logged

fter 60 million years a civilization will search for a meteorite destroying most of the living creatures around this age...

There must be a better future for the Cheetahs!

http://rcs.fateback.com/
ThaMariuZ
Forum Regular
**
Posts: 105



WWW
« Reply #144 on: February 14, 2005, 08:13:07 PM »

heya,

hmm, since i'm finishing my ninjanight game at the moment i guess  it'd be a good opportunity to post the pure qb demo of the game here:

http://people.freenet.de/mariuz/junk/demo.rar

the complete game will also be mostly pure qb.

cheers
Logged

'm so lazy... no really.... i am the laziest programmer ever ... ever.
Spotted Cheetah
Ancient QBer
****
Posts: 400



WWW
« Reply #145 on: February 26, 2005, 05:06:40 AM »

If you were waiting for me, and for new ideas for Screen 13, sorry: it appeared that because of certain reasons i have no time to program in QBasic for a while. But i do not want to leave you and the challenge here with this: if you want, take a look at the QB screen modes topic in "QB in general" (It has some crappy name what i can not remember now). There ask Adigun (Our web page completely broke because of our only computer from which we could update it not works) for my newest program, and you will see the subject of a new competition Smiley

(I told this especially to Nemesis: you would certainly be interested)
Logged

fter 60 million years a civilization will search for a meteorite destroying most of the living creatures around this age...

There must be a better future for the Cheetahs!

http://rcs.fateback.com/
BastetFurry
Forum Regular
**
Posts: 136



WWW
« Reply #146 on: February 26, 2005, 06:41:25 AM »

Hmm... unrolling code...
Shouldnt the compiler do that for you?

So if i have a sub that is a one-liner, the compiler should put the one-liner in case of the CALL.
Ok, on today computers it dont matter, because most opcodes are executed parralel. So i can push something on the stack and at the same time set the CPU-ProgrammCounter to a new point in address space.
Logged

color=red]Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?" - Shodan, AI at Citadel Station orbiting Earth[/color]
Pages: 1 ... 8 9 [10]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!