[casual_games] Game Authoring Language

brent at def-logic.com brent at def-logic.com
Mon Aug 15 17:46:55 EDT 2005


Bingo :)
That's one of the tricks I use to keep games running fast. Speed is a major
issue for webgame developers, and it pays to use all the tricks.

Another one that I use is this...
Instead of:

for(n=1;n<10;n++){
// stuff
}

I use:

var n=10;
do{
// stuff
}while(--n);

This can be up to twice as fast as the first method, since we are testing for
the truth of n rather than comparing it to another value.

Everyone probably knows that trick already, but I thought it was worth 
throwing
in. I'm interested in learning more speed tricks if anyone has any.

Cheers,
Brent.

Quoting James Baker - WDDG/Inferno <james at WDDG.com>:

>
>
> Did you ever run these tests using lookup tables for the sin/cos/tan
> functions?
> Using lookup tables has been an age old trick to avoiding the strain
> that these Math functions can add to the processor.
>
>
>
>> -----Original Message-----
>> From: casual_games-bounces at igda.org
>> [mailto:casual_games-bounces at igda.org] On Behalf Of Charles Parcell
>> Sent: Friday, August 12, 2005 10:59 PM
>> To: IGDA Casual Games SIG Mailing List
>> Subject: Re: [casual_games] Game Authoring Language
>>
>> Here is the Math test we did. These are the results from it
>> being run on machine. specs added for point of reference.
>>
>> My System Spec.
>> --------------
>> Windows XP Pro SP2
>> Dual 2.8 P4
>> 2 GB RAM
>>
>>
>> Flash 8
>> -----------
>> Fastest Speed = 141
>> Average = 144
>>
>> Director 10.1
>> -------------------
>> Fastest Speed = 42
>> Average = 43
>>
>> Speed increase of Director over Flash
>> ------------------------------
>> -------------------------
>> Fastest Speed = 336%
>> Average = 335%
>>
>>
>> Just for a clear understanding, I have added a complete copy of code.
>>
>>
>> Flash 8
>> ------------
>> // Frame 1 AS
>> doCalc();
>>
>> gotoAndPlay(1);
>>
>> function doCalc() {
>>        var t1:Number = getTimer();
>>        for (var i:Number = 0; i < 10000; i++) {
>>                Math.sqrt(i);
>>                Math.cos(0.01 * i);
>>                Math.sin(0.01 * i);
>>                Math.tan(0.01 * i);
>>                Math.pow(i,i);
>>        }
>>        trace( getTimer() - t1 );
>> }
>>
>>
>> Director 10.1
>> ----------------------
>> -- Frame 1 Lingo
>> on exitFrame me
>>  t1 = the milliseconds
>>  repeat with i = 0 to 10000
>>    x = sqrt(i)
>>    x = cos(0.01 * i)
>>    x = sin(0.01 * i)
>>    x = tan(0.01 * i)
>>    x = power(i, i)
>>  end repeat
>>  put the milliseconds - t1
>>  _movie.go(_movie.frame)
>> end
>> --------------------------------
>> --------------------------------
>>
>> Charles P.
>>
>>
>>
>> BRENT SILBY (def-logic) wrote:
>>
>> > Hi Charles,
>> > Is it possible to post the results of the test function? I'm
>> > interested in comparing its speed to Javascript. Just
>> insane curiosity
>> > :)
>> >
>> > I predict JS will be slower, yet sometimes it is
>> surprising. I've been
>> > able to run scripts with over 20 moving screen elements at
>> 50FPS, on a
>> > pretty average machine. Flash often seems to lag with that much
>> > movement. Of course, JS does not have anti-aliasing, so that would
>> > account for a lot of speed difference.
>> >
>> > I understand why people stick to Flash, but I really want to put JS
>> > out there. It is a lot more powerful than people give it
>> credit. And
>> > there is a certain "coolness" about being able to design games with
>> > nothing more than a text editor. But that's the geek in me
>> talking :)
>> >
>> > Cheers,
>> > Brent.
>> >
>> > /DEF-LOGIC
>> > VIDEOGAMES
>> > www.def-logic.com <http://www.def-logic.com>/
>> >
>> > >
>> > > Flash 8 test code
>> > > -----------------
>> > > class test {
>> > >       public function test () {
>> > >               var t1:Number = getTimer();
>> > >               var x:Boolean = true;
>> > >               for (var i:Number = 0; i < 50000; i++) {
>> > >                       x = this.testFunction(x);
>> > >                       if (x) {
>> > >                               x = x;
>> > >                       } else {
>> > >                               x = x;
>> > >                       }
>> > >               }
>> > >               trace ("result = " + (getTimer() - t1) );
>> > >       }
>> > >       public function testFunction (x:Boolean):Boolean {
>> > >               x = not x;
>> > >               return x
>> > >       }
>> > > }
>> > >
>> >
>> >-------------------------------------------------------------
>> ----------
>> >-
>> >
>> >_______________________________________________
>> >Casual_Games mailing list
>> >Casual_Games at igda.org
>> >http://seven.pairlist.net/mailman/listinfo/casual_games
>> >
>> >
>>
>> _______________________________________________
>> Casual_Games mailing list
>> Casual_Games at igda.org
>> http://seven.pairlist.net/mailman/listinfo/casual_games
>>
> _______________________________________________
> Casual_Games mailing list
> Casual_Games at igda.org
> http://seven.pairlist.net/mailman/listinfo/casual_games
>





More information about the Casual_Games mailing list