Jump to content


Photo

Gmpython - Extend Your Game With Python.


  • Please log in to reply
27 replies to this topic

#1 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 21 November 2009 - 05:58 AM

gmPython



gmPython allows you to use the Python language to extend your game. It supports registering GML scripts within the loaded Python files, calling Python functions inside the file you load and it pre-loads all of Game Maker's drawing functions. Best of all, it allows you to use the extensive Python libraries that are available (you will need Python 2.6 installed to use the libraries and before distribution you will need to copy those that you use to your games directory, or a subdirectory of that so that they are available on the player's machine).

Features:
  • Call GML scripts from Python
  • Call Python functions from Game Maker
  • Game Maker's drawing functions are preloaded
  • Load multiple Python files
  • You can now use Python libraries in your game (such as wxWidgets if you want)
Usage:
I will get around to writing some documentation here, but the example GM file and example Python file in the download shows and uses all available functions. The following additional modules are available for usage:
gmapi - Game Maker's drawing functions are loaded into this. Simply call gmapi.draw_circle(x,y,r,outline) to use the draw_circle function, etc..
gameapi - Provides access to a class which provides access to in-game scripts. Use:
myGameAPI = gameapi.GameAPI();
myGameAPI.show_my_message(42,"The meaning of life.");
Notes:
This DLL was created for my own usage, therefore, I won't be adding additional features unless I need them for my own game. I'm providing it purely so that you can take advantage of Python too.

License:
No credit required in freeware games, credit required ("Roket Enterprises") if for commercial use. No royalties required for commercial usage.

Download:
Version 1.1 (Example, Merge GMK & No Source - 2.3MB)
Version 1.1 (Example, Merge GMK & Source - 2.5MB)

Edited by Hach-Que, 01 October 2010 - 01:23 PM.

  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#2 Faltzer

Faltzer

    GMC Member

  • New Member
  • 144 posts

Posted 21 November 2009 - 03:03 PM

I've been waiting for something like this for a while now. Great to see that you've taken the initiative. Although I no longer use Game Maker, this is probably one of the reasons why I'll most likely end up using it, namely because this means wxPython can be used along with this. 8)
  • 0

#3 hanson

hanson

    GMC Member

  • GMC Member
  • 444 posts
  • Version:GM8

Posted 21 November 2009 - 03:09 PM

Nice! Thanks for letting us use it too :whistle:
  • 0

#4 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 22 November 2009 - 08:44 AM

