Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Could someone tell me what are my options for writing a game with perl, without downloading modules/3rd party code? I have written a short game with javascript and want to translate it into perlcode. Tx

Replies are listed 'Best First'.
Re: game programming
by hv (Prior) on Jun 17, 2023 at 13:51 UTC

    Well, your option is to write it in Perl. Without more information it is hard to be more specific than that.

    If it is a text-based game it may be perfectly practical to implement it in Perl without additional modules.

    If the game involves graphics, it is likely to be quite hard to implement it without additional modules - the Comprehensive Perl Archive Network ("CPAN") is a huge resource of useful libraries in all sorts of domains. And since perl is not running in the browser, you don't have the DOM and its capabilities available. However there is nothing magical about what is available on CPAN - in principle (given enough time) you could reimplement any functionality you need, it's just that most people would consider it wasted effort to replicate what's already been made available by others.

    Perhaps you could tell us more about what type of game it is, and what you hope to achieve by rewriting it in Perl, so we can provide a more useful response.

Re: game programming
by karlgoethebier (Abbot) on Jun 17, 2023 at 14:00 UTC
Re: game programming
by marto (Cardinal) on Jun 17, 2023 at 14:03 UTC

    Welcome, providing more information about the game you have would garner more helpful responses (How do I post a question effectively?). Perl can be easily extended by using modules, an example of what can be achieved is the cross platform classic Frozen_Bubble.

Re: game programming -- my games (updates)
by Discipulus (Canon) on Jun 20, 2023 at 08:19 UTC
Re: game programming
by Bod (Parson) on Jun 17, 2023 at 17:44 UTC
    without downloading modules/3rd party code

    I am curious why you might want to write Perl code without modules...
    Could you elaborate on this please?

      I don't want to use modules because i often have the feeling it was not i who wrote this program, but the one that wrote that module. So i don't use modules unless there is no other way . Furthermore i am afraid of spyware on my system.

        i am afraid of spyware on my system

        Every module on CPAN has the source code available for all to see.
        Whilst I do understand your spyware concerns, I do not think the Perl modules are going to be the likely source...

Re: game programming
by Anonymous Monk on Jun 17, 2023 at 14:08 UTC

    Thank you for answering. The game i have written is about a square that has to get to the other side while jumping over an approaching bullit and has to watch out not to bumb his head while doing so. I am looking for a way to write graphics onto the screen and refresh it at will. If i understand correctly this is not possible without help from others. In that case i think i will stick with javascript. Thank you.

      There's nothing wrong with sticking with JavaScript.

      But to be fair, JavaScript doesn't do it without help from others! A nice overview at JavaScript Graphics shows many alternatives, but in the end they all rely on capabilities provided by the browser.

      You can run Perl in a browser (the author of that thing is a regular writer here, too). You also can write a standalone program, but as the Perl core has no graphics features, you indeed need libraries (e.g. from CPAN) to take over that part. If I am not mistaken, you need extra libraries, too, if run your JavaScript game on e.g. Node.js instead of a browser.

A reply falls below the community's threshold of quality. You may see it by logging in.