I have 3 game libraries installed on my PC: pyglet, pygame and Panda3D.
I would like to create a 2D game and make it a web browser game so i can put it on facebook.
I know that Panda3D has a web-browser-plugin. Panda3D is for 3D games mainly.
Therefore, I'm asking, is it possible to play a pyglet or pygame game in a browser? If not, what Python library do you recommend?
Neither pyglet nor pygame will run in a browser. I wouldn't really recommend using Python at all if you target is a web browser. JavaScript (with HTML5 Canvas), Flash, or Java applets are is better suited for that environment.
If you're dedicated to the idea of using Python, there are a number of projects that can compile Python into JavaScript. There are some mentioned on the Python wiki. Here are a few:
Skulpt
Pyjamas
Pyjaco
You'll need to write your own graphics and audio systems, though, since none of those projects can convert the native code needed by pyglet and pygame into JavaScript.
It requires a bit of reprogramming, but i made a pygame library "port" to the browser/nodewebkit using Brython and GameJS. You can program using a version of pygame and python 3 in the browser. You can check it out at https://github.com/asherwunk/pygjs
An option is to use repl.it. It allows creating Python/PyGame scripts and multiplayer coding. When creating a new repl, select the Pygame template:
Example: repl.it/#Rabbid76/PyGame-TransparentShapes
Today, i'd recommand using pygbag https://pypi.org/project/pygbag/ from https://pygame-web.github.io. It uses the same principles from Panda3D webgl port ( not the old plugin) using Web Assembly for modern browsers.
I just found this website https://trinket.io/features/pygame that allows you to run pygame from this website! But it's extremely slow. It should work from your browser but it'll take forever to run it.
Related
How do I export Godot scene for web HTML?
I use Godot Engine v3.0.6. I have downloaded appropriate template and successfully exported scene, but when i try to browse it I receive error: WebGL 2 not available. How do i fix this? Is it possible to export scene with earlier version of WebGL, so it can run on most browsers and devices?
No, WebGL 2 is simply a requirement of the code the Godot Engine HTML5 export generates, as stated right at the start of the documentation. This is not something you can "fix".
Personally, I feel it's a bit early to use this technology for any mainstream projects, but that's very much a matter of opinion. As an alternative, Unity offers a similar WebAssembly-based pipeline, which has matured a bit more and offers WebGL. Or you could use actual web-based technology to develop for the web in stead of cross-compiling, which might or might not make sense given your project requirements.
I want to to play around with Actionscript, mostly to compare the language with Javascript (I'm interested in the type system). Is there a straightforward way to do that or do I need to also install Flash or something similar? I'd prefer something that works on Linux but Windows-only is fine too.
Basically, I want to know if there is something for Actionscript that is analogous to v8/NodeJS or Rhino for Javascript, where you can run JS scripts directly (using console.log for output) without having to use a browser, create an HTML page, etc.
There is an amazing online tool capable of compiling Actionscript 3.0, this will aid your investigation of the language!
http://wonderfl.net/
As3Eval also is a good tool. Play around with the demo to get a feel for it.
It's windows only, but download Java, then install FlashDevelop : http://www.flashdevelop.org/
It'll download the flex sdk and everything you'll need to get started.
You'll need flash player to see your tests, and normally the debug player (take the standalone), which you can download here: http://www.adobe.com/support/flash player/downloads.html
As #neil says, you can also use wonderfl to test directly online, though obviously the experience won't be the same as a full ide.
You should be able to develop on Linux directly if you want to install flash builder (eclipse) but it's not free
I have a webapp developed (game), based on HTML5 + CreateJS, but since Android lacks of standards, I've run into unsolvable issues for my webapp. That's why im recurring to PhoneGap.
Yet my confusion lies in the fact that I need to make this game into a phonegap app that runs on Android/iOS, using for each platform native specific stuff.
So, should I build 2 apps (one for each platform), all over again, or use the one I have and try to deploy it into different devices using phonegap?
The truth is I don't know how to approach this problem... can anyone help?
Best Regards.
Yes, you can use Cordova (PhoneGap) to create a cross platform mobile app. Basically, Cordova (PhoneGap is Adobe's version of Cordova) is an open source project that provides JavaScript API's for accessing native device functionality (like the Accelerometer or Camera.) Cordova also lets you package your app in the native application shell, so you put your app on the app store. Please see my other answer here about Cordova and hybrid apps: Beginning with Apache Cordova
If the game runs completely in HTML5, I think it would be easiest to just use that one codebase and integrate it with Cordova and then deploy to the various platforms - why rewrite the app twice if you don't need to?
However, if you are using native device functionality, you may need to develop your own Cordova/Phonegap plugins for use. This way, you can call regular Android/iOS code (Java or Objective-C code) that you write from your web app code with JavaScript. This might be more work, especially if you have never written in these languages.
Personally, since you already have a working HTML5 app, I'd just try to get it working with Cordova and see how it performs. If you really need some native specific stuff, then I'd try creating that "stuff" as a plugin. Rebuilding the app twice, once for Android and once for iOS seems like a pretty big waste of time to me.
The answer here is either yes or no.
Yes if you want to use some specific feature of the native code. For instance, iOS's default objects is beautiful itself, you can easily drag and drop it to build your application. However, it takes lots of time to rebuild for another platform. Specially, if you intend to create app/game for multiple platforms, it would be a nightmare.
HTML5 is much faster for you to approach several platforms. However, you can't get the best result on all platforms and all devices. I mean, it is really difficult to bring the max performance of the app on all devices. For this solution, I suggest HTML5 with some libraries such as LimeJS, Crafty, Impact, etc. or some tools such as Construct 2, etc. I used to use HTML5 with all those libraries but found out that Construct 2 is much better.
Instead of using phonegap, I recommend cocoonjs. Specially if your targets are iOS and Android platforms.
Hope that help.
Yeah, even the simplest game such as bubble buster would be difficult to make cross platform with different version of android webview and you need cross platform? I would suggest looking into something like Unity3D.
I have a little problem. I made an application which has to use the GTK Look and Feel. But the user will be able to launch the application from windows OS where this LaF doesn't exist...
Can anyone tell me whether it's possible to embed GTK LaF in my runnable jar and load it at runtime?
Thanks a lot!
Regards,
Paranoia25
You won't be able to properly run GTK look and feel on other OS (even if you succeed at extracting it from your OS standard java libraries) due to some native features usage. That is true for all native LaF's - windows/macos/GTK and some others.
I would suggest you to look into some cross-platform LaFs for Swing and use them instead of native one if you are going to create a good-looking cross-platform application based on Swing.
Redmond has a good idea occasionally:
The next-gen Windows will come with a new programming foundation, letting developers build native apps with the same techniques they use for Web applications. Microsoft calls this new variety "tailored apps."
There is always a steep learning curve for developing GUIs; each new toolkit you learn is different enough that it takes a lot of time and effort and frustration. Thus developing in HTML with CSS begins to look very appealing: it's much easier and much more portable; and with HTML 5 and CSS 3, it is very powerful.
Is there any support yet on Ubuntu (or even better, a cross-platform toolkit) for developing native applications that use HTML/CSS for the GUI? To minimize overhead, I do not want to start a full browser session. (That's not very good desktop integration.) I am particularly interested in answers for native JavaScript or Python 3, but any language would be alright (easier to learn a new language than a new GUI toolkit, in my book).
Edit: I have found this page, but have not had time to read it all or test it. It linked to Python XULRunner, but again I have no previous knowledge of it.
This was asked on Ask Ubuntu back in August of 2011.
In summary, the options are:
SeedKit
The JavaScript bindings for GNOME.
There are more options, but those are the two "big ones".
You can write native apps in HTML/CSS and Javascript using node-webkit, is an app runtime based on Chromium and node.js, you can use node.js modules into your apps. it's available on Linux, Mac OSX and Windows
I would like to add QtWebKit to the list. It's like SeedKit with better support.
I'm using it personally on a project where we have native (C++) code for the data layer, business logic and the presentation layer is done via HTML5 and heavy use of JavaScript. As far as I know Qt can be used with python as well so perhaps you could use it for all the business logic.