UPDATE: Added a GM7 Extension (however it doesn't contain the example, so you still need to download the first ZIP file if you want that).

EDIT: It appears that I can't get the DLL working reliably when the game isn't being run through the VC++ debugger. This is going to be tricky...

Edited by Hach-Que, 22 November 2009 - 10:37 AM.

  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#5 Sven

Sven

    GMC Member

  • GMC Member
  • 621 posts
  • Version:GM:Studio

Posted 22 November 2009 - 09:06 AM

Nice Work. I am very interested to try this. :D
I also think Yourself would be somewhat pleased.
  • 0
I have a blog/site http://svenkle.com/

#6 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 22 November 2009 - 10:43 AM

Nice Work. I am very interested to try this. :P
I also think Yourself would be somewhat pleased.


Heh.. maybe Yourself could look through my code, because it's misbehaving when built in Release mode :D
  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#7 Snake_PL

Snake_PL

    GMC Member

  • New Member
  • 57 posts

Posted 22 November 2009 - 03:08 PM

Hmm... maybe that's GMAPI's fault. Try this:
- Go to the GmapiResources.cpp file in GMAPI's sources
- Change in the script_execute, execute_string and execute_file functions those lines:
GMVALUE* argument = new GMVALUE[aArgCount + 1];
ZeroMemory( argument, sizeof( GMVALUE ) * (aArgCount + 1) );
to:
GMVALUE* argument = new GMVALUE[aArgCount + 2];
ZeroMemory( argument, sizeof( GMVALUE ) * (aArgCount + 2) );
- Rebuild the library with all project configurations (batch build)
- Rebuild your dll.

Hope that helps.
  • 0

http://sgames.ovh.org/ - my blog (Polish)

Game Maker projects:
- GMAPI - C++ library for DLL developers that directly accesses various game resources
- GMThreads - Library for Game Maker that allows you to execute GML code in a thread
- Game Protector [PL] - Protects games made in GM5/6.1/7.0 from decompiler
- GM Extractor [PL] - Dumps resources embedded in Game Maker project file to a selected directory
Other projects:
- MemExtractor [PL] - Extracts various resources from the process memory
- OllyDataInterpret [PL] - A plugin for OllyDbg 1.10 that shows different interpretations of selected data in a seperate window.


#8 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 23 November 2009 - 03:20 AM

Hmm... maybe that's GMAPI's fault. Try this:
- Go to the GmapiResources.cpp file in GMAPI's sources
- Change in the script_execute, execute_string and execute_file functions those lines:

GMVALUE* argument = new GMVALUE[aArgCount + 1];
ZeroMemory( argument, sizeof( GMVALUE ) * (aArgCount + 1) );
to:
GMVALUE* argument = new GMVALUE[aArgCount + 2];
ZeroMemory( argument, sizeof( GMVALUE ) * (aArgCount + 2) );
- Rebuild the library with all project configurations (batch build)
- Rebuild your dll.

Hope that helps.


I doubt it would be GMAPI's fault, though I am trying that now. In Release build, VC++ is still nice enough to tell me the line it's crashing on, but it doesn't tell me the value of the variable. Maybe you could help work out why it's doing this? It crashes on line 117 of gmPythonCustomGameAPI.h (return _apicallfunc).

EDIT: Apparently that did fix it. I'll get a new version with the fix uploaded shortly.

EDIT 2: Hmm.. apparently gmPython doesn't want to work from a GEX...

UPDATE: Version 1.1 released. No GEX available since it doesn't want to work in that format, instead there is a GMK that you can merge into your game.

Edited by Hach-Que, 23 November 2009 - 04:02 AM.

  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#9 fire_soul453

fire_soul453

    aarons video games

  • GMC Member
  • 542 posts

Posted 26 December 2009 - 04:10 AM

I love this but no matter how I change the directory it still won't work unless the DLL is in the alternative location and the working directory. (Oh and thanks for taking the time to release this)

I am changing global._gmPython_dll=(working_directory+"\DATA\gmPython.dll");
Now the dlls need to be in that folder AND the working directory (default location) or it returns


ERROR in
action number 1
of Create Event
for object object0:

Error defining an external function.

Anyone know how to fix this?

Edited by fire_soul453, 29 December 2009 - 07:31 AM.

  • 0
Game maker Top sites
I'm sick of paypal. From now on I'm not buying indie games unless I can use something else...

#10 Rusky

Rusky

    GMC Member

  • GMC Member
  • 2492 posts
  • Version:Unknown

Posted 10 January 2010 - 02:18 AM

Just find that call to external_define and make sure it's using the right DLL. Make sure its using global._gmPython_dll and that it gets set to your value before external_define.
  • 0

#11 top hunter7

top hunter7

    GMC Member

  • New Member
  • 1043 posts

Posted 14 January 2011 - 09:24 PM

I know I'm reviving an old topic but does anyone have the files for this DLL?
  • 0

Posted Image


#12 Razon

Razon

    GMC Member

  • GMC Member
  • 268 posts
  • Version:GM:Studio

Posted 17 January 2011 - 06:51 PM

No Source 1.1
http://www.mediafire...duzziiik6a86802

With Source 1.1
http://www.mediafire...98478jy239kddul

Edited by Razon, 17 January 2011 - 06:52 PM.

  • 2

#13 Primoz128

Primoz128

    GMC Member

  • GMC Member
  • 323 posts
  • Version:GM:Studio

Posted 17 January 2011 - 10:29 PM

I really want someone to work on this DLL so it can become an extreme extension of game maker.
  • 0

Looking for a coding partner for my space RTS solar conquest project. More information: http://gmc.yoyogames...opic=563123&hl=


#14 Mode7

Mode7

    GMC Member

  • GMC Member
  • 66 posts
  • Version:GM8.1

Posted 20 January 2011 - 11:30 AM

@Razon: Thank you *very* much for the upload. I know that the RocketGames site went down, with the owner posting that he would not recover the files (Edit: Unless you are the original owner). Essentially, I feared the DLL would be lost.
I can get the source now and work on it a bit..

Edited by Mode7, 21 January 2011 - 05:23 AM.

  • 0

#15 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 20 January 2011 - 11:50 AM

@Razon: Thank you *very* much for the upload. I know that the RocketGames site went down, with the owner posting that he would not recover the files. Essentially, I feared the DLL would be lost.
I can get the source now and work on it a bit..

Incorrect; if the file was hosted on RoketGames, and you're the owner, I'll provide them to you.

Alternatively, if the file was owned by me, I'm happy to send it via email (or alternatively I'll upload it to my server to make the links work again), but you do actually need to request me to do it since, let's face it, this is a project which is no longer actively maintained and over a year old.
  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#16 Mode7

Mode7

    GMC Member

  • GMC Member
  • 66 posts
  • Version:GM8.1

Posted 21 January 2011 - 12:45 AM

Essentially this means that as of today, weblinks, game downloads and any kind of content that was uploaded to RoketGames will no longer be accessible. Essentially the domain will serve as a static page with a closure notice, and in the future, possibly a redirect, but we’ll see how that goes.

