View Full Version : Socket server ?
Johnny64
June 5th, 2004, 04:02 PM
Hé
Is it allowed to use a XML socker sever? Or is that crossing rule 2 "The games must be created in Flash." ?
If yes, must the server be up at all time or just for judging?
Thanks :)
MTsoul
June 5th, 2004, 04:08 PM
:o someone is rich :-p
Johnny64
June 5th, 2004, 04:09 PM
Someone knows how to set one up at home ;P
MTsoul
June 5th, 2004, 04:11 PM
Someone rich enough to own a Flashcom at home =)
Johnny64
June 5th, 2004, 04:21 PM
I don't have Flashcom and it isn't a XML socker sever ;P
If isn't allowed I might use a free socket server make with Java or use the one I make my self
ok looks like i am showing off here :-/ but i don't mean it that way. :)
kirupa
June 5th, 2004, 06:08 PM
Sure - feel free to use whatever you need to m64 :) The only thing is that I should not have to make any configurations to your SWF in order to get it to work on the site, and no data should be written to or stored on the kirupa.com servers.
:ub:
m_andrews808
June 5th, 2004, 07:07 PM
Will the games ultimately be hosted on Kirupa.com servers?
I think you're going to run into problems M64 if you try and to connect to a socket server running on any server other than that which the flash file is being hosted on, i.e. if your game is to be hosted on Kirupa.com's servers you won't be able to connect to the socket server running on your home machine :-/
kirupa
June 5th, 2004, 08:34 PM
Will the games ultimately be hosted on Kirupa.com servers?
I think you're going to run into problems M64 if you try and to connect to a socket server running on any server other than that which the flash file is being hosted on, i.e. if your game is to be hosted on Kirupa.com's servers you won't be able to connect to the socket server running on your home machine :-/Well, it doesn't have to be hosted on the kirupa.com servers. I can always iframe it from another location such as M64's server. I mentioned that the SWF's would be located on the kirupa.com servers because I did not want to put any type of pressure on others' bandwidths after the contest was over :)
Johnny64
June 6th, 2004, 06:53 AM
Thanks Kirupa =)
I will try to keep my server up and run and if I can't it will be my own fault :)
jmayo86
June 6th, 2004, 02:07 PM
What does a XML socket server do?
λ
June 6th, 2004, 02:24 PM
What does a XML socket server do?
Allows real-time communication between different clients. Think multiplayer games or chat.
dr.ew
June 6th, 2004, 03:27 PM
How bout a nice XML Socket tutorial M64? That would be Shweeet.=]
jmayo86
June 6th, 2004, 04:31 PM
Where could i learn more about this 'XML Socket server'? It sounds quite interesting :D
signifer123
June 6th, 2004, 04:31 PM
yes i'd lok forward to that
Johnny64
June 7th, 2004, 12:03 PM
I might if i get time :)
But first this contest :bad:
mdipi
June 7th, 2004, 03:58 PM
Where could i learn more about this 'XML Socket server'? It sounds quite interesting :D
Google.
jmayo86
June 7th, 2004, 04:30 PM
yer.....but what could i search, when i type in XML Socket Server it just comes up with servers, no tutorials on how to use it, thats what i really want, know any good sites?
o and are you allowed 1 word posts :P
Yeldarb
June 7th, 2004, 04:39 PM
yer.....but what could i search, when i type in XML Socket Server it just comes up with servers, no tutorials on how to use it, thats what i really want, know any good sites?
http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=xml+socket+server+tutorial
o and are you allowed 1 word posts :P
Yes.
jmayo86
June 7th, 2004, 05:36 PM
Cheers mate :D hmmm dnt think they are :P wait till i see Kirupa :D lol
saad
June 13th, 2004, 12:03 AM
which socket server is the easiest to use M64
Johnny64
June 13th, 2004, 05:54 AM
Well most scoket-servers work in the same way.
http://www.moock.org/chat/moockComm.zip
thats the socket I will be using for the contest if evey thing works out :)
I like it because it's simlpe so for me it's easy to use because i know how it works.
you will need to have Java on your computer
http://java.sun.com/downloads/
There are some tut's there on how to use Java.
:)
jmayo86
June 13th, 2004, 05:56 AM
I have downloaded the ElectroServer one and i think it seems the easiest to work with, i have installed the Java and now trying to get it to work, cheers Master64! :D
Johnny64
June 13th, 2004, 05:59 AM
I have downloaded the ElectroServer one and i think it seems the easiest to work with, i have installed the Java and now trying to get it to work, cheers Master64! :D
Yeah, ElectroServer comes with it's own class's so you don't have to do much with XML :)
jmayo86
June 13th, 2004, 06:01 AM
:) thats good because im still learning XML so i aint too good with it
saad
June 13th, 2004, 12:02 PM
Electro servers are 4x more expensive than the moock one's. Electro servers are like 800 while electroservers are 4000. Big diffrence, plus I think they use diffrent classes so you have relearn every thing to use unity if you start with electroserver.
saad
June 13th, 2004, 12:05 PM
M64 the moock com class is old, they have a newprogram out unity2 with UClient. Uclient is much easier because you only need flash to program in.
m_andrews808
June 13th, 2004, 12:07 PM
If you look at M64's link you'll see he's referring to Moock's free socket server not the pay to use one called I think Unity off the top of my head. The free server is very basic, the only packet it sends out is a <NUMCLIENTS> packet to all clients when someone connects/disconnects to the server. I've worked with it quite a lot and found it easy enough to use.
saad
June 13th, 2004, 12:10 PM
yea but its not as complex your may not be able to create multiplayer games.
m_andrews808
June 13th, 2004, 01:08 PM
I've created multiplayer games with it, its not as easy for sure but it is possible
jmayo86
June 13th, 2004, 01:48 PM
Ok, are multiplayer games hard to code using ElectroServer servers? Also could i ask, is the Flash Comm the same as the Electro and Unity? Because theres far much more resources and stuff for that, so why do people not just use that?
m_andrews808
June 13th, 2004, 02:19 PM
I've never used to ElectroServer to comment, if you have a look at the feature list you can see what the server does for you, anything else you'll have to program yourself:
http://www.electrotank.com/electroserver/features.aspx
how hard something is depends on your level of skill with actionscript. I'd consider it a feature for advanced users only and I think thats the genereal consensus from what I've seen. Have you had much game programming experience?
Johnny64
June 13th, 2004, 03:00 PM
Well I like commServer because the source code come with it and it free no strings attached. :)
yea but its not as complex your may not be able to create multiplayer games.
I have to disagree. Action Script is powerful enough to do just about very thing. So if the socket-server can send and receive packets it's good enough.
Sure a socket-server could keep a “who's online” list easier then AS could but it's still possible to do it with AS.
:)
m_andrews808
June 13th, 2004, 03:06 PM
here here,
CommServer is very basic but you can still do all you need, just you have to do it flash side which means more programming. It all makes for good practice though! There's no harm in doing a little hard work with code, keeps the skills sharp
jmayo86
June 13th, 2004, 04:22 PM
Yes but more programming is worth it, because theres no resources for comm servers than all these other free ones like mook and electro.
So is it possible to do everything in flash comm wot u can do in mook and electro?
saad
June 13th, 2004, 04:24 PM
yes but the folder with the chat file example M64 published previously has like 5 files including java which I dont really know but if you could tell me the site where I can find the tutorial for Commserver than please do tell me I cant deside which commserver to learn.
jmayo86
June 13th, 2004, 04:28 PM
Exactly, theres no resources for them kind of sockets, the comm server has books and tutorials online for how to use it properly, maybe i could learn comm and it cud help me out with other socket servers...wot do u think?
m_andrews808
June 13th, 2004, 04:28 PM
Do you know xml?
It only takes a few lines of code to connect to a socket server and to have a couple of functions that send data and then recieve and execute data in xml. You don't need a tutorial to use a socket server if you know how to use xml and these few lines of code to get you started.
I doubt theres tutorials specifically for CommServer, there may be for the others but they all work in pretty much the same way, its just the other servers offer advanced features for which you'd need instructions to use them, which I'm sure would be included when you purchased them.
You're more likely to need a tutorial on how to set up a socket server on your serving computer which in the case of CommServer I can help you with
saad
June 13th, 2004, 04:30 PM
Ok, are multiplayer games hard to code using ElectroServer servers? Also could i ask, is the Flash Comm the same as the Electro and Unity? Because theres far much more resources and stuff for that, so why do people not just use that?
Electro server is probably easiest to learn but its costly if you want to expand on your idea around $4000 for unlimited users. Unity is probably the second easiest costing around $800 but it can only support so many people. Flash Communication on the other can support lots of people at good speed depending on your server but this program is for big companies which is why its really costly for unlimited users the software cost around $7000 (around there) and its for only 90 days. However there are webhost which have flash servers installed in them so its much easier and you dont have to buy the software but the hosts are pretty expansive depending on the amount of people you want host.
saad
June 13th, 2004, 04:33 PM
How would you upload a socket server on a webhost do you just upload the xml file which will be connecting to the socketserver, but then where will the server be?
P.S m_andrews808 I can really benifit from that, can you get me started I first need to know where to download the Commserver from.
m_andrews808
June 13th, 2004, 04:50 PM
Okay first off you need a host which has a socket server running on it. There's no way with an ordinary host to upload anything that'll run a server on it. A socket server is essentially a small program that runs on the serving computer, a host either has one or doesn't and believe me, 99% don't. There are hosts out there that offer dedicated games hosting which do have socket server support I'd suggest searching google for 'dedicated gaming hosting' or something similar to find such hosts.
Personally I don't have a host which supports a socket server. My home computer is always on and has a resonably fast connection so I have turned that into a basic server and run CommServer on it (my footer is actually served from my home machine and connects to CommServer). I can guide people on how set their computers up in a similay way but its a quite a lengthy process and I can't guarentee it'll work.
So if you don't have a host which supports a socket server and you don't have access to a computer which is always on with a decent connection then there's no point going any further.
The first link Master64 provided on the second page of this thread is the CommServer itself, source code plus a demo file showing how to make a basic chat app in flash. You need to install the Java Runtime Environment to run CommServer, you can get this from the second link in Master64's post. But you're only interested in doing this if you can set your home computer as a basic http server
saad
June 13th, 2004, 04:57 PM
what do I ask my host do you have socket server support?
m_andrews808
June 13th, 2004, 05:05 PM
yeah something like that, I'd use the phrase 'XML socket server' and maybe name a few examples such as Unity and Electroserver.
I can give you the details of one of the servers I run which you can connect to to play around with and test and the like, it'll work fine while the flash app is running from your computer, as soon as you upload it to a webserver however it'll fail to connect due to cross-domain security restrictions. I'd offer to host any games you make but unfortunatly I was made redundant recently and need to commit my bandwidth to serving my portfolio. I'm willing to host for you, just after I've got myself another job!
saad
June 13th, 2004, 05:10 PM
can you help me get started on something just as simple as sending and reciving letter like a chat but no need to log on and etc.
P.S is the footer made with the commserver. I think I got why its magic
m_andrews808
June 13th, 2004, 06:00 PM
yup, my footer does use commserver and yes I think you've got it too
here's a basic chat fla, it'll give you the code to connect to a socket server, send data and recieve data and then process the data accordingly (Flash MX 2004)
please note that this fla doesn't actually connect to a socket server. If you'd like to connect to a server I'm running then pm me and I'll give you the info you need (this goes to anyone). I'm not including my server details just so that I've got a little control over it, I'd rather not give out the details of my server to anyone reading this post however many years down the line
cheers =)
m_andrews808
June 13th, 2004, 10:20 PM
saad has asked me over pm how to set up his own computer as a server, I though I'd post my response here as someone may be interested
Cheeres ;P
I'll run over the steps involved in setting up your own server briefly here and then you can come and ask for help if you get stuck.
First off since your ip address probably isn't static you need a static identity. Sign up here:
http://www.dyndns.org/services/dyndns/
and choose a dynamic DNS name that'll point to your home computer. Once you've done that you need to install a program on your computer that updates your account info with DynDNS each time your ip address changes so your DNS name will continue to point to your home computer. I use DirectUpdate:
http://www.directupdate.net/
give this little app your DynDNS account info and it'll keep your account up-to-date with your current ip.
Now you've got a static address you need to install an http server to allow you to serve web pages to the internet. I use Apache:
http://httpd.apache.org/
it'll need a little configuring to get it working.
If you've completed these three steps properly you (or anyone) should be able to type your dynamic DNS address into a browser and have a page appear (it'll be an apache default page to start with). Your home computer is now running as a basic server, next you need to get the socket server running on your machine.
Install the Java Runtime Environment from here:
https://sdlcweb2a.sun.com/ECom/EComActionServlet;jsessionid=sdlcweb2a.sun.com-5a2c%3A40ccf18a%3A971a2531494652d
if that link doesn't work try this:
http://java.sun.com/j2se/1.4.2/download.html
Next, get Moock's CommServer here:
http://www.moock.org/chat/moockComm.zip
you need to extract this to the directory containing your java.exe, on my computer this is found at:
c:\Program Files\j2sdk_nb\j2sdk1.4.2\jre\bin
but I have the full developers pack installed, your directory will probably be more like:
c:\Program Files\j2jre_nb\j2jre1.4.2\jre\bin
at any rate the last part of the address will be jre\bin
the socket server is now installed, you just have to run it and you're all done (almost)
to run the socket server open up a command prompt and change to the directory containing java.exe with:
cd c:\Program Files\j2sdk_nb\j2sdk1.4.2\jre\bin
and type:
java CommServer PortNum
replaceing PortNum with the number of the port you wish to run the server across. If you've done this right you should see the message 'Attempting to Start Server' followed shortly by 'Server Started on Port: PortNum'
Phew, and thats it! You can now host your own multiplayer flash games! :hugegrin:
One last thing... to save me from having to open up command prompt and running the socket server manually each time I restart my computer I have a bat file called CommServer1703.bat saved to my computer which does it for me, just create a new bat file and put something like:
cd c:\Program Files\j2sdk_nb\j2sdk1.4.2\jre\bin
java CommServer 1703
and copy a shortcut to that bat file into your startup folder. Now each time you reboot your computer you should get a command prompt running the socket server for you when you log on.
Hope this made sense, let me know if you get stuck anywhere and I'll see if I can help. Oh and if you get it all set up drop me a line so I can have a look.
Cheers ;)
saad
June 13th, 2004, 11:21 PM
in the.fla program why is the whole code in the first frame when the actions for sending and recieving take place in the 2nd frame?
m_andrews808
June 13th, 2004, 11:28 PM
that is because they're function definitions. You can call a function from any object in any frame in the fla once you've defined them
m_andrews808
June 13th, 2004, 11:34 PM
for example if I defined a function in an fla that lets me add a shadow to a clip:
function AddShadow(Target) {
MC = Target.attachMovie("Shadow", "Shadow", 1);
MC._x = -10;
MC._y = -10;
MC._width = Target._width;
MC._height = Target._height;
}
I can add a shadow to any clip regardless of where it is with:
_root.AddShadow(this);
saad
June 13th, 2004, 11:41 PM
I dont understand this line
// This is the important function, it recieves any data send over the server and decides what to do with it
function RunPacket(Packet) {
trace(Packet);
// Extract the packet header and value information from the packet and store them
PacketHeader = String(Packet.firstChild.nodeName);
PacketValue = String(Packet.firstChild.firstChild);
What are packets and whats the firstChild.node name thing.
Plus
if(PacketHeader == "Chat") {
Whats a packet header and what does the chat stand for?
// If the packet is a chat packet add it to the chat display
if(Chat.length > 0) {
Chat += "\n";
}
I dont get theis from here
Chat += PacketValue;
}else if(PacketHeader == "WhoIsHere") {
I dont get theis to here
// If the packet is a connected users request clear the current user list and send your information
UserList = "Users online:";
SendPacket("<Handshake>" + Name + "</Handshake>");
Whats a handshake I think this is xml, but there is no xml file being used in the .fla you gave me.
}else if(PacketHeader == "Handshake") {
// If the packet is a user's infor add it to the user list
UserList += "\n" + PacketValue;
}else if(PacketHeader == "NUMCLIENTS") {
// If someone has disconnected from the server request a new users list
if(Number(PacketValue) < CurrentlyOnline) {
SendPacket("<WhoIsHere />");
}
// Keep track of how many people are connected
CurrentlyOnline = Number(PacketValue);
}
}
m_andrews808
June 13th, 2004, 11:54 PM
I dont understand this line
// This is the important function, it recieves any data send over the server and decides what to do with it
function RunPacket(Packet) {
trace(Packet);
// Extract the packet header and value information from the packet and store them
PacketHeader = String(Packet.firstChild.nodeName);
PacketValue = String(Packet.firstChild.firstChild);
this function RunPacket is executed whever a packet of data is sent over the socket server
What are packets and whats the firstChild.node name thing.
a packet is just a term for a chunk of data, e.g. when you send a message over the chat it sends your message in a packet of xml data which might look like:
<chat>Saad: hello</chat>
this is what I mean by a packet
The data sent over the server is xml, Packet.firstChild.nodeName is extracting a specific part of data from an xml packet. In the example I showed you above:
<chat>Saad: hello</chat>
Packet.firstChild.nodeName is referring to the name of the first xml tag 'chat'
this line of code:
PacketValue = String(Packet.firstChild.firstChild);
extracts the value of the first xml tag and stores it in PacketValue. In the example above this will be 'Saad: hello'
A handshake, referred to in the fla is a packet of data that tells each user certain details about yourself, in this example if give your username. Each user sends a handshake to all other users. This information is used to build the user list to the right of the chat.
There is no xml file, don't let that confuse you. The only xml used in the fla is the xml packets sent over the socket server which are generated by the flash app
saad
June 14th, 2004, 11:00 AM
thanks
jmayo86
June 14th, 2004, 06:16 PM
ok well i understand all this connecting stuff on the electro server...but i dont understand how a character can be seen by another person somewhere else, like a 3d avatar chat for instance, how does it work?!?!?1
m_andrews808
June 14th, 2004, 09:28 PM
Each client connected to the server would send out a packet with details of what their character looks like something like:
<Handshake name="Milks" id="1503544" hairID="4" skinColourID="6" topID="2" bottomID="0" shoesID="10" xCo="34" yCo="85" />
each client app has all the graphics for each hair type, skin type etc etc and relevent ID's using this information the client app can build how each users character looks on screen
jmayo86
June 15th, 2004, 04:45 AM
Ok sweet i undertstand now! its fair simple and complicated at the same time. I think i might go with using electroserver even though its the dearest of the lot, but seems easier to use.
[EDIT] You magic sig is p****n me of lol i cant sem to find out whats magic about it!!!!! :huh:
saad
June 15th, 2004, 05:20 PM
you have to be patients to figure it out
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.