----------  Forwarded Message  ----------

Subject: Re: Writing 3D games with Perl...  How's the Performance?
Date: Friday 24 December 2010, 12:43:11
From: Shlomi Fish <shlo...@iglu.org.il>
To: beginners@perl.org
CC: "U.N." <blahbleh...@hotmail.com>

Hi U.N./J/whatever,

a few corrections about what you said.

On Friday 24 December 2010 03:56:50 U.N. wrote:
> Hi folks.  I'm a Perl n00b, and I have a long ways to go yet.
> However, I was hoping someone looking down from the top could share
> some wisdom with me about the viability of Perl for 3D worlds.
> Obviously I'm not looking for someone to tell me *how* to do this, I'm
> just asking how good the result typically is. I've seen references to
> SDL and OpenGL modules in Perl, so I bet it is safe to assume that
> Perl can do graphics at the same level as other languages.

Not sure, perl 5 is much slower than C or C++ (for example), and sometimes 
games need to be faster than what perl 5 can do. Sometimes it will be good 
enough, though.

You are right that there are bindings for SDL and for OpenGL for Perl:

http://search.cpan.org/dist/SDL/

You may wish to look at the demos over there and on github.

> I
> understand that the key will be performance (interpreted vs. compiled
> programs).

Perl 5 is not purely interpreted - it is a P-code language:

http://en.wikipedia.org/wiki/P-code_machine

> 
> Something that gives me hope is a great game in Beta right now called
> Minecraft, which is a 3D mining/construction game written in Java.
> I'm not looking to clone Minecraft, but I have a lot of game ideas
> that would have similar elements- namely open-ended 3D physics
> sandboxes with medium graphics and simple devices that can be
> interconnected in complex ways to build working stuff.  No I'm not
> talking about FPS games or anything with intense fast-moving
> graphics.  Yes I know that there are about 50 languages that someone
> would pick before Perl to do this, but why not?
> 
> I realize that comparing Java and Perl is like comparing Apples and
> Oranges, but since they are both interpreted I would guess that they
> both share a similar performance handicap.

Jave is also not interpreted. Like Perl it is compiled to bytecode, but unlike 
Perl, this bytecode can be executed directly from the disk (e.g: its .class 
files), and, furthermore, many Java implementation contain an additional 
optimisation step called Just-in-time compilation (JIT):

http://en.wikipedia.org/wiki/Just-in-time_compilation

This improves the performance considerably, and as a result, Java code tends 
to run much faster than the equivalent Perl one. (Though many people feel Java 
has other performance issues such as being "sluggish", where Perl fares 
better.).

> 
> Anyways...  Has anyone ever done something similar or close to 3D
> environments with Perl on modern x86 hardware?  2D environments with
> lots of complex elements in constant interaction?

Well, you should ask that on the #sdl channel on irc.perl.org. The SDL guys 
created some games and demos to demonstrate Perl/SDL.

Regards,

        Shlomi Fish

> 
> Thanks and bacon planks.
> 
> -J

-- 
Shlomi Fish

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to