Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Sprite animation with SDL_perl

by Mirage (Sexton)
on May 05, 2002 at 14:51 UTC ( [id://164134]=note: print w/replies, xml ) Need Help??


in reply to Re: Sprite animation with SDL_perl
in thread Sprite animation with SDL_perl

Well thanks, however, the module is able to tell me which parts of code take what time, but if you look at the code you may notice that besides from using oop, I also don't use threads, which may give some speed improvements. Mainly I wonder how these games were made in the old days, where cumputers were slow, and threads were unknown.

Replies are listed 'Best First'.
Re: Re: Re: Sprite animation with SDL_perl
by shotgunefx (Parson) on May 05, 2002 at 17:58 UTC
    How where they made in the old days?
    • Assembler
    • C
    • Look up tables for almost anything other than an addition or subtraction
    • Tweaked graphic modes so you code write to all 4 planes of a VGA card so you could write 4 pixels at a time for scaling and filling.
    • Everthing based on a a pow of 2.
    • Virtually all multiplications and divisions could then be bit-shifted instead of an actual multiplication.
    • If you needed more than int precision you used fixedpoint math.
    • 2D games usually used bit-masks so you could do cheap collision tests using bitwise operators.
    • Self modifying code to cut down on the codesize (usually less than 64K to work with)


    -Lee

    "To be civilized is to deny one's nature."
Re: Re: Re: Sprite animation with SDL_perl
by IlyaM (Parson) on May 05, 2002 at 15:51 UTC
    Threads cannot make program run faster unless your computer has more than one CPU because on systems with single CPU no matter if you use threads or not your program cannot force CPU to run faster. Carefuly written event based program can actually beat threads based program because they avoid system's overhead for using threads.

    Try to search google for 'Threads vs Events'. You may find some interesting reading on this topic.

    --
    Ilya Martynov (http://martynov.org/)

(jeffa) 3Re: Sprite animation with SDL_perl
by jeffa (Bishop) on May 05, 2002 at 17:09 UTC
    I haven't played with it yet myself, but Event might just be of some use to you.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://164134]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2024-04-18 23:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found