Discuss Scratch

andycman
Scratcher
55 posts

Multiplayer game help

I need help on this multiplayer game. I've attempted to test it out myself with two browsers, yet the cloud variables won't update immediately without reloading the project. I've seen working multiplayer games, yet they are VERY complex (search “Griffpatch”, then look inside either “Cloud Platformer Multiplayer” or “Tank Arena v.”xx“(Multiplayer game)”)

Is there a simple way of making a simple, working multiplayer project? or some project I could work off of?

(Im talking Scratch 2.0, I never really explored advanced features in Scratch 1.4.)

Last edited by andycman (Jan. 18, 2014 18:38:27)

DigiTechs
Scratcher
500+ posts

Multiplayer game help

Multiplayer in Scratch, in my opinion, is horrible unless you're using Scratch 1.4 and your own server.
Cloud variables are slow to reduce strain on browsers or something like that, I believe.

If you really want multiplayer that bad and need it to be near-instant, use Scratch 1.4 and then you can use the remote sensor protocol.

(By the way, can someone link that? This computer's internet is SLOOOOOOW and I'm doing this at a school so I probably would have to log off by the time the page loads)
Magnie
Scratcher
100+ posts

Multiplayer game help

Remote Sensor Connections: http://wiki.scratch.mit.edu/wiki/Remote_Sensor_Connections
Remote Sensor Protocol: http://wiki.scratch.mit.edu/wiki/Remote_Sensors_Protocol

Just for some information, I tried making a multiplayer game with Scratch 1.4 and it is *really* slow for every variable update you add into a single packet the longer it takes to decode and the longer your message you send at a time, even more so. Currently, Scratch just isn't fit to run multiplayer games. Sure maybe a turn based game (which would be fun to see), but any real-time stuff just isn't going to happen.

I do think I have a pretty good parser in Python if you are interested: http://sourceforge.net/p/lstc/code/HEAD/tree/trunk/LSTC-Green/green_server.py it's line 416 down to line 542. Seems I got it from blob8108, so credit to him of course.

Last edited by Magnie (Jan. 16, 2014 16:41:54)

DaAlchemist
Scratcher
8 posts

Multiplayer game help

The easiest type of multiplayer is multiplayer on one keyboard, one monitor, one computer. Each player use a bunch of keys to control his/her own soldier dude to shoot each other.
DigiTechs
Scratcher
500+ posts

Multiplayer game help

Magnie wrote:

I do think I have a pretty good parser in Python if you are interested: http://sourceforge.net/p/lstc/code/HEAD/tree/trunk/LSTC-Green/green_server.py it's line 416 down to line 542. Seems I got it from blob8108, so credit to him of course.
Just for information, those weird << and & signs you may see are ‘left shifts’ and ‘bitwise and’

I got them from here: http://docs.python.org/2/library/operator.html - so I guess it's right.
MCAnimator3D
Scratcher
500+ posts

Multiplayer game help

I'm sorry to say this, but to create a high quality multiplayer game, you will have to study @griffpatch_tutor's multiplayer base. I you would like to make a simple (not too good connection wise) game check out @relrel's profile. He has a simple multiplayer base that is a WIP.

Last edited by MCAnimator3D (Jan. 17, 2014 02:29:07)

bobbybee
Scratcher
1000+ posts

Multiplayer game help

I did a custom-server (read: not mesh) implementation of a simple, Club Penguin-like MMO.. and even then it was pathetically slow. Literally, you'd click and it would be about a second before you move. Chat wasn't so bad, but it isn't so realtime anyway. I don't know, Scratch MMOs in general just feel like a turn-based version of what you had in mind. Lag!!!!
ironmannn
Scratcher
100+ posts

Multiplayer game help

Magnie wrote:

Scratch just isn't fit to run multiplayer games. Sure maybe a turn based game (which would be fun to see), but any real-time stuff just isn't going to happen.

What a coincidence, Im working on something of a turn-based game. Your text to link here…

Last edited by ironmannn (Jan. 20, 2014 06:40:41)

DigiTechs
Scratcher
500+ posts

Multiplayer game help

Magnie wrote:

Just for some information, I tried making a multiplayer game with Scratch 1.4 and it is *really* slow for every variable update you add into a single packet the longer it takes to decode and the longer your message you send at a time, even more so. Currently, Scratch just isn't fit to run multiplayer games. Sure maybe a turn based game (which would be fun to see), but any real-time stuff just isn't going to happen.

Would it be worth setting the TCP_NODELAY option? Or would it not change much?

EDIT: Messed up the quotes. derp.

Last edited by DigiTechs (Jan. 20, 2014 10:47:12)

bobbybee
Scratcher
1000+ posts

Multiplayer game help

DigiTechs wrote:

Magnie wrote:

Just for some information, I tried making a multiplayer game with Scratch 1.4 and it is *really* slow for every variable update you add into a single packet the longer it takes to decode and the longer your message you send at a time, even more so. Currently, Scratch just isn't fit to run multiplayer games. Sure maybe a turn based game (which would be fun to see), but any real-time stuff just isn't going to happen.

Would it be worth setting the TCP_NODELAY option? Or would it not change much?

EDIT: Messed up the quotes. derp.

Nah, all the lag is on Scratch's side. I've used the identical server for a Flash client, which ran perfectly.
DigiTechs
Scratcher
500+ posts

Multiplayer game help

bobbybee wrote:

DigiTechs wrote:

Magnie wrote:

Just for some information, I tried making a multiplayer game with Scratch 1.4 and it is *really* slow for every variable update you add into a single packet the longer it takes to decode and the longer your message you send at a time, even more so. Currently, Scratch just isn't fit to run multiplayer games. Sure maybe a turn based game (which would be fun to see), but any real-time stuff just isn't going to happen.

Would it be worth setting the TCP_NODELAY option? Or would it not change much?

EDIT: Messed up the quotes. derp.

Nah, all the lag is on Scratch's side. I've used the identical server for a Flash client, which ran perfectly.
Mkay. I guess it just proves how slow Squeak can be
Magnie
Scratcher
100+ posts

Multiplayer game help

I think with Scratch 1.4 there is an inefficiency problem with the parsing. If you can find the code you may be able to make it more efficient and faster and you may actually be able to make a decent multiplayer asteroids game.
QuillzToxic
Scratcher
1000+ posts

Multiplayer game help

It would kill your browser.
Running cloud vars every 0.0 secs for pos will kill everyone and proboly close your project jue to powerhungrey project
Magnie
Scratcher
100+ posts

Multiplayer game help

QuillzToxic wrote:

It would kill your browser.
Running cloud vars every 0.0 secs for pos will kill everyone and proboly close your project jue to powerhungrey project
If it were more event based than request based then it wouldn't have as much of a problem.
DigiTechs
Scratcher
500+ posts

Multiplayer game help

Magnie wrote:

QuillzToxic wrote:

It would kill your browser.
Running cloud vars every 0.0 secs for pos will kill everyone and proboly close your project jue to powerhungrey project
If it were more event based than request based then it wouldn't have as much of a problem.
+1 that.
Possibly we could have an event based system added to Snap! - as that would mean that we have fancy effects and stuff and nice things for it.
Yoda3D
Scratcher
86 posts

Multiplayer game help

If you wanted you could check out my Shy Guy Plaza, It is pretty simple.

Powered by DjangoBB