Communication with python

Discussion of Lua and LuaWML support, development, and ideas.

Moderators: Forum Moderators, Developers

Post Reply
User avatar
JeanCloud
Posts: 1
Joined: November 5th, 2019, 10:51 am

Communication with python

Post by JeanCloud » November 6th, 2019, 2:02 pm

Hello,

I'm an engineering student and I have a project of creating an AI for Wesnoth using Reinforcement Learning. Since python is generally the best when it comes to ML, we wan't to create the "brain" of our AI using python and use the LuaAPI to communicate with the game.
Initially, I wanted to use sockets to communicate between the python and the Lua but, since Wesnoth doesn't expose packages such as "require" to its Lua scripts, I don't know how to access to sockets or any other communication method.

Do you have any ideas as how to make a python local script and a Wesnoth Lua script communicate with each other, or if it is even possible to do so ?

Thanks a lot,

--
Clément "Dwerynith" de Araujo
Developper for "Jean Cloud AI"
Jean Cloud Team

Tad_Carlucci
Inactive Developer
Posts: 445
Joined: April 24th, 2016, 4:18 pm

Re: Communication with python

Post by Tad_Carlucci » November 6th, 2019, 4:13 pm

Use Lua instead.

If you find it is possible to communicate with Pyhton, let us know. We'll probably want to close it down.
I forked real life and now I'm getting merge conflicts.


User avatar
Pentarctagon
Forum Administrator
Posts: 4060
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Communication with python

Post by Pentarctagon » November 7th, 2019, 12:33 am

To add to what Tad_Carlucci said, Wesnoth's lua is intentionally limited in order to prevent user made content from being able to do malicious things, so it wouldn't be good if you were to find a way to do something like open sockets using only what's available by default.

Probably the best way would be for you to use the --unsafe-scripts option, which is mentioned in the thread Ravana linked.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code

Post Reply