sofi-unity3d
explores how to control a Unity3D game environment through sofi by using WebSocketSharp as a client inside the game world.
For more details on how it works, have a look at Making 3D Interfaces for Python with Unity3D
- You'll need to install the Sofi package, available at the tryexceptpass/sofi repository.
- To run the game world:
- Update
server.py
with your twitter account credentials.
- Start the game world by running the executable you downloaded above or start it directly from Unity3D. This will wait for a websocket server at port 9000.
- Run the python code:
python server.py
. This will start the slide deck I used at PyCaribbean and start a twitter listener for #python which will spawn objects as tweets come in.
If you'd like to just watch the tweets roll in, disabling the slides is easy enough, just comment or remove any lines that call displayslide()
. Please note that you could easily repurpose this function for other things along with the onkeyboard()
callback.