[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Game Logic

Chris Purnell wrote:

> > No, I agree with you. I just wanted to speak my mind of something that
> > was annoying me recently, as I am seeing more and more scripting
> > languages embedded in games, even performance sensitive FPS like Quake3,
> > and many of them using the known to be slower (by scientists) virtual
> > machine approach of simulating a hardware machine with software, where
> > the approach of directed graph of "chunky" execution nodes is much
> > faster. Just look at how fast Perl is compared to Java (even the recent
> > JIT compilers can only get so close to Perl).
> It's the number of node executions needed to get the job done that's
> important for speed.  How you've arranged them, tree or list, is much
> less important.  A virtual machine executing from an array of high
> level instructions is going to be faster than something walking a
> directed graph of low level instructions.

Yes, of course! I was mixing things together when I shouldn't have.

Higher level instructions is good for execution speed, period.

A directed graph is good for runtime optimization. The same thing can be
done with an array of instructions, just slower (moving blocks of
instructions around instead of just changing pointers).

Also, higher level instructions generally have a greater chance of
having complex parameters (Pentium instruction is high level enough for
that!), so this is longer to decode, and when optimizing you have to
find out the length of all the instructions before doing the (expensive
by itself) move. A directed graph executor benefits a lot from having
same-sized nodes, but it can shove a pointer to additionnal parameter
information without copying stuff around or being variable-sized itself.

One advantage of lower level instructions by the way, is that they
usually run in more predictable times (a sort operator given a very long
array could take a *very* long time), so if your scripting engine is
synchronous to the rest of the game, they are safer.

"Unix is the worst operating system; except for all others."
 -- Berry Kercheval

To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: linuxgames-help@sunsite.auc.dk