Discuss Scratch

Magnie
Scratcher
100+ posts

Little Server That Can (or LSTC)

LSTC is the engine/server for Chat.PY, Bit Art, and hopefully many enjoyable multiplayer games in the future. I'm currently working on LSTC Green (uses greenlet/gevent).

Chat.PY 4.0
Progress: The Beta has been released! Just missing a couple features in the client, but should be ready for any kind of conversations! Note: I have gotten permission to release this project.

Description: Chat.PY is more of an IRC (internet relay chat) server designed specifically for Scratch (1.4).

Virtual Space
Progress: In the coding stage, hope to have something out by the 25th!

Description: A multiplayer space game that could be compared to the game “Escape Velocity Nova” (search om Google if you are unfamiliar with it).

Bit Art
Progress: Not started for LSTC Green.

Description: A drawing game where you place individual “pixels” (each “pixel” is 6x6 literal pixels).

Scratch Web
Progress: Not sure what inspiration I had to start this, but it was in my plugins folder. Not started.

Description: A Scratch Web allowing Scratchers to create web pages and web sites (not real ones) that other Scratchers can view (provided they have a client and web address).

Other Info and Stuff
You can see the code so far at the Sourceforge Repository here.

Also, the owner of the VPS ended up needing to re-image the server, so Chat.PY 2.0 is officially dead.

If you guys have any tips, suggestions/ideas, comments, etc. just post below.
I've already gotten a MUD game (Multi-User Dimension) suggestion. I think I'll be adding that in Chat.PY in a special channel.

LSTC Source: http://sourceforge.net/projects/lstc/

Last edited by Magnie (Oct. 23, 2013 22:25:55)

bobbybee
Scratcher
1000+ posts

Little Server That Can (or LSTC)

RSC or cloud protocol?
Magnie
Scratcher
100+ posts

Little Server That Can (or LSTC)

bobbybee wrote:

RSC or cloud protocol?
RSC.
DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

RSC?

oh wait.. remote sensor connections.

*derp*

I'm going to work on an echo client for Scratch 2.0 now! xP

For my Lua server, at least.

Last edited by DigiTechs (May 11, 2013 08:31:59)

DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

What port does the current Remote Sensors Protocol work on? I'm going to assume it's 42002 ()
MathWizz
Scratcher
100+ posts

Little Server That Can (or LSTC)

Actually, the 2.0 port are these:
  • SensorBoard: 17302 - this is the one you want
  • WeDo: 17301
  • MIDI: 17801

I don't know if they're fully functional yet though. The protocol could also be different…

Last edited by MathWizz (May 11, 2013 13:12:23)

DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

MathWizz wrote:

Actually, the 2.0 port are these:
  • SensorBoard: 17302 - this is the one you want
  • WeDo: 17301
  • MIDI: 17801

I don't know if they're fully functional yet though. The protocol could also be different…

What about Mesh?
Magnie
Scratcher
100+ posts

Little Server That Can (or LSTC)

MathWizz wrote:

Actually, the 2.0 port are these:
  • SensorBoard: 17302 - this is the one you want
  • WeDo: 17301
  • MIDI: 17801

I don't know if they're fully functional yet though. The protocol could also be different…
Feel like making a new Mirror MathWizz?
GeonoTRON2000
Scratcher
100+ posts

Little Server That Can (or LSTC)

Ooh, they're keeping RSC?
If I understood it better, I'd make a mesh bridge.
DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

Magnie wrote:

MathWizz wrote:

Actually, the 2.0 port are these:
  • SensorBoard: 17302 - this is the one you want
  • WeDo: 17301
  • MIDI: 17801

I don't know if they're fully functional yet though. The protocol could also be different…
Feel like making a new Mirror MathWizz?

Don't forget to make it so you can easily modify what server it mirrors to! (Hint: my Lua server )
DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

Is LSTC running? If so, what IP address?
Magnie
Scratcher
100+ posts

Little Server That Can (or LSTC)

DigiTechs wrote:

Is LSTC running? If so, what IP address?
Not yet, but it'll be at ‘voxinfinitus.net’.

With 1.4 you may get an error, when you do, just continue (don't hit abort) and then enter it again. (For directly connecting with Mesh)

Last edited by Magnie (May 11, 2013 18:57:14)

DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

Magnie wrote:

DigiTechs wrote:

Is LSTC running? If so, what IP address?
Not yet, but it'll be at ‘voxinfinitus.net’.

With 1.4 you may get an error, when you do, just continue (don't hit abort) and then enter it again. (For directly connecting with Mesh)

Okay. Will the external IP be the same, or will I have to modify my HOSTS file to make ‘lstc.com ’ the right IP? (I prefer using meaningful names )

Also, I've worked on a cleaner version of my server! (It's much cleaner than the first version was, anyway)

As a question, can you explain the code behind your Plugin Handler? I don't get it as having to flip between two files is annoying :l
Magnie
Scratcher
100+ posts

Little Server That Can (or LSTC)

DigiTechs wrote:

Magnie wrote:

DigiTechs wrote:

Is LSTC running? If so, what IP address?
Not yet, but it'll be at ‘voxinfinitus.net’.

With 1.4 you may get an error, when you do, just continue (don't hit abort) and then enter it again. (For directly connecting with Mesh)

Okay. Will the external IP be the same, or will I have to modify my HOSTS file to make ‘lstc.com ’ the right IP? (I prefer using meaningful names )
It'll probably always be voxinfinitus.net (it's the domain of the person who owns the VPS, so I doubt it'll ever change).

Also, I've worked on a cleaner version of my server! (It's much cleaner than the first version was, anyway)

As a question, can you explain the code behind your Plugin Handler? I don't get it as having to flip between two files is annoying :l
It binds itself to port 42001, imports the plugins, then it creates/initializes the plugin server for all the plugins in load_plugins (the plugins it will load are at the very bottom of the file). After that it waits for a client to connect. Once they connect, it checks if their IP (or the hash of it) is in the blacklist array. If not, it finishes and continually waits until it receives a packet. Once it does, it runs it through a parser which divides the messages into separate “chunks” (Scratch combines multiple messages into a single one) and then it runs through each chunk and check if it's relevant (it checks if the first character is a colon ‘:’). If it is, then it looks at the next character, if it's a +, -, >, or some other characters, it'll react accordingly. The ones that would be most used are ‘+’ and ‘>’. The plus (+) adds a plugin for the client to use (allowing two different games, projects, etc, connect to the same server on the same port). The greater than sign (>) basically tells the server to forward the message to the plugin that the message says to forward it to (“:> chat4 message” would send ‘message’ to the chat4 plugin). Then the plugin handles the message however it wants (or however it's coded to handle it).

A little more explanation on what happens with ‘+’: This adds the plugin (“:+ chat4” would add the ‘chat4’ plugin) to a plugins array and then sends the plugin a message saying they have a new client/user. So when someone joins, you can have the plugin send a message to everyone connected to it that there is a new user. When someone disconnects, the server sends a lost_user message to the plugin so the plugin can send a message to everyone connected that a user has left.

The reason I use multiple files is because it makes it easier to work on only a specific part of the program. The total number of lines of code in LSTC is 1346 lines (green_server.py 428, and chat4.py 918, not including template.py or any other unreleased plugins/files). So, scrolling up and down between even 500 lines of code is really tedious. If it were practical, I would probably split up chat4.py into some more files, but the way it's set up, there isn't any real point. And once I get green_server.py bug free (or at least bug tolerant) and I'm satisfied with it, I only need to open chat4.py to edit and update the chat plugin.

That's a lot of information, but I hope it makes sense.
DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

Most of it did, yeah - but I was really talking about the ‘code’ behind it. I've read the source on sourceforge and you have an exec() (In Lua, much like loadstring()() so I can make SOME sense of it ) with a formatted string in. Could you explain that?
DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

MathWizz wrote:

Actually, the 2.0 port are these:
  • SensorBoard: 17302 - this is the one you want
  • WeDo: 17301
  • MIDI: 17801

I don't know if they're fully functional yet though. The protocol could also be different…

Wouldn't you assume that they send messages in JSON?
Magnie
Scratcher
100+ posts

Little Server That Can (or LSTC)

DigiTechs wrote:

Most of it did, yeah - but I was really talking about the ‘code’ behind it. I've read the source on sourceforge and you have an exec() (In Lua, much like loadstring()() so I can make SOME sense of it ) with a formatted string in. Could you explain that?
There is probably a better way than with exec() but I used that because ‘import “string”’ doesn't really work (I've actually never tried it, so I wouldn't know).

The code in the exec() imports the server (basically finds another .py file and loads it) and then calls Server() from the plugin. Then it starts the thread (the plugin.start()) and does that for every name/plugin in load_plugins. I don't really know what you want to know. The comments should explain the basic idea. If you don't understand something, just copy and paste the code here (in small chunks preferably) and I'll explain what every line does.
Creeknight
Scratcher
2 posts

Little Server That Can (or LSTC)

Awesome! Good luck, Magnie

I might hook up a project I'm making to this, so all projects using mine will be able to share user-created resources. :3

I have yet to figure out how to make a Python server. Maybe I should get a server that supports Python first.
DigiTechs
Scratcher
500+ posts

Little Server That Can (or LSTC)

Creeknight wrote:

Awesome! Good luck, Magnie

I might hook up a project I'm making to this, so all projects using mine will be able to share user-created resources. :3

I have yet to figure out how to make a Python server. Maybe I should get a server that supports Python first.

Try my Lua server - it's much more cross platform as it's distributed in Source code (though I've yet to figure out how to compile it I just used luaforwindows)
MathWizz
Scratcher
100+ posts

Little Server That Can (or LSTC)

Magnie wrote:

MathWizz wrote:

Actually, the 2.0 port are these:
  • SensorBoard: 17302 - this is the one you want
  • WeDo: 17301
  • MIDI: 17801

I don't know if they're fully functional yet though. The protocol could also be different…
Feel like making a new Mirror MathWizz?
I could… Actually, I could just resurrect the other one.

Powered by DjangoBB