Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use OpenSpiel in Unity3d #193

Closed
DeusExMachina1993 opened this issue Apr 21, 2020 · 5 comments
Closed

Use OpenSpiel in Unity3d #193

DeusExMachina1993 opened this issue Apr 21, 2020 · 5 comments
Assignees

Comments

@DeusExMachina1993
Copy link

can I use open spiel in a unity3d environment?

@jblespiau
Copy link
Collaborator

jblespiau commented Apr 21, 2020

Hi. I am unsure I understand the question.

Right now, OpenSpiel has no support for Unity (let it be 2D or 3D). It has no support for any visualisation of the games (execept for ToString and InformationStateString that both returns a string). Some work is in progress, using Javascript to get a graphical interface to play some of the games or to visualise them, but it's still not open-sourced.

If you are asking whether it would be possible to use OpenSpiel as a dependency of a Unity3D program, I think so but one would need to get wrappers for C# I suspect.

Does this answer your question? What was exactly the use-case you had in mind>

@DeusExMachina1993
Copy link
Author

DeusExMachina1993 commented Apr 21, 2020

thanks for the reply,
I developed backgammon game in Unity, and want to develop an agent for AI part of that, I saw in your document that open spiel status in backgammon game is normal, just thinking if possible to somehow connect open spiel to my game?

@jblespiau
Copy link
Collaborator

jblespiau commented Apr 21, 2020

The API to interact with the OpenSpiel is either in C++ or in Python. And it offers a very specific API, with a specific id for each move (one would need to look into backgammon to see what "1" represent for the action). So it will depend on the interface you have. In theory, with the correct converters from/to the move representation within OpenSpiel and your internal move representation, there is no reason we could not make the game API interact to each other. If you want to apply the learning algorithms, they are currently implemented for the OpenSpiel game API.

If you want Pixel interactions (e.g. the AI agent would just see the pixels from your Unity 3D game), this is a more complex endeavour, and if the goal is to develop an AI bot, I would not go this way.

The question of training an agent on Backgammon (using Openspiel game API or your own game API) is a different matter, and even though we have a few algorithms implemented in OpenSpiel, it does not mean they will work out of the box for Backgammon. I do not know how easy it would be given I do not know the complexity of backgammon well.

I suppose the way to proceed will also depend if your goal is to get any bot for backgammon to complete your game, or if you would like specifically to try to train an AI agent to play backgammon. For the former, I would suggest doing some lookup to see what exists for backgammon, e.g https://hal.inria.fr/hal-01521393/document. For the latter I would first look at what has been done in this area (I found some pointers there: https://news.ycombinator.com/item?id=15916692)

I think backgammon is "easy" compared to Go or Chess. The here above link suggests that around 1992 there was already some TD algorithms applied to backgammon: https://en.wikipedia.org/wiki/TD-Gammon
In which case, it should be fine to use OpenSpiel to try to learn such agent.

You also have:
https://www.gnu.org/software/gnubg/
http://extremegammon.com/

Feel free to close the bug if the answer is sufficient.

@jblespiau jblespiau self-assigned this Apr 27, 2020
@Maxwell2017
Copy link

Maxwell2017 commented Jan 6, 2021

Is there some support for any visualisation of the games right now?
Looking forward to your reply~
@jblespiau

@michalsustr
Copy link
Collaborator

@Maxwell2017 if you are looking for some very simple non-interactive visualizations, I have done some work in this direction - SpielViz allows to specify custom views. It typically needs the game to have a custom pybindings to expose the game-specific details to create the visualization. I have done something like this for chess (but not pushed yet). There were also some viz work during the extravaganza.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants