web scripting for a game

Discussion in 'Computer Science & Culture' started by WAJ, May 21, 2002.

Thread Status:
Not open for further replies.
  1. WAJ Registered Member

    Messages:
    22
    This is quite an out of the blue question, but is it possible to use JavaScript or PHP or any language (except ASP) to make an online multiplayer game?

    To be more specific, I would like the script to function so that when the user clicks on the page a variable is sent to the server and to the same page on other people's machines.

    Here is a temporary link to the page as it exists:
    http://www.timhewitt.game-control.com/waj/csstest2.htm (IE only).

    It is a simple HTML/JavaScript page that enables the user to click on and off various 'pixels' in the grid. Each cell in the grid has a value in an array. I would like it so that if one of these is changed (clicked on or off) the information is sent to all the other players' pages where it is changed identically (they would be currently watching to see what is being drawn).

    I've heard that this can be achieved quite choppily using ASP--except my server does not support ASP. Is it possible by any other means? I know javascript and php quite well--thse would be the ideal languages to use.

    I don't know if this is the right place to ask, but hopefully somebody knows something that could help me

    Please Register or Log in to view the hidden image!

     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. WAJ Registered Member

    Messages:
    22
    Could anyone at least give me any direction to head in to find my answer? A friendly community website perhaps?

    This problem sucks.
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. Stryder Keeper of "good" ideas. Valued Senior Member

    Messages:
    13,105
    It is possible to script a multiplayer game with PHP and ASP as long as you make sure you include a database like any of the SQL range.

    The games themselves might not have extreme graphical quality but using a database the information can be changed.

    Alternately if you after a language to develop a MUD (Multi-User Domain/Dominion) then you might like to look towards Java, that of course might be a bit high end for what your asking, in that case you could merge Macromedia's Fash or Shockwave with some database included.

    I've been looking (not to hard) at Perl, but it would really onl be of use for turn based numeric expression changes rather than realtime gaming.

    (Those sorts of games are usually C++, and the way they are created is through GUI engines, namely a programmer makes an engine, that in turn makes the game.)
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. WAJ Registered Member

    Messages:
    22
    stryderunknown

    I know you can make games with PHP and ASP, and I do have an SQL database, but, as I say, I cannot program it in ASP (because I have no knowledge or software for it) and, as for graphics, that's not important--i want it to look like the page on the link above, more or less.

    Java, again I could look into, but it's a lot harder than JavaScript and, in this case, I don't have the hardware for it (my machine doesn't support the Java programme).

    Flash and databases? I've tried in the past to get this working somehow, without success. As far as I could determine, Flash only works directly with XML files and I couldn't get any PHP conversion accepted.

    Perl, again, works only with turn-based systems as it it similar to PHP, is it not?

    Now C++. That sounds more promising. I have Microsoft Visual C++ and I am starting to teach myself that (slowly) but I still have NO idea how to do anything graphical, let alone web-based.

    It's just a shame that it's not simpler--Nothing in life is, I know that. I just seem to come across every problem and walk into every wall. Still, if anyone knows anything that can help me (ideally a way to use PHP, a database and JavaScript or something to make a realtime game, based on the page (link given above)) then please tell me!

    God, I feel like a novice

    Please Register or Log in to view the hidden image!

     
  8. Stryder Keeper of "good" ideas. Valued Senior Member

    Messages:
    13,105
    I think SQL should be easy to talk to through PHP/ASP/PERL as I have a friend using a SQL database with a Guestbook.

    The main question with gaming is "Bandwidth", as the more you use the more likely your server (or the server your running it on) is going to get bogged down with requests.

    It's admittedly good to have the persons computer do the calculations of a game, but the problem then is that the game can be undermined by people exploiting your code.

    Really you have to try and work out how to lower the information that needs to be stored to a complete minimum just for the sake of bandwidth.

    As I mentioned though most people that program a game (Any complex ones) usually build a GUI, and you pretty much hit the nail on the head for why... For Ease.

    Well not just for ease, but lets say you have a team of programmers with different experience, and you want them to work on one game. If you've got the Building tool done, then almost anyone can add and build to it.

    As for your Game?

    Well that's where I've got to question what sort of game do you intend to make? Your best drawing up a plan of what the game does so you know what your working too. You might be then able to work out the best method of making the game.

    (I suggest a method of Modulating, just incase you want to make changes)
     
  9. WAJ Registered Member

    Messages:
    22
    Well I know what kind of game I'm making. It's based on the page given above; it's a multiplayer drawing/guessing game. I know it's silly but I've got to start somewhere. The only problem I have (so far) is what I like to call the "online" bit: I need to be able to send information from one machine to another "realtime" whenever something is clicked. It's nothing to do with databases or huge amounts of information as far as I can tell. Preferably (and this might be pushing it) I would like to be able to program this "online" component and add it to the existing page, using a non-compiled language or a few non-compiled languages.

    Now, the main problem I see with this is that I have not seen something like this done before. This is probably due to the fact that the languages I have in mind cannot be used in such a way, or perhaps that they haven't been put to this purpose.--Either way, I just would like to determine if it can be done. Otherwise, what could be an alternative approach for my particular game?
     
  10. Stryder Keeper of "good" ideas. Valued Senior Member

    Messages:
    13,105
    I should of used the correct coining before, There's Client-side (What Javascript does) and Server-Side (Where the work is done by the server.

    You could use "Cookies", but again that's only any good for score keeping on one computer, where as it would make more sense using PERL.

    Javascript is handy to allow you to understand how other programming languages work, so it should be a doddle to start looking into PERL.

    I know for a fact that PERL can (with the aid of a CHMOD priviledges) can write any "Variables" into a text file. With the aid of a piece of script it can be read also, this means you can have your own database without the need of a SQL setup.

    (in fact if your really cunning you can have a .js file created with the variables in through PERL, so you can still use Javascript, just PERL keeps track of the variables for you.

    This will of course mean that you should try to encompass an end of turn button, that will send the data of what moves have been played to the server, for it to work out how to store and show the information.

    http://www.perl.com/
    You can download one of the many O'Reilly PERL books in E-Book format (HTML), so there's no excuss for purchasing large amounts of pricy paper. (Although having a paper back handy can be useful for Flicking.)
     
Thread Status:
Not open for further replies.

Share This Page