Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411275 Posts in 69323 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 05:27:35 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Building A Releasable Game With Python?
Pages: [1]
Print
Author Topic: Building A Releasable Game With Python?  (Read 2030 times)
Kyle Preston
Level 2
**



View Profile WWW
« on: October 12, 2014, 10:25:41 AM »

So I'm mainly a musician/sound designer, I took about a years worth of programming (C++) courses before I graduated. Post graduation, I learned Python and played around a good long while with it building my own little projects (text adventure games, Hangman, stuff like that).

I wrote some music for a game that hasn't been made yet; I spent a short amount of time looking for a developer interested in working with me, but ultimately, decided that this is something I'm going to have to do on my own.  I'm trying to build a game based on the themes and narrative of the music and I really love the idea of starting with music first, then building a game rather than the other way around.

Anyway, I'm semi-fluent in Python, and I know that languages tend to have similar attributes (you say properties and methods, I say classes and objects), but I'm wondering if anyone has used (or knows how to use) Python to create a game that could potentially be released publicly (i.e. need only a browser to play). From what I understand, games made in Pygame can't really be put in a web browser, and after playing with Unity, it looks like I'd need to learn C# or JavaScript; for the sake of time, I'd rather not learn a whole new language if I can avoid it. Should I bite the bullet and learn JavaScript or is there some unity equivalent that plays nicely with Python?

Has anyone tried this with Panda 3D or Crystal Space?
« Last Edit: October 12, 2014, 10:34:44 AM by Kyle Preston » Logged

Photon
Level 4
****


View Profile
« Reply #1 on: October 12, 2014, 10:57:36 AM »

As someone who more or less came from Python, no, I don't believe there is any way to make a true web-based Python game.

That being said, I would recommend looking into Javascript and potentially Phaser if you are really looking to keep it simple. I haven't used either to make a "serious" game but Javascript is dynamically-typed just like Python and is similar in other ways ("this" in Javascript is like saying "self" in Python, for instance.) I also hear very good things about Phaser. The main things between Javascript and Python I'd bring up are (a) class definitions are slightly different, (b) you'll have to learn a little bit about HTML5 and using the canvas, and (c) you don't have "streamlined" inheritance (supposedly there's a way to do inheritance but I haven't looked into it much.)

So yeah, I'd give Javascript a go. I'd like to think you wouldn't have much trouble learning it if you are coming from Python. And here's a swiss-army knife resource for getting started.
Logged
nikki
Level 10
*****


View Profile
« Reply #2 on: October 12, 2014, 10:57:58 AM »

I personally don't think there is such a plugin (I found this though but's it's no pygame https://www.google.com/search?q=run+python+in+browser the top hit)

anyway transitioning from Python to Javascript (the lingua franca of the web ) might be easier if you'd use CoffeeScript, it borrows heavily from Python (and Ruby) and it's just JS in the end.

edit: and yes as your pygame for JS I would advise pixi.js, but actually Phaser (built on top of that) is even better!
Logged
RandyGaul
Level 1
*

~~~


View Profile WWW
« Reply #3 on: October 12, 2014, 11:44:09 AM »

You should definitely just learn JS. Used it before and liked it a lot! I don't think it's any more difficult to learn than Python at all; they're both pretty easy. I imagine you'd do well since you've already used a bit of two languages.
Logged
Kyle Preston
Level 2
**



View Profile WWW
« Reply #4 on: October 13, 2014, 05:39:05 PM »

Thank you kindly for the info.  I'm certainly going to give Phaser a peak under the hood, but I think ultimately, I'll probably just have to grow a pair and learn JS; Unity seems to be to good not to. 

Logged

Layl
Level 3
***

professional jerkface


View Profile WWW
« Reply #5 on: October 13, 2014, 10:01:25 PM »

In Unity, it's generally a good idea to use C#. In Phaser it might be an idea to look at TypeScript. I would suggest you to avoid w3schools though, they're often outdated and plain wrong. Mozilla has a nice documentation for javascript stuff. https://developer.mozilla.org/en-US/docs/Web
Logged
Dacke
Level 10
*****



View Profile
« Reply #6 on: October 14, 2014, 04:35:32 AM »

If you're going to develop for the web it's probably a good idea to have some basic understanding of JavaScript.

But you really don't need to write your games in it. In many cases web apps written in other languages that are transedcompiled to JS will run considerably faster and smoother than manually written JS. With JS you may have to manually optimize lots of stuff, but with a less flexible/confusing language the transcompiler will be able to create really fast JS using asm.js.

Here is an article that explains how they got the Unreal Engine 3 to run in browsers using asm.js
http://ejohn.org/blog/asmjs-javascript-compile-target/

Here is a list of languages that can be transcompiled to JS. Including 12 different Python->JS transcompilers of varying quality (not sure if any of them support pyGame, though).
https://github.com/jashkenas/coffeescript/wiki/List-of-languages-that-compile-to-JS

« Last Edit: October 14, 2014, 09:41:34 AM by Dacke » Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Dacke
Level 10
*****



View Profile
« Reply #7 on: October 15, 2014, 04:42:54 AM »

Humble Bundle is currently featuring games transcompiled to JS using asm.js in their Humble Mozilla Bundle.
https://www.humblebundle.com/
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Kyle Preston
Level 2
**



View Profile WWW
« Reply #8 on: October 15, 2014, 08:33:38 AM »

Thanks for the info Dacke; all good stuff and I hadn't considered asm.js (plays nice with Python too). The Humble Bundle is impressive; and now that I'm reading through the literature, I think I may me a bit in over my head here trying to do this with Python, which is why Unity is so appealing, as it seems to be a one-stop-shop approach to building a game.  For mediocre hobbyists like me, consolidation is very attractive.
Logged

Dacke
Level 10
*****



View Profile
« Reply #9 on: October 15, 2014, 10:29:10 AM »

The problem with Unity is that it's proprietary. Which means that you may end up with a game you can't even compile or run properly in the future (see: XNA, Flash, GM, Shockwave, etc.).

Personally I would try to find a good, free game framework and use that. Just not in JS, because that language is a mess. I'm considering libgdx for my next project since I'm a Java developer and it runs on Desktop/Android/BlackBerry/iOS/HTML5.
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Layl
Level 3
***

professional jerkface


View Profile WWW
« Reply #10 on: October 15, 2014, 11:13:03 PM »

Duality may be a good open source alternative to unity for 2D games. MonoGame picked up where XNA left off and works cross platform as well.
Logged
nikki
Level 10
*****


View Profile
« Reply #11 on: October 16, 2014, 02:08:49 AM »

I think Dackes proprietary point is a very strong one, especially when the goal is to build a browser game, The amount of hoops I have to jump to nowadays to get some old flash stuff updated is very frustrating and best avoided if you can.

I would however (and do) use JS for such cases (or well coffeescript mostly) nowadays.
for learning JS I'd start with crockford's recources http://javascript.crockford.com/ and watch  https://www.youtube.com/watch?v=hQVTIJBZook
then (atleast for me) using coffeescript has taught me many JS specifics and best practices.

and Phaser.js/pixi.js are very great for gamedev (pixi is a crazy fast renderer too) http://www.goodboydigital.com/pixijs/bunnymark/

as a programmer I occasionaly start using new languages, just because, at the moment I am looking into Elm and because of
Quote
to create a game that could potentially be released publicly (i.e. need only a browser to play)
It might actually be a good thing for you too (http://elm-lang.org/blog/announce/0.12.3.elm)
« Last Edit: October 16, 2014, 09:47:24 AM by nikki » Logged
Dacke
Level 10
*****



View Profile
« Reply #12 on: October 16, 2014, 01:04:09 PM »

I would however (and do) use JS for such cases (or well coffeescript mostly) nowadays.

My emphasis. Makes all the difference: cleaner, faster, better, stronger, transcompilier.
Logged

programming • free software
animal liberation • veganism
anarcho-communism • intersectionality • feminism
Cheezmeister
Level 3
***



View Profile
« Reply #13 on: October 16, 2014, 08:47:31 PM »

I really love the idea of starting with music first, then building a game rather than the other way around.

Hey, me too! I'm a professional code monkey, and I've been keen to collab with a musician on some kind of sonic delight. Drop me a mail with what you're hoping to accomplish, maybe we can help each other out.

On topic, I love CoffeeScript something fierce, but I think it's important to start with JS (it's a very simple language compared to Python, and CoffeeScript itself) so you know the pitfalls and gotchas, what coffee buys you and what it doesn't, and how to troubleshoot when (not if) funky stuff happens. Crawl before you walk and all that.
Logged

෴Me෴ @chzmstr | www.luchenlabs.com ቒMadeቓ RA | Nextris | Chromathud   ᙍMakingᙌCheezus II (Devlog)
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic