Python target WIP

Monkey Targets Forums/User Targets/Python target WIP

invaderJim(Posted 2012) [#1]
So I got REAL bored and started making a python target in hopes that I can make games for linux (Raspberry Pi :D:D )

It currently supports nearly all of the core features of the monkey language, I believe all that's left are interfaces and reflection in that regard. Math and String functions, lists, maps, etc are all good to go.

Mojo is coming soon, and after that, I intend to port the os module so that trans itself can be built in python.

You can download the target in its current state here: http://code.google.com/p/monkey-python/

You need Python 2.7 and pygame 1.9.1 ( http://www.pygame.org/download.shtml ) to execute the code.

Good luck!


NoOdle(Posted 2012) [#2]
Schweeeeet!!! Raspberry Pi is on my toys to buy list!


therevills(Posted 2012) [#3]
Cool!

With our BlitzMax(MonkeyMax) target we included the altered source files for trans, as trans (like Monkey) is public domain. Also you may want to include the new trans exe so people can quickly test your project.

And do you plan to check the source code into GoogleCode?

Well done!


invaderJim(Posted 2012) [#4]
Yeah, I wasn't sure if it was okay to distribute the executable. I will package it with it from now on.


invaderJim(Posted 2012) [#5]
Just updated the google code page with a new download with the following changes:

-Fixed a bug with For EachIn statements getting out of scope.
-Now includes trans_winnt.exe and modified trans source files.


invaderJim(Posted 2012) [#6]
We have images and text!




therevills(Posted 2012) [#7]
Cool! This is where it becomes fun :)


jondecker76(Posted 2012) [#8]
Awesome job!


invaderJim(Posted 2012) [#9]
Thanks! I'm taking a little breaky from this project as I prepare for Ludum Dare ( http://www.ludumdare.com/compo/ ) this weekend, but I'll be picking it up again next week.

@therevills
You're right. I'm right smack in the middle of the "fun" part. Mark's mojo example half-runs, and at 8 FPS. Got some work to do ;)


invaderJim(Posted 2012) [#10]
Made a little progress in the past couple days. Been focusing hard on mojotest and getting the Matrix functionality working.



As you can see, it's very nearly there :)

As for the rest of mojo, there are a few kinks in the Input portion to work out, and Audio has not been started yet.

I've checked the code into the google code page, so feel free to check it out :D

Also, I forgot to mention, along with Python 2.7, you need the latest version of pygame ( http://www.pygame.org/download.shtml ).


therevills(Posted 2012) [#11]
Looking good Jim :)

I've been having String slicing issues with MonkeyMax, in BlitzMax you can not slice a string backwards (eg test = test[..-4]), but this is valid for Monkey, so you may want to test that.

Also do you know if pygame handle shearing? Again with BlitzMax you cant do shearing without a lot of hacking of the BlitzMax source (which kind of defeats the purpose).


invaderJim(Posted 2012) [#12]
Thanks for the heads up on those two.

Luckily for me, Python does support string slicing in a very similar fashion.

test[..-4] is just test[0:-4]

Of course, I hadn't tried it out yet and it turns out there was a typo in my implementation, so thanks for helping to fix that :P Were you able to come up with a work-around?

Shearing hadn't even occurred to me, to be honest. Pygame does support textured polygons, which is promising, but you can't map the texture at all. It just scrolls and repeats. I may have to look into doing it on the SDL level... which means I'll be putting it at the bottom of my to-do list in hopes that people won't be clamoring for it.

Audio and optimization on the way! Gotta squeeze out every last fps.

Or perhaps I will do interfaces. People seem to like those.


Why0Why(Posted 2012) [#13]
Python is fun to play with. Love all of the community additions to Monkey!


invaderJim(Posted 2012) [#14]
Yeah, it is a fun language. Does a lot of the work for you.

And I just uploaded the latest version. Interfaces and Input are now supported, and also Challenger GUI!


mardrag(Posted 2012) [#15]
Great! This target has got great potential.
As pygame is ported to a lot of operating systems (including Nokia Symbian and Haiku/BeOS) monkey games could also run on a lot more platforms.

I'm really looking forward to this target getting more advanced.

LoadState / SaveState are not implemented yet?

When I try to assign a value to an array key, that will result in this error:
"TypeError: 'tuple' object does not support item assignment"
(I don't know what that means, I never programmed in python)


Richard Betson(Posted 2012) [#16]
Very Cool:)


Qcat(Posted 2012) [#17]
:D Very Cool


time-killer-games(Posted 2012) [#18]
EDIT: I compared this to the blitzmax target, and it turns out PYTHON is SO MUCH BETTER than monkeymax!!! First of all, my game requires hundreds of 640x480 images, which in the blitz target it runs my game's animations incredibly slow & has D3D Loading image errors, where as the python target runs SUPER FAST! :D AND NO GLITCHES!!!! Yay!

Keep up the AMAZING work! My game wouldn't have even been considererd playable if it wasn't for this target! *adding you to my game credits*


Nicholas Peanut(Posted 2012) [#19]
Hi what the status of this project ?
I've looked at the google code site and it seems very complete .

Is it ? Are there things missing ?
if so what?, else WOOOOWW !


invaderJim(Posted 2012) [#20]
Hi, where it's at on google code is pretty much where I left it. It's missing some matrix functionality, and sound, as well as some other things... I'd have to look at the code again to be sure.

The problem I ran into is that I was developing this target specifically for the Raspberry Pi, and once I received my Pi, I found even the most basic pygame applications to be unplayable, as the only available rendering option was CPU-accelerated, which is bad because the might of the Pi is in its GPU.

Since then I've been throwing around the idea of an OpenGLES-enabled Raspberry Pi target while also waiting for an improved target creation system in Monkey. So it's not likely that I will continue this project, but I can always be persuaded otherwise :P That said, anyone is more than welcome to take this code and run with it, if they so desire.

Bai!


Nicholas Peanut(Posted 2012) [#21]
Interresting, I just (3 weeks) found out about the Pi and am thinking of geting one shortly, I also just (2 months) started using python and I just got back into monkey after about a year (v29).

so i might start running with it shortly or contacting you here with questions.... or forgetting about it ;(


time-killer-games(Posted 2013) [#22]
By this afternoon after church I'm hoping to add full sound support to this target for those who have been waiting for it. Wish me luck! =]


Sensei(Posted 2013) [#23]
Is this target still being developed? It might be nice to have for running/compiling a monkey game on the Raspberry Pi :)


Soap(Posted 2013) [#24]
James L. / invaderJim moved to Unity so no. :(


Sensei(Posted 2013) [#25]
Well I guess in that case, there's no other way to target the Pi? I know it's linux, but being Arm based, I don't know any more how it could go from there.
I wonder if one installed the linux required build items like g++, openal, etc, if a compiled monkey linux app/game could be made to run on the Pi.

Hmm..


computercoder(Posted 2013) [#26]
You could do that or complete the Target. Its available for download to any that wants it :) of course you'd really have to know your stuff to finish it up :P