Introducing the SpringRTS kernel
Moderator: Moderators
Introducing the SpringRTS kernel
Hello everyone!
In the past few days I have been making a SpringRTS IPython kernel for the Jupyter notebook.
Jupyter notebook is a very popular tool for datascience and teaching, and many of you may already be familiar with it.
I've now made it work with SpringRTS and I feel this can help speed up development greatly.
To begin checkout these things:
- The github repository: https://github.com/gajop/spring_kernel/
- Youtube guide to setting it up and running it: https://www.youtube.com/watch?v=wXigmhrm52k
- Example notebook https://github.com/gajop/spring_kernel/ ... rial.ipynb (takes a few moments to load)
Happy coding!
In the past few days I have been making a SpringRTS IPython kernel for the Jupyter notebook.
Jupyter notebook is a very popular tool for datascience and teaching, and many of you may already be familiar with it.
I've now made it work with SpringRTS and I feel this can help speed up development greatly.
To begin checkout these things:
- The github repository: https://github.com/gajop/spring_kernel/
- Youtube guide to setting it up and running it: https://www.youtube.com/watch?v=wXigmhrm52k
- Example notebook https://github.com/gajop/spring_kernel/ ... rial.ipynb (takes a few moments to load)
Happy coding!
Re: Introducing the SpringRTS kernel
Thanks
So this is a context where we can run spring and then do real-time changes to the luaui, edit variables and capture screenshots?
So this is a context where we can run spring and then do real-time changes to the luaui, edit variables and capture screenshots?
Re: Introducing the SpringRTS kernel
LuaUI, LuaMenu and synced/unsynced LuaRules. I suppose I could add it to LuaGaia as well if there's interest, but I figure the current ones are what really matters.So this is a context where we can run spring and then do real-time changes to the luaui, edit variables and capture screenshots?
The point of this is that you can run arbitrary code without having to restart Spring/recreate the situation, all the while it's displayed nicely within a notebook, making it easy to experiment and prototype.
Re: Introducing the SpringRTS kernel
This looks very useful
Re: Introducing the SpringRTS kernel
forgive me but what is this?
-
- Posts: 15
- Joined: 10 Aug 2014, 20:32
Re: Introducing the SpringRTS kernel
Is this tool for devs?
Is this Spring rewrite in Python/IPython? What is Spring Kernel?
(sry, this might be noob questions, but anyway))
Is this Spring rewrite in Python/IPython? What is Spring Kernel?
(sry, this might be noob questions, but anyway))
Re: Introducing the SpringRTS kernel
More superpowers for me! viewtopic.php?f=9&t=35912&p=581509#p581509smoth wrote:forgive me but what is this?
Yes it's a tool for devs.[last]Butters wrote:Is this tool for devs?
Is this Spring rewrite in Python/IPython? What is Spring Kernel?
(sry, this might be noob questions, but anyway))
No it's not a Spring rewrite. The python element is there to interface with Jupyter (IPython) Notebook and Spring (engine).
The "Kernel" part is what is used to execute Lua code.
Check this image: http://jupyter.readthedocs.io/en/latest ... onents.png
I've developed the "Kernel" part and interfaced it with Spring. So in my case you would have another box called "Spring" that runs the Lua part of the kernel (which is in charge of code execution) and sends the results back to the Python Kernel.
Essentially you have something like this:
User->Browser->Jupyter Server->Spring Kernel(Python)->Spring Kernel(Lua)
And it is a bit more complicated as we have multiple Lua states as well. 90% of code is just messaging.
I chose not to implement the entire Kernel as a Spring Lua widget/gadget as that would introduce complicated networking and message passing that the existing Python kernel takes care for me.
-
- Posts: 15
- Joined: 10 Aug 2014, 20:32
Re: Introducing the SpringRTS kernel
So is it like Python interface to Lua interface to Spring? =)
Re: Introducing the SpringRTS kernel
No. Python is just the implementation program for messaging passing. It's really just regular Spring Lua code.
Re: Introducing the SpringRTS kernel
Jupyter lets you write up notebooks that contain code that runs. E.g. you can include a data set then tell it to print out a lot of graphs and it will go away and do all the necessary work. You can write python directly in the doc and transform the results and do some basic data science and analysis, draw correlations, interactive stuff, etc
It's very powerful, and this project allows the notebook to reference a running Spring Engine instance, as well as make changes and run Lua code. For example, with this you could plot the firepower of various units, or their cost across a spectrum, graph build trees, plot images of maps by their gradients or accessibility, etc
It's very powerful, and this project allows the notebook to reference a running Spring Engine instance, as well as make changes and run Lua code. For example, with this you could plot the firepower of various units, or their cost across a spectrum, graph build trees, plot images of maps by their gradients or accessibility, etc
Re: Introducing the SpringRTS kernel
Yes, it's used often in datascience and explorative data science is certainly one thing it's pretty good at.
However it's not something I expect this to be good at as it is mostly pure Spring Lua and I don't think it would be worth for me to spend time implementing a powerful plotting library. If there's a lot of data to process I think it might be better to save it to a file and use a Python/R kernel instead.
Currently this is most useful for early function prototyping and testing. I tend to create new functions in it, test them out fully in the notebook and once I'm satisfied it works I copy them into existing Lua script files.
However it's not something I expect this to be good at as it is mostly pure Spring Lua and I don't think it would be worth for me to spend time implementing a powerful plotting library. If there's a lot of data to process I think it might be better to save it to a file and use a Python/R kernel instead.
Currently this is most useful for early function prototyping and testing. I tend to create new functions in it, test them out fully in the notebook and once I'm satisfied it works I copy them into existing Lua script files.
Re: Introducing the SpringRTS kernel
can windoze users utilize this?
Re: Introducing the SpringRTS kernel
I suppose they can, but I haven't tried. Installation is very simple so it shouldn't take much effort to try.
Re: Introducing the SpringRTS kernel
I'd suggest using Anaconda to install Jupyter, which has a windows installer. The rest is primarily python, so in theory it should all be doable
https://www.continuum.io/downloads
My understanding is that Jupyter already has some plotting stuff, it just needs a data source, which you've provided
https://www.continuum.io/downloads
My understanding is that Jupyter already has some plotting stuff, it just needs a data source, which you've provided
Re: Introducing the SpringRTS kernel
I think you're confusing things. It's iPython with these abilities (along with matplotlib and %matplotlib inline magic to embed the plots), and not the Jupyter server, which just allows you to execute arbitrary code.
fwiw, I'm using Jupyter daily for data science so this isn't an uninformed guess.
Anaconda can be good if you're also doing data science, but I think it might be an overcomplication in this case, as you still need to install my kernel with pip. I'd recommend a simple virtualenv + pip install for everything.
fwiw, I'm using Jupyter daily for data science so this isn't an uninformed guess.
Anaconda can be good if you're also doing data science, but I think it might be an overcomplication in this case, as you still need to install my kernel with pip. I'd recommend a simple virtualenv + pip install for everything.
Re: Introducing the SpringRTS kernel
Ah, when I tried using it I was directed towards Anaconda and similar as it was easier to get up and running quickly