HOLY FUCK
So, I decided on Thursday that I wanted to program a multiplayer flash game.
Today, I finally got the multiplayer part going.
So far all you do is place balls and other people can see them. This is the first playable multiplayer build of my engine. I can't link it, because I will take down the server in like five minutes anyway, but that work of "art" was done by about 6-7 people on ausgaf chat together.
BOY THAT WAS HARD TO MAKE.
My userlist is complete garbage, too!
Each socket in the array is a user. If you can read code, I'm sure you'll be thrilled for what happens when there are more users than the size of the array. (I will be changing this to a linked list asap)
I'm super super glad I got this far. I feel like these past two months I've had a focus on artist stuff too much, so it was nice to do something logical for a change.
Hopefully tomorrow I'll have something a bit more, um, gamey. Maybe.
So, I decided on Thursday that I wanted to program a multiplayer flash game.
Today, I finally got the multiplayer part going.
So far all you do is place balls and other people can see them. This is the first playable multiplayer build of my engine. I can't link it, because I will take down the server in like five minutes anyway, but that work of "art" was done by about 6-7 people on ausgaf chat together.
BOY THAT WAS HARD TO MAKE.
My userlist is complete garbage, too!
Code:
for(int i=0; i<sockets.length-1; i++)
{
if(i==sockets.length-1 && sockets[i]!=null)
{
sockets[i] = null; // THIS IS THE WORST THING EVER
}
if(sockets[i]==null || sockets[i].isClosed())
{
sockets[i]=s;
System.out.println("There are " + (i+1) + " user(s), probably");
i=sockets.length-1;
}
}
Each socket in the array is a user. If you can read code, I'm sure you'll be thrilled for what happens when there are more users than the size of the array. (I will be changing this to a linked list asap)
I'm super super glad I got this far. I feel like these past two months I've had a focus on artist stuff too much, so it was nice to do something logical for a change.
Hopefully tomorrow I'll have something a bit more, um, gamey. Maybe.