Introducing the SpringRTS kernel

Introducing the SpringRTS kernel

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Introducing the SpringRTS kernel

Post by gajop » 19 Mar 2017, 15:01

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!
5 x

raaar
Metal Factions Developer
Posts: 816
Joined: 20 Feb 2010, 12:17

Re: Introducing the SpringRTS kernel

Post by raaar » 19 Mar 2017, 20:08

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?
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: Introducing the SpringRTS kernel

Post by gajop » 19 Mar 2017, 20:48

So this is a context where we can run spring and then do real-time changes to the luaui, edit variables and capture screenshots?
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.

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.
0 x

User avatar
AF
AI Developer
Posts: 20669
Joined: 14 Sep 2004, 11:32

Re: Introducing the SpringRTS kernel

Post by AF » 21 Mar 2017, 18:59

This looks very useful
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Introducing the SpringRTS kernel

Post by smoth » 26 Mar 2017, 04:15

forgive me but what is this?
0 x

[last]Butters
Posts: 15
Joined: 10 Aug 2014, 20:32

Re: Introducing the SpringRTS kernel

Post by [last]Butters » 26 Mar 2017, 10:23

Is this tool for devs?

Is this Spring rewrite in Python/IPython? What is Spring Kernel?
(sry, this might be noob questions, but anyway))
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: Introducing the SpringRTS kernel

Post by gajop » 26 Mar 2017, 10:57

smoth wrote:forgive me but what is this?
More superpowers for me! viewtopic.php?f=9&t=35912&p=581509#p581509
[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))
Yes it's a tool for devs.
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.
0 x

[last]Butters
Posts: 15
Joined: 10 Aug 2014, 20:32

Re: Introducing the SpringRTS kernel

Post by [last]Butters » 26 Mar 2017, 12:19

So is it like Python interface to Lua interface to Spring? =)
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: Introducing the SpringRTS kernel

Post by gajop » 26 Mar 2017, 12:38

No. Python is just the implementation program for messaging passing. It's really just regular Spring Lua code.
0 x

User avatar
AF
AI Developer
Posts: 20669
Joined: 14 Sep 2004, 11:32

Re: Introducing the SpringRTS kernel

Post by AF » 27 Mar 2017, 15:47

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
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: Introducing the SpringRTS kernel

Post by gajop » 27 Mar 2017, 16:38

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.
0 x

User avatar
smoth
Posts: 22298
Joined: 13 Jan 2005, 00:46

Re: Introducing the SpringRTS kernel

Post by smoth » 28 Mar 2017, 08:16

can windoze users utilize this?
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: Introducing the SpringRTS kernel

Post by gajop » 28 Mar 2017, 08:42

I suppose they can, but I haven't tried. Installation is very simple so it shouldn't take much effort to try.
0 x

User avatar
AF
AI Developer
Posts: 20669
Joined: 14 Sep 2004, 11:32

Re: Introducing the SpringRTS kernel

Post by AF » 29 Mar 2017, 18:08

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
0 x

gajop
Moderator
Posts: 3023
Joined: 05 Aug 2009, 20:42

Re: Introducing the SpringRTS kernel

Post by gajop » 30 Mar 2017, 06:49

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.
0 x

User avatar
AF
AI Developer
Posts: 20669
Joined: 14 Sep 2004, 11:32

Re: Introducing the SpringRTS kernel

Post by AF » 30 Mar 2017, 18:37

Ah, when I tried using it I was directed towards Anaconda and similar as it was easier to get up and running quickly
0 x

Post Reply

Return to “Game Development”

cron