Discuss Scratch

iceninja1234567
Scratcher
11 posts

How to use cloud data to make a multiplayer game(online)

1. Make these 5 variables:

(player 1 x)
(player 1 y)
(player 2 x)
(player 2 y)
(player #)
iceninja1234567
Scratcher
11 posts

How to use cloud data to make a multiplayer game(online)

2 make the following script:


when [J] key pressed
ask [Number:] and wait
set [player #] to (answer)
iceninja1234567
Scratcher
11 posts

How to use cloud data to make a multiplayer game(online)

I`ll send the rest later


but for now:

when green flag clicked
say [ICENINJA1234567 IS EPIC!]
funisscratch
Scratcher
50 posts

How to use cloud data to make a multiplayer game(online)

rightwing wrote:

VCNinc wrote:

Basically, to make a multiplayer game, you need four cloud variables (minimum, you can add more if you want extra features):

PlayerOneX
PlayerOneY
PlayerTwoX
PlayerTwoY

when green flag clicked
forever
set [PlayerOneX v] to ([x position v] of [PlayerOne v])
set [PlayerOneY v] to ([y position v] of [PlayerOne v])
set [PlayerTwoX v] to ([x position v] of [PlayerTwo v])
set [PlayerTwoY v] to ([y position v] of [PlayerTwo v])
end
Then you should update display the PlayerOne and PlayerTwo sprites on the screen by pulling the X and Y positions from the cloud variables. I hope this helped you![/quote]
[/quote]

Ok but can you make people able to join in?

Last edited by funisscratch (May 24, 2014 22:38:09)

funisscratch
Scratcher
50 posts

How to use cloud data to make a multiplayer game(online)

Hi!
when green flag clicked
repeat (5) times
say [I'm toataly AWESOME!] for (2) secs

end
scratch-mg
Scratcher
59 posts

How to use cloud data to make a multiplayer game(online)

typemaster wrote:

The cloud data is back to normal, so now you don't need to assign each player an ID. You could just do this:

typemaster wrote:

typemaster wrote:

Blaze349 wrote:

snake13 wrote:

Dear fellow Scratchers,
How do you make a multiplayer game where characters can interact with each other? I looked inside griffpatch's multiplayer platformer game, but it
still didn't help. Griffpatch said It is hard to make a multiplayer game. Anyone help please!





all the ways are hard griffpatch's way is the best easiest way.

VCNinc wrote:

Basically, to make a multiplayer game, you need four cloud variables (minimum, you can add more if you want extra features):

PlayerOneX
PlayerOneY
PlayerTwoX
PlayerTwoY

when green flag clicked
forever
set [PlayerOneX v] to ([x position v] of [PlayerOne v])
set [PlayerOneY v] to ([y position v] of [PlayerOne v])
set [PlayerTwoX v] to ([x position v] of [PlayerTwo v])
set [PlayerTwoY v] to ([y position v] of [PlayerTwo v])
end

Then you should update display the PlayerOne and PlayerTwo sprites on the screen by pulling the X and Y positions from the cloud variables. I hope this helped you!
griffpatch's cloud variable game does not use Player X and Y positions as cloud data





Snake13






They are right, but you can also save a world by a name and have a server button. When you click on it, use a join block
to join the server, which will be a world identified by the variable server.

when this sprite clicked(join (server) )


Cloud variables are really important to, but at this time, you have to assign each player an ID and add the ID to the cloud variable/ list.
Example:
when green flag clicked
if <[players on list] = [1]> then
set [myself] to [1]
insert [1] at (player 1) of [list of players]
end
else
((set myself to number of players on [list of players]) + (1))
insert [myself] at (((number of players on [list of players]) + (1))) of [list of players]

Of course, you would have to make more variables so that you wouldn't be saying:

((set myself to number of players on
  • ) + (1))
    insert at (((number of players on ) + (1))) of

The cloud data is back to normal, so now you don't need to assign each player an ID. You could just do this:
when green flag clicked
if <[players on list] = 1> then
add myself to [list of players]
end
else
insert [myself] at (((number of players on [list of players]) + (1))) of [list of players]
And how to get off so that other players can join?
jj200275
Scratcher
6 posts

How to use cloud data to make a multiplayer game(online)

ppl its easy to make online multiplayer it only takes 4 scripts minimum just see http://scratch.mit.edu/projects/22968899/
its kinda missing lots of features other multiplayers have but it still works
KronosTheMaster
Scratcher
40 posts

How to use cloud data to make a multiplayer game(online)

Here's a useful tip: the maximum length of a cloud variable is 10240 digits, and you can have up to 10 cloud variables on each project. See http://scratch.mit.edu/projects/22996518/ as an example.

 Follow [KronosTheMaster v] 
KronosTheMaster
Scratcher
40 posts

How to use cloud data to make a multiplayer game(online)

Yeah, I don't go on the forums that much
:(
Zacshap21
Scratcher
100+ posts

How to use cloud data to make a multiplayer game(online)

http://scratch.mit.edu/projects/22752145/here U made a game that can do it but you must remix it.
Sky01
Scratcher
11 posts

How to use cloud data to make a multiplayer game(online)

snake13 wrote:

Well thanks for trying to explain but how exactaly do i store all of the players x and y?

I did some tests for a game I'm making, and it seems that clones create their own variables. That is, if you have one square per player, and cloud data to track that players x and y, you can have the square clone itself and each clone will have individual variables.

The hard part is getting each clone to respond to separate input. But it may be easier than I think – I haven't tested this exact problem.
Explosive_Chaos
Scratcher
6 posts

How to use cloud data to make a multiplayer game(online)

Where do you find all those blocks?
Charliebird
Scratcher
10 posts

How to use cloud data to make a multiplayer game(online)

snake13 wrote:

Dear fellow Scratchers,
How do you make a multiplayer game where characters can interact with each other? I looked inside griffpatch's multiplayer platformer game, but it
still didn't help. Griffpatch said It is hard to make a multiplayer game. Anyone help please!











Snake13





I know how. Because I'm working on one
So, you make one cloud variable for each player. In that cloud variable, you have numbers for their X, Y, HP, and if their attacking or not. Then you make the characters and wire it together. If you look at this project http://scratch.mit.edu/projects/18992128/ it might help. In this project, I laid it out nice and easy so that the cloud variables are individual instead of all in one. AND IT WORKS! I'll add you to the beta (more like alpha) testers if you want. Hope it helped! If you need more specific information, just let me know!

LONG LIVE THE DREAMCAST!!!!!
Charliebird
Scratcher
10 posts

How to use cloud data to make a multiplayer game(online)

Sky01 wrote:

snake13 wrote:

Well thanks for trying to explain but how exactaly do i store all of the players x and y?

I did some tests for a game I'm making, and it seems that clones create their own variables. That is, if you have one square per player, and cloud data to track that players x and y, you can have the square clone itself and each clone will have individual variables.

The hard part is getting each clone to respond to separate input. But it may be easier than I think – I haven't tested this exact problem.
There's an easier way of doing that but it would limit the amount of players you could have.
Znapi
Scratcher
500+ posts

How to use cloud data to make a multiplayer game(online)

Try reading this post by me. I have made my own online multiplayer project that works, so I know a little about the topic. Maybe it will be a bit easier to understand. The exact scripting is not given in the post, it was to explain how to it basically works.

Last edited by Znapi (June 26, 2014 23:48:46)

Znapi
Scratcher
500+ posts

How to use cloud data to make a multiplayer game(online)

KronosTheMaster wrote:

Here's a useful tip: the maximum length of a cloud variable is 10240 digits, and you can have up to 10 cloud variables on each project.
Thank you so much for that information! That is really helpful. I have been searching for that information for a really long time, because my multiplayer engine has really long cloud variables. The longest in there is 3000, but now I know it can go way bigger.

Last edited by Znapi (June 26, 2014 23:37:30)

PatrickBoy412
Scratcher
10 posts

How to use cloud data to make a multiplayer game(online)

I've also been wondering how to make a cloud game where muliple players can join instead of just, like, 2 players, how do I do this?
EnderJaycee
New Scratcher
3 posts

How to use cloud data to make a multiplayer game(online)

IHeartCats101 wrote:

I am working on a game and I need someone to test it when I am done.
Sure I'll test it for you
ILoveSoda247
Scratcher
11 posts

How to use cloud data to make a multiplayer game(online)

Sky01 wrote:

snake13 wrote:

Well thanks for trying to explain but how exactaly do i store all of the players x and y?

I did some tests for a game I'm making, and it seems that clones create their own variables. That is, if you have one square per player, and cloud data to track that players x and y, you can have the square clone itself and each clone will have individual variables.

The hard part is getting each clone to respond to separate input. But it may be easier than I think – I haven't tested this exact problem.
its not. make a list that says (if you were doing cannons) cannon x and another that says cannon y. then, after spawning, add x to list cannon x(use the built-in x and y position) and add y to cannon y and bam! there you go
supercreeper2005
Scratcher
100+ posts

How to use cloud data to make a multiplayer game(online)

To make multiplayer, make a script that set's player 1/2 x to a cloud variable. Then when a key pressed (right) , change the variable rather than the X position. Make player 1 to use WASD and player 2 use arrow keys.

Powered by DjangoBB