[Help][Python] I want to make a 3D frontend (in Godot)

[Help][Python] I want to make a 3D frontend (in Godot)

Postby mdtrooper » 22 Sep 2018, 20:14


Maybe you know that I love Cataclysm DDA, I think that is the best floss game at the moment.

Well, I am trying to wrap the game with a script in python for catch the stdout and send key press. This game have 2 modes: SDL and ncurses. the target is ncurses of course.

"Why do mdtrooper make this weird script?" It is a good question. I want to wrap the ncurses game to have only a simple stdin and stdout (such as CLI or API) to "link" with Godot. And yes, in Godot do the 3D magic.

I look for help in other places:

Open a process and catch stdout and send custom keypress in Stackoverflow
Godot 3D frontend (0,000001 % complete) in oficial CataclysmDDA forum

My proofs are:

A simple ncurses proof:

{l Code}: {l Select All Code}
#! /usr/bin/python3

import sys,os
import curses

def draw_menu(stdscr):
   k = 0
   while (k != ord('q')):
      height, width = stdscr.getmaxyx()
      stdscr.addstr(0, 0, "HOLA {}".format(k))
      k = stdscr.getch()

def main():

if __name__ == "__main__":

Some fault tryings to wrap the ncurses proof:

{l Code}: {l Select All Code}
#! /usr /bin/python3

ps -A | grep cata
xdotool search --pid 3819
xdotool key --window 50331670 q

from subprocess import Popen, PIPE

#p = Popen('./test5.py', stdin=PIPE, stdout=PIPE, shell=True)
#p = Popen('./test5.py', shell=True)
p = Popen('./test2.py')



# p.stdin.close()
# p.stdout.close()
# p.wait()


# ~ import pexpect

# ~ child = pexpect.spawn("./test5.py")
# ~ child.send('a')
# ~ child.send('b')
# ~ child.interact()

# ~ import sys
# ~ import pexpect
# ~ child = pexpect.spawn('./test5.py', logfile=open("/tmp/file", "wb"))
# ~ child.logfile = open("/tmp/file", "wb")
# ~ child.expect(pexpect.EOF)
# ~ child.send('a')
# ~ child.send('q')
# ~ child.interact()

fout = file('output.txt', 'w') child.logfile = fout

import sys
from time import sleep
import pexpect
child = pexpect.spawn('./test5.py')
child.logfile = open("/tmp/file", "wb")
# ~ child.send('q')

I am very lost. I don't know the way to wrap the ncurses app.

User avatar
Posts: 125
Joined: 26 Jul 2012, 13:24

Who is online

Users browsing this forum: No registered users and 1 guest