I have created a turn based game. How can I make it multiplayer through the network? Like, player one on his computer can play with player two on her computer over the Internet? Do I have to write some kind of CGI or ASP to make it work?
Printable View
I have created a turn based game. How can I make it multiplayer through the network? Like, player one on his computer can play with player two on her computer over the Internet? Do I have to write some kind of CGI or ASP to make it work?
You can use XML sockets, but you'll need to build a socket-server for that (usually built in java)
You can also use PHP, ASP or CGI with a database for the server-side. Both options work well, though the socket server can be more efficient because it doesn't have to use a polling system.
Making a multiplayer game is a big step though, especially if you don't know anything about server-side scripting. I do know quite a bit about server side scripting, but it still took me several months to get a well-working multiplayer game.
Olorin
ive always wanted to do this but i have no idea how to do it. It would be really cool to make a "idiots" tut on how to do it.
Oh, I see. so, its XML hu? Is there any good web sites that might talk more about this? or any good books I could buy?Quote:
Originally posted by Olorin
You can use XML sockets, but you'll need to build a socket-server for that (usually built in java)
You can also use PHP, ASP or CGI with a database for the server-side. Both options work well, though the socket server can be more efficient because it doesn't have to use a polling system.
Making a multiplayer game is a big step though, especially if you don't know anything about server-side scripting. I do know quite a bit about server side scripting, but it still took me several months to get a well-working multiplayer game.
Olorin
Flashkit should have a tutorial on "idiots XML with socket-server". I only know how to read a XML into flash, but I dont know any thing about XML and socket-server.Quote:
Originally posted by gasattack
ive always wanted to do this but i have no idea how to do it. It would be really cool to make a "idiots" tut on how to do it.
Is it hard to make it RPG able on the web with a socket-server? Like Altima Online? or what ever that game was? So every one can play! Man, that would be cool to do it in Flash.
Yes, it's possible to do a multiplayer RPG in flash, I'll start making one after I finish some other things... But it's not easy, actually, it's very hard to do.
Oh, and I said you could use XML sockets, I never mentioned using XML. Just send normal data through the XML socket, that's a lot faster.
However, if you want to set up a socket server, you'll need to have a dedicated server (expensive! if you're just doing it for fun) so maybe using PHP might be a better idea (it's also a lot easier to do the sever side in PHP)
Olorin
Hmm.. I c. My friend and I go to the same university. I program and he loves drawing 3D animations. So, we are talking about making a online Isometric game. Any way, It would be cool if you could show a multiplayer RPG in flash! :)Quote:
Originally posted by Olorin
Yes, it's possible to do a multiplayer RPG in flash, I'll start making one after I finish some other things... But it's not easy, actually, it's very hard to do.
Oh, and I said you could use XML sockets, I never mentioned using XML. Just send normal data through the XML socket, that's a lot faster.
However, if you want to set up a socket server, you'll need to have a dedicated server (expensive! if you're just doing it for fun) so maybe using PHP might be a better idea (it's also a lot easier to do the sever side in PHP)
Olorin
I would like to learn more about this. I'm making an RPG, and I want to make multiplayer battles possible. It's tile based game, but that doesn't matter since you don't actually go around the game world online, but you can nly battl people online. Olorin, please tell me where you can find tuts, help or any information on this kind of stuff. I basically just want to know how to write and read from a file, which is the only way I know to make a multiplayer game right now, but please share any information you know that I don't! Thank you!
Learn PHP: http://www.php.net
Learn how to use MySQL: http://www.mysql.com
That's the way I did it...
I already knew perl, so php was easy for me, but if you're already a good programmer, php shouldn't be a problem.
Olorin
They made the coolest network game I have seen:
http://www.hypraspeed.com
TB
Oh, one more tip: Don't use a file to write the data to! Basic textfiles can only be open by one player at a time. If you have lots of players who want to write data to the file, some of the data might get lost because of this. It's much better (and easier) to use a database.Quote:
Originally posted by dJide
I basically just want to know how to write and read from a file, which is the only way I know to make a multiplayer game right now, but please share any information you know that I don't! Thank you!
Olorin
Thanks for the help! How do databases work though?
follow the two links I gave, there's loads of info there on how to get data into and out of a database. It might take a couple of days/weeks before you've got the basics down, but once you know the basics, it's all pretty easy from there.
Olorin
I have a question, how about learning the JAVA part for the socket connection? Where do I learn that part?Quote:
Originally posted by Olorin
follow the two links I gave, there's loads of info there on how to get data into and out of a database. It might take a couple of days/weeks before you've got the basics down, but once you know the basics, it's all pretty easy from there.
Olorin
http://www.wdvl.com is a great site to learn about almost any web based programming language. Java is there too. But unless you're already skilled at some other programming languages, I'd stay away from Java, cause it gets pretty complex quite soon. I spent about 2 weeks trying to do stuff in Java, and didn't really get far. With PHP, you can write a script that sends and retrieves data from a database the first day you work with PHP. (well, that was my experience...)
Also, remember that you need to have a dedicated server for socket connections. A normal web-account doesn't support open sockets, because it's a bit of a security risk (hackers).
Olorin
Hi
I'm not sure how aware you are of IRC, but it allows users to join rooms, send messages to rooms (groups of people), or to individual people.
What I've got is a gateway, which simply bounces connections from flash, to an IRC server, and converts the messages a little to bit to allow flash to connect to IRC.
I'm currently converting the wonderful bomberman game (created by supertomato.com) to run on irc servers.
As IRC servers are free, and hugely stable I'm putting all my energy into creating games + chats for it.
You can download several clients and the gateway here:
http://www.flashnexus.com
The clients are not well coded. It was a 'learn as you go along'. However I have knocked up a library of code, which will help you develop stuff. You can download that here:
http://www.flashnexus.com/newLibrary.fla
Any probs you can email me! Alternatively, I will probably be on the server most of the day, if you would like to try the client :)
Steve
Question: How in the world can you make a Flash multiplayer game with in IRC server? I never heard of it.
Tnx.
hehe, I see your point at first, but lemme try n talk you through it. I'll use bomberman as an example.
Screen 1: Enter username/password details also rules/how to play are on this page.
Screen 2: Log you in, you will see a 'connecting' screen. Meanwhile the flash sends your login details to the server, and auto joins a #lobby room.
Screen 3: The lobby room. Here you can chat with people, banter, challenge them to a game. On the left, you will see a list of buttons, these are games people are in and waiting for more users. To find out if the room is a game, or a normal chatroom, i make each game channel start with a #bman-
On this screen you can also 'host' a game. By pressing this button you will /join #bman-myNick
Once 3 other people have joined.. i +I the room, to stop anyone else joining.
Screen 4: This screen shows you which coloured character you are. When the host is ready to start a message is sent to the channel. EG HOST,READY
The clients will receive this message, and start the game.
Screen 5: the game screen. After each keypress a message like: MOVE,MYPLAYER,xCord,yCord,Action will be sent to the channel. Each client will process this, and change the display accordingly.
I've not gone into too much detail, I will make a simple game example when I get time. Untill then I will finish the edit of bomberman, and show you.
Steve
Hmmm.... so if I understand correctly, Flash posts variables into the irc chat room, and retrieves the variables others post there?
If it works like that, it would be a REALY kewl option instead of xmlsockets.
Yep, flash posts your variables, etc into the chatroom, then all those in the room will receive that data.
This is still using xmlSockets, just not using XML data.
Steve
Emphatic, that's a really intriguing concept, do you have a working example of it we could see? if the method is simple enough it could be a heavily adopted technique...
the downside of using IRC is that you can't link it to a database. (or can you ?) So, it wouldn't be a suitable method for a game like an RPG.
Olorin
This sounds very good to me. The only question I have is, does this like post up the info up in the iRC chat thingy? or is it seperate from the chat altogether? If it's just a cheap thing with the chat thing, hacking can be VERY easy, just by puting in the info you want. But either way, this sounds good if it runs fast. Please tell us more!!
Basically, what Emphatic is saying is that instead of using a socket server ("custom" or otherwise) for his game to broadcast any one client's data to all other clients ("client" meaning the Flash player), he is instead having all clients "listen" to an IRC channel which all clients post to. So if client sends a message to the IRC channel, all other clients "listening" to it (via XMLSockets) will get the message. This is the same way a socket server works, except that a "custom"-designed socket server can be have functionality built into it to allow database interaction to occur for specific events. To do this with the IRC method, you'd have to set the "host" client to access a database separately and then post any DB results to the IRC channel, which is inefficient and can get confusing.
Sure you can. The client can communicate with a MySQL database with php, right?Quote:
Originally posted by Olorin
the downside of using IRC is that you can't link it to a database. (or can you ?) So, it wouldn't be a suitable method for a game like an RPG.
Olorin
Don't see any problem with that....
-Jeroen
Yeah, but then the client would be communicating with the irc server AND with php. That's not very efficient.Quote:
Originally posted by jeroen84
Sure you can. The client can communicate with a MySQL database with php, right?
Don't see any problem with that....
-Jeroen
Olorin
IRC can be linked to databases with a bot. Basically 1 programme, an extension to irc if you like, could overview the way things go in the room. It could be responsible for score keeping, or logging.
I built the original flashNexus, which was pretty popular, due to it's database interaction, but i've been an irc junkie for years, and I know of thousands of ways of doing the same thing.
Eggdrop is one type of bot which will run on multiple servers at one time. It has the ability to be scripted with TCL or C/C++. Some of the scripts available give you the ability to talk to mysql, send SMS messages or update websites.
ALICE has been brought up here before, the 'artificial intelligence'. Alice has a script for irc.
Basically what I'm saying is.. If you are making a game for a big client, and can afford fortress, or unity, and you need the database interaction, then go for it. However if either you haven't he budget for that, or want to play about with alternatives, then this might be a viable one.
I'll have 4player bomberman back online today, thanks to superTomato.com for the original game, i've edited it for irc. (with permission i'll add :)
Steve
I still think the best option is to script the backend yourself. That way you can get everything you need, and nothing else, so you'll have the most efficient backend. And you'll learn a lot from making your own backend.
Olorin
I agree. If you can script the backend, do it.
The amount i've learnt about the internet, and flash during my nexus projects, has been far greater than any book has taught me.
I decided to eventually use irc servers for my final backend, was purely for stability reasons. I can code some C/C++ but i'm by no means a pro. SO I wanted a free solution, which was tried and tested. In stepped IRC.
If you can code your own backend, even if you don't finally use it, it's a very worthwhile project.
Steve
I think we're done here. This Post is closed. It has finally been decided that coding your own stuff is very worthwhile and educational, if you're willing to risk it not being perfect. But we can get better and improve our own stuff but not someone else's. Signing out...
Emphatic, could you explain to me how I could make game interaction with IRC and how you can make such a bot?
Maybe in a tutorial, or with sourcefiles. Or maybe you could just send it to my email...
It surely sounds kewl.
Jeroen
Emphatic, could you explain to me how I could make game interaction with IRC and how you can make such a bot?
Maybe in a tutorial, or with sourcefiles. Or maybe you could just send it to my email...
It surely sounds kewl.
Jeroen
Share the info!!
dJide.... if you steal my txt, at least put your own name below it....
-.~
Hi
There's several examples on my site, however I will quick link them here.
This example is very simple, and was designed so. All it does is move a blob around the screen. However as people join the room, their blobs will be added to the screen and u can see them move.
http://www.flashnexus.com/char.fla
Like i said, really simple, but it's a start.
I'll have bomberman up by tomorrow, i will post the link when it's ready to show :)
Steve
Looks great... But to see an example to work would be even better..
tnx
-Jeroen
But doesn't this require the gatway to be ran on a server somewhere?
Yes
You need a shell account or a dedicated server to run the nexus on the same domain as the website you intend to run it from, unless you are using a projector.
Steve
This is an excellent thread, I've learned more in the last five minutes than I usually do in a week at flashkit.
Server-side stuff is my weak spot when coding games.
Top!
O_o
Emphatic... You said that all you needed was a free IRC server....
???