Scripting with Python

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

Scripting with Python

Postby RederickDeathwill » Tue Sep 08, 2020 6:21 pm

So, I've been trying to incorporate Python to the GZDoom codebase for more than 10 hours now and it has been a quite enlightening experience. I'm using pybind11 and I'm trying to embed a module called "py_actor" with a test function:

Code: Select allExpand view
void Py_AddSpeed(double speed);

The idea is to be able to change the speed of all monsters through Python by calling this function through a python script, without needing to recompile GZDoom. It's perfectly possible but so far it has been really difficult (I'm nearly making it work). I've just created a question on stack overflow.

There's a nice video from Microsoft Visual Studio about it, and I'm using all the references I can. For those wanting to follow / test, this is the fork on github, and the branch is "python-testing".

EDIT: I've solved the problem, I was importing a module called "" and that bloody module already exists in the Python library (So it wasn't actually loading my module, REALLY hard to find out HAHA).
It took me more than 4 hours messing with cmake just to compile it properly and even print through Python from GZDoom (Mainly due to my own ignorance of the GZDoom codebase). Anyway, what do you guys think about it? Anyone here has ever tried pybind11?
User avatar
Joined: 06 Sep 2020
Github ID:
Operating System: Debian-like Linux (Debian, Ubuntu, Kali, Mint, etc) 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: Scripting with Python

Postby SanyaWaffles » Fri Sep 11, 2020 10:11 pm

I've been fascinated to see other attempts at scripting for GZDoom. I hope this goes somewhere.

I've never done anything with python aside running some scripts for various game mods, specifically Build ones.
User avatar
Wouldn't be an epic gamer if I didn't commit a few war crimes.
Joined: 25 Apr 2013
Location: Eastern Ohio
Discord: SanyaWaffles#5095
Twitch ID: sanyawaffles
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Return to General

Who is online

Users browsing this forum: No registered users and 0 guests