If anyone needs access or copies of files that they uploaded, you can contact me on my jrhodes@redpointsoftware.com.au email address and I’ll arrange to have them attached in the return email address. Understandably this process might take a few days.

This is from your site.
I am obviously not the owner of the file(s), and was simply seeking to obtain a copy.
A few weeks ago, I PMed you asking for a copy of Gmpython. You said that you would have the server up again within a few weeks, having to finish auditing all of the files to make sure none were compromised, and that there was no alternative link available for Gmpython.
So, coming back a few weeks later, I checked the links at the top of this topic, noting the new site, and the above post. With that in mind, I have come to the assumption that unless somebody else had a copy of the library, I would be unable to receive a copy.. Luckily, when scrolling to the bottom of the topic, I see that somebody has just mirrored it.
Anyhow, I have a copy, so thanks to Razon, and to you if you are indeed the owner/creator (Seeing as your name is in the readme)

Edited by Mode7, 21 January 2011 - 12:49 AM.

  • 0

#17 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 21 January 2011 - 03:29 AM

Essentially this means that as of today, weblinks, game downloads and any kind of content that was uploaded to RoketGames will no longer be accessible. Essentially the domain will serve as a static page with a closure notice, and in the future, possibly a redirect, but we'll see how that goes.

If anyone needs access or copies of files that they uploaded, you can contact me on my jrhodes@redpointsoftware.com.au email address and I'll arrange to have them attached in the return email address. Understandably this process might take a few days.

This is from your site.
I am obviously not the owner of the file(s), and was simply seeking to obtain a copy.
A few weeks ago, I PMed you asking for a copy of Gmpython. You said that you would have the server up again within a few weeks, having to finish auditing all of the files to make sure none were compromised, and that there was no alternative link available for Gmpython.
So, coming back a few weeks later, I checked the links at the top of this topic, noting the new site, and the above post. With that in mind, I have come to the assumption that unless somebody else had a copy of the library, I would be unable to receive a copy.. Luckily, when scrolling to the bottom of the topic, I see that somebody has just mirrored it.
Anyhow, I have a copy, so thanks to Razon, and to you if you are indeed the owner/creator (Seeing as your name is in the readme)

You didn't make it clear in your original email that the file you were seeking was located on RoketGames. I was replying under the assumption that the file you sought was located on the main site, mainly because RoketGames has been officially closed for well over 8 months now.

If you're seeking a file that used to be on the main site, you can contact me and I'll restore it (because the main site is still in operation and I'll ensure that links will still work on it). If you're seeking a file that used to be on RoketGames and you're the owner, I'll provide you a copy of the file. Otherwise you need to contact the owner so that they can ask me to give them the file, and then they can upload it elsewhere.

As stated in the original topic however, this was a DLL for my own uses; I'm not interested in re-uploading a DLL which I not only no longer have, but no longer have a need for. But to claim that this somehow means that I don't restore links under any circumstances or the very least the circumstances in which I stated I will restore links, is misleading and false.

Edited by Hach-Que, 21 January 2011 - 03:30 AM.

  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#18 Mode7

Mode7

    GMC Member

  • GMC Member
  • 66 posts
  • Version:GM8.1

Posted 21 January 2011 - 03:58 AM

Sigh..
I was highly under the impression that you were the owner of Gmpython, thus I contacted you seeking a copy.
I don't care for the circumstances of the site. You have stated that you will restore data only to the owners of said data, and considering that I AM NOT THE OWNER, AND I CONTACTED THE OWNER, I had absolutely no choice in the matter, because I did not receive the file when contacting the owner (YOU).
I was not aware of the total situation regarding the site, or any of it's subsidiaries. When I contacted you, I assumed that you would be aware of the location of Gmpython, seeing as you are the creator and the original poster. It's not exactly my responsibility to know the total situation regarding the hosting situation in the background. I just was asking if you still possessed Gmpython or stored it elsewhere.
Regardless, I am uninterested in continuing this exchange, as I have done nothing wrong in seeking the file, and it does not belong in this topic.

If.. you are only speaking of the specific statement in my original post, in which I stated the owner of the site would not restore any links, then I apologize for that. Seeing as you have stated that you would repost links by request of the owner. Anyone who reads my comment should understand the true situation with the slightest research, but again, I apologize for the mis-portrayal. It was a simple mistake.

Edited by Mode7, 21 January 2011 - 04:00 AM.

  • 0

#19 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 21 January 2011 - 04:41 AM

If.. you are only speaking of the specific statement in my original post, in which I stated the owner of the site would not restore any links, then I apologize for that. Seeing as you have stated that you would repost links by request of the owner. Anyone who reads my comment should understand the true situation with the slightest research, but again, I apologize for the mis-portrayal. It was a simple mistake.

Yes, my only issue was with the original post which implied that no links would be restored. I wanted to ensure that people understood that data will be provided at the owner's request and not be mislead into thinking that their data was permanently inaccessible (and I'm sure everyone can understand my concern with that).
  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#20 Mode7

Mode7

    GMC Member

  • GMC Member
  • 66 posts
  • Version:GM8.1

Posted 21 January 2011 - 05:23 AM

Okay, then I am sorry about that, and all the misunderstanding.
I thought that you were mostly addressing my seeking of Gmpython, so I was quite confused over the matter =/
I suppose any readers should know to contact the relevant people regarding any software on the site.
Thanks again for the library.. it speeds up progress in a project of mine.

Edited by Mode7, 21 January 2011 - 05:24 AM.

  • 0

#21 Primoz128

Primoz128

    GMC Member

  • GMC Member
  • 323 posts
  • Version:GM:Studio

Posted 13 February 2011 - 11:29 AM

Hey since when does this dll use 2.6 ... i knew i tryed it many times and it was 2.5... Well great 2.6 is the best.

Edited by Primoz128, 13 February 2011 - 11:31 AM.

  • 0

Looking for a coding partner for my space RTS solar conquest project. More information: http://gmc.yoyogames...opic=563123&hl=


#22 Hach-Que

Hach-Que

    RoketGames Admin

  • New Member
  • 1490 posts

Posted 13 February 2011 - 11:38 AM

Hey since when does this dll use 2.6 ... i knew i tryed it many times and it was 2.5... Well great 2.6 is the best.

As far as I remember, it never used Python 2.5 since one of the use-cases I provided was the ability to use wxWidgets. You might be thinking of some other Python DLL (which I don't know about).

In response to your original post:

This DLL was created for my own usage, therefore, I won't be adding additional features unless I need them for my own game.


Just to let you know, I won't be adding or changing features of this DLL.

Edited by Hach-Que, 13 February 2011 - 11:39 AM.

  • 0

I don't visit these forums (and I haven't for quite some time). You can

see my latest community projects at the Redpoint Blog.


I never thought I'd see myself writing the above.. :(


#23 Primoz128

Primoz128

    GMC Member

  • GMC Member
  • 323 posts
  • Version:GM:Studio

Posted 17 February 2011 - 09:04 PM

:( then get someone to make them xD. Well might have used some other dll... that needed darn 2.5...
  • 0

Looking for a coding partner for my space RTS solar conquest project. More information: http://gmc.yoyogames...opic=563123&hl=


#24 Whiterock

Whiterock

    GMC Member

  • New Member
  • 5 posts

Posted 31 December 2011 - 10:12 AM

link's broken, Please reupload ;-)
  • 0

#25 Razon

Razon

    GMC Member

  • GMC Member
  • 268 posts
  • Version:GM:Studio

Posted 20 June 2012 - 04:51 PM

Here are new mirror links for the DLL.

No Source
http://www.mediafire...i504s9gy8gl23a9

With Source
http://www.mediafire...ogxw6i0m2ngylzw
  • 0

#26 DarkDev

DarkDev

    GMC Member

  • New Member
  • 16 posts
  • Version:GM8

Posted 24 June 2012 - 04:52 AM

I'm really interested in this DLL, given the lack of a SSL capable socket library for GM. I can't get it to run however. I'm using Razon's provided downloads. I just keep getting bad external calls.

I tried re-pointing the dll, didn't work. Anyone else having this issue?
  • 0
[----------]GMtk+ - GTK2 Themeing for GM
[----------]GMIRC - IRC extension for GM
[----------]Gripe - Stripe Payment Processing for GM (Paused)*

*To complete this project, I need a way to implement SSL sockets. Have an idea? PM me.


Did I help you? If so, press the Posted Image button in the bottom right corner of the post :P thanks.

#27 Primoz128

Primoz128

    GMC Member

  • GMC Member
  • 323 posts
  • Version:GM:Studio

Posted 26 June 2012 - 04:51 PM

Why not use 39dll since it's from c++ which is million times faster than python...
  • 0

Looking for a coding partner for my space RTS solar conquest project. More information: http://gmc.yoyogames...opic=563123&hl=


#28 Agamer

Agamer

    GMC Member

  • GMC Member
  • 157 posts

Posted 04 March 2016 - 04:37 PM

If anyone wants the extension that I built from this awesome library, you can download it here:

 

Download gmPython.gex Game Maker Extension

 

(Hosted by TinyUpload.com --- The file will delete if not downloaded within 100 days)

 

Cheers!  :lol:


Edited by Agamer, 04 March 2016 - 06:30 PM.

  • 0

Package designer; resource maker; engine builder; program tool creator -- Be fully prepared to game:

My scripts My images My model designer My GUI components One of my engines Accepting texture requests