Tic-80: -- script: python?

Created on 26 Jun 2017  Â·  21Comments  Â·  Source: nesbox/TIC-80

How difficult would it be to add python scripting to TIC80? Thoughts:

  • Lua is clunky with classes, lists, and tables
  • Moonscript is obscure compared to python, hard to find bugs
  • Python is well known, and widely used.

In my opinion, tic80 is a nicer dev environment than pico8. Porting a popular language like python could attract some well deserved attention to the project.

Also, due to the complexity, maybe a financing campaign is in order?

https://docs.python.org/3/extending/embedding.html

Most helpful comment

Sorry for continuing this issue, but I'd still like python. I agree with the reasons above but I think it's a ton cleaner than JS. Just saying.

All 21 comments

This sounds like a completely different project.

I would consider this closed with the new Javascript version. JS solves all the problems I mentioned, and runs on the web. Great choice!

Sorry for continuing this issue, but I'd still like python. I agree with the reasons above but I think it's a ton cleaner than JS. Just saying.

Currently, TIC80 supports:

  • Lua
  • Moonscript
  • Javascript
  • Wren

I do love Python, and I work with it every single day, but Im not sure it would have a good performance on TIC80.
Also, Im not sure how easy it is to add to TIC80, or if it will even work, since TIC80 does not use threads.

I think main problem with python is that it comes with batteries included and will be really hard to strip it of libraries and keeping it usable (also it is potential security hole).

I see space for some lower level language like compiled C, for graphical experiments which needs better performance. Otherwise good game can be created just in Lua even with its peculiarities .

Would there be a way to piggy-back on a host OS's python instance? That'd be cool beans!

Not all OS have Python installed (Im looking at you Windows).
And, even if they have Python installed by default, it might not be the same version (some GNU/Linux distros have Python2.7 while others have python3+).

It wouldnt work for mobile versions, since most of them use sandboxes to run apps, which might block the app running Python (if the mobile OS has Python).

Finally, the WEB/HTML version would need to have a Python (wasm) or Brython available.

Sorry, python is not very web/phone app friendly. If someone wanted to make a standalone fork, that's great. However, I'm sure the dev isn't interested in putting the resources into it.

@ambyra oh, I beg to differ re: python. Regardless, I'm happy to fork this and give it a go.

I think the biggest obstacle you will face is that it is really hard to sandbox python. I think the probably best approach is to use rewriter from python to javascript and use existing functionality in TIC-80.
(something what moonscript does).

https://www.brython.info/index.html
https://transcrypt.org/

It seems like converting python to lua would be simpler and more direct.

It would be probably simpler, but I haven't found stable python to lua transpiler. Also would this approach be much better then using wren? Python without standard library is bit toothless.

I'm not quite sure why this is a question. I don't mean to be crass or rude, but here's example of what this request sounds like to me...

"Hey, I made a BASIC interpreter."
"Why can't I use PASCAL in it?"

or

"Welcome to the TACO SHOP, would you like to place an order?"
"Do you sell LASAGNA?"

Even fantasy computers need python...

On Thu, Mar 22, 2018 at 10:46 AM hseiken notifications@github.com wrote:

I'm not quite sure why this is a question. I don't mean to be crass or
rude, but here's example of what this request sounds like to me...

"Hey, I made a basic interpreter."
"Why can't I use PASCAL in it?"

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nesbox/TIC-80/issues/207#issuecomment-375376149, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACSSX0cGE1I-6YXt7c3jA9SdRRbVagAAks5tg9WAgaJpZM4OEySe
.

I'm not making a statement about language value. I'm sure every language is awesome in it's right environment. However, the project seems to have been intended to be a lua-machine. IIRC there IS a fantasy console that runs Python already. I don't remember it's name, but I'm sure with a little digging it can be found.

I found micropython and it is possible to embed it. It's stripped down python, but I think it could be still quite nice language for TIC-80. Moreover people learning programming could then use it even outside of TIC.

https://github.com/micropython/micropython/tree/master/examples/embedding

@nesbox wdyt?

The only problem is that it is not possible to compile micropython with emscripten - there are projects which do that, but their are not in trunk and there are still some issues with GC.

https://github.com/micropython/micropython/issues/3474
Apparently it adds 181 KB of compiled js. (much better than pypy.js or cpython).

What about NIM?
Nim can compile to Javascript...
We could provide some tools or guidelines for people to use NIM with TIC80.

They'd get a language that feels like Python, and the language output works on TIC80.

I've never heard of NIM. I will have to check it out. :-D

On Fri, Jun 8, 2018 at 2:27 PM Guilherme Medeiros notifications@github.com
wrote:

What about NIM?
Nim can compile to Javascript...
We could provide some tools or guidelines for people to use NIM with TIC80.

They'd get a language that feels like Python, and the language output
works on TIC80.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nesbox/TIC-80/issues/207#issuecomment-395880655, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACSSX6oJcY7Oc6mq1HR2MD69Tsb_pVv6ks5t6t4ggaJpZM4OEySe
.

Small example game for nim https://picheta.me/snake/
has 256KB of js and 168KB of minified js.
TIC-80 has 64KB code limit. I think this explains why nim cannot work through separate pipeline.

I'm considering trying Transcrypt which claims 20KB runtime in js.

Ooh NIM supports bare metal / mcu programming? :-D

On Fri, Jun 8, 2018 at 2:40 PM František Jahoda notifications@github.com
wrote:

Small example game for nim https://picheta.me/snake/
has 256KB of js and 168KB of minified js.
TIC-80 has 64KB code limit. I think this explains why nim cannot work
through separate pipeline.

I'm considering trying Transcrypt which claims 20KB runtime in js.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/nesbox/TIC-80/issues/207#issuecomment-395884073, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACSSX1UaqGGDQSv-PvzN4efcEcs6fVWHks5t6uFTgaJpZM4OEySe
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Terumoc picture Terumoc  Â·  6Comments

sssilver picture sssilver  Â·  3Comments

Spreit picture Spreit  Â·  4Comments

Skaruts picture Skaruts  Â·  5Comments

Kozova1 picture Kozova1  Â·  4Comments