actionscript udp chat program

Started by
3 comments, last by Patrick B 9 years, 1 month ago

okay... I'm pretty new to this stuff. I'm familiar with a few different languages but sever-client stuff I have no real experience with.

goal:

i have a "game" in actionscript ("AS" from now on). (There is no possibility of recoding in another language.) You create "messages" by setting a variable, which then "objects" base their motions on. It's multplayer in that two people at the same keyboard can play against each other. But I want it to be multiplayer online. It's a 2-player game.

so now the game is:

  • player 1 sets a variable
  • everything refers to that variable in its methods and so "responds" to the change

I want it to be:

  • player 1 sets a variable and sends a message to player 2
  • player 2 receives a message and sets a variable
  • everything refers to that variable in its methods and so "responds" to the change

background info (if it's useful to you):

i've got cheap webhosting... like the cheapest. This is not intended for a large number of people. I want to use it for a site for people to pair up at, but I'm thinking I will have to make a "members" feature with usernames for the site, so somehow I will have to send clients' usernames on on the site as well as the messages from the client-side instance of the AS game. I use drupal (or try to) and would pull user names from this somehow. But the idea is to have people pair up on the site, then one of the pair would host and it would go peer-to-peer via udp (i think this is what I want based on a LITTLE preliminary reading I've done). So, the idea is:

  1. clients both have the same code/game (either could be host)
  2. both connect to the same "server" from within the AS game (which can tell clients which other clients are also connected)
  3. somehow, the clients can pair up, either by requesting a random partner, or by requesting a user by their username
  4. clients send messages to one another, and these get into their AS runtime.

what I need help with:

how do I set up a "server" for the AS clients to pair up at?

how do I get it so players can use this server from within the AS game?

how do I get the AS clients to message each other once they get the info they receive from the server through "pairing up" (I guess using UDP)?

another question, sort of separate from the others: if I were to put the variables on the cheap hosting server and have the clients message the server then the server message the clients with the new value of the variable, would the cheap hosting be up to doing this well/in a "real-time" way? (It would be handling a most a few 2-player games, small number of variables per game but getting passed regularly and possibility concurrently.)

Thanks for reading and for responding (if you choose to).

Advertisement

There is no possibility of recoding in another language


Can you change the code at all? Is the problem "I don't want to spend a bunch of time porting the game over" or is the problem "I can't actually change the code of the game"?
enum Bool { True, False, FileNotFound };

I can change the program but can't really re do it.


how do I set up a "server" for the AS clients to pair up at?

You probably first need to do away with the bargain basement hosting.

You will need to set up some program running something other than flash and AS to do this, most likely python, C, or perl or any language that can run in the background on a server. At the least, you will need a cheap shell host, or a virtual server.

To allow for match making ("pairing") clients you will need to route your initial game data through the server program, potentially the entire conversation, as this is the most effective way to get around nat and firewalls.

I recommend you learn some extra programming languages and libraries for online games, these will allow you to do what you need to do.

Don't give up though, with what you've learned from AS you already know the concepts you need, they just need reengineering as I doubt everything you want to do can be done efficiently in a Web based request/response paradigm.

Good luck!

Something like this may be useful: http://patrickbay.ca/blog/?p=307

This topic is closed to new replies.

Advertisement