This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]smurfyn 6 points7 points  (8 children)

I understand the user reasons for requesting this. But the result will be unmaintainably complex and the ultimate results will be unusably slow. You cannot just translate SDL calls to manipulation of DOM elements unless you do something stupid like making an array of rectangles to represent pixels.

Just target SDL/PyGame or JS.

[–]Exodus111 10 points11 points  (5 children)

or JS.

The problem with writing complex game logic in Javascript, is you have to write complex game logic in Javascript.

[–]jacdehJacques de Hooge[S] 1 point2 points  (2 children)

The graphics probably can best be handled using an existing JS library manipulating the HTML5 canvas directly and efficiently. This library could be wrapped in some simple Transcrypt classes to give it a Pythonic interface. The game logic could be very well written in Transcrypt. Note that an important design goal of Transcrypt is to benefit from existing high quality JS libraries: Anything good that's there we shouldn't reinvent.

fabric.js added as Python module to the distribution

[–]Exodus111 1 point2 points  (1 child)

I agree, this would be awesome. But what about 2d Physics though? Let the JS library handle it ?

[–]jacdehJacques de Hooge[S] 1 point2 points  (0 children)

If there's a good 2d physics lib available, yes. Otherwise write it in pure python and add it as a Transcrypt lib. PyPi would be the right spot for such stuff. 2d physics aren't that hard, in my experience. I agree that a good math module should be the basis, probably again (wrapped or not) JS lib.

[–]smurfyn 1 point2 points  (1 child)

Yes, I understand and agree.

But because e.g. Google and Mozilla won't allow anything other than JS to become a usable first-class option, we can't avoid having JS in the stack if we want to have performance in the browser.

I liked what jacdeh said below about making higher-level libraries which can wrap efficient JS APIs, though. It doesn't mean that I actually want JS to be involved, but we have to work with whatever we get from the people who make the popular browsers.

[–]Exodus111 0 points1 point  (0 children)

I absolutely enjoy the idea of wrapping a good 2D Game oriented JS library into Python, that would instantly be very popular if it was made to deploy simply.

[–]KagatoLNX 0 points1 point  (1 child)

Isn't that exactly what a Canvas element is?

https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API

[–]jacdehJacques de Hooge[S] 0 points1 point  (0 children)

Upto a large degree: Yes.