Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: AJAX Gaming Server?

  1. #1
    Sup3rkirby is offline x10 Sophmore Sup3rkirby is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    A small town in a small city
    Posts
    181

    AJAX Gaming Server?

    First, please make sure you know about AJAX and probably a bit about PHP before you attempt to help me.


    Ok. So while I don't exactly have the time right now, I will have some time later to work on some new ideas and scripts. Of course one of these is a mode of game play(for a game I'm developing) and I would like to integrate a system that lets you play with other users asynchronously(hints: AJAX). Of course I am no guru or even that good with flash and most games I've seen that let you actively interact with users in more than one place have been done in flash.

    So for anyone who really knows about AJAX and PHP, would something like this work well in AJAX? I am just curious about the game being able to run smoothly. There wouldn't be heavy graphics and fast action. I am just not sure how fast AJAX can send and recieve to a PHP script on a server to work as a game server.

    If you need a bit more of an explaination, lets say the game simply has little avatar like characters that are moved with mouse clicks(well, hold down the left mouse to move and the avatar follows the mouse). You have a small map(640x480) and you want to run maybe 5 players on that screen. Now how well would AJAX be able to send and recieve data with these 5 clients if it was sending to a PHP file that saved variables(character positions, character stats, etc.) and then sent back out all the information to each client? I wouldn't mind something like a slight delay for other users in the game with you. Such as the other 4 players on your screen might lag 1-2 seconds, but this game does use action so it doesn't matter if they lag a bit.


    Just curious about this all. I've done an AJAX chat(W.I.P.) and have managed to be able to send and receive data with quite a few clients. My chat system could probably hold 50 or more and there is only a delay because the chat refresh timer is set to 2 or 3 seconds. So I would assume AJAX could handle well. But for a game I would like to set a timeout for about 100-500 ms.
    You are a 'real' programmer not when you write a program that has no errors, but when you write a program that has no errors, and that bothers you.
    "Given billions of tries, could a spilled bottle of ink ever land in the words of Shakespere?"

    -= The Last Mod of Zeeblo =-

  2. #2
    Slothie's Avatar
    Slothie is offline Lord Of The Keys Slothie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Singapore
    Posts
    1,432

    Re: AJAX Gaming Server?

    I'd use flash for that then, for realtime gaming (as well as extensive graphics), AJAX wouldn't be your best handler.


    If you intend your character to walk, you'd have to use sprites to simulate the motion.

    While its doable, why give yourself a hard time when flash can do the job equally well (if not better)

    Easiest 70 points you'll make on x10

    Feel free to add my reputation by clicking on the if you found my post helpful to you :P


    If I am not responding to your PMs, that means I am ignoring you. Take a hint.



    09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0


  3. #3
    nightscream is offline x10 Lieutenant nightscream is an unknown quantity at this point
    Join Date
    Feb 2006
    Location
    Hallaar, Belgium
    Posts
    474

    Re: AJAX Gaming Server?

    I don't know much about ajax but Slothie is right, you have to use sprites and in flash it would look better and it would be smoother to play!
    ------------------------------------------------------------------------------------------
    If you have any troubles with a website or a script, just send me a pm.

    I also code websites in xHTML/css, can code javascript and php too if needed

  4. #4
    Sup3rkirby is offline x10 Sophmore Sup3rkirby is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    A small town in a small city
    Posts
    181

    Re: AJAX Gaming Server?

    Ehhh... but the problem is, I'd have to learn flash(actionscript) and well, I'm not one to have much time right now. I already know a pretty good bit about AJAX to be able to slap together a server script, then of course tweak it to fix bugs and such.

    As for walking animations, I have had quite a few ideas just using things like html and either simple js, or using js to completely automate the animation. Some would say it is more work, but I am somewhat of a js expert and I find it easy to code things like that. but one of my ideas actually would only use a small portion of js and should work just as well as flash.

    I will have to set up some basic trial code and try to run two clients on the ajax server to see how well ajax can actually handle active clients and data.

    I'll post back here after some testing.
    You are a 'real' programmer not when you write a program that has no errors, but when you write a program that has no errors, and that bothers you.
    "Given billions of tries, could a spilled bottle of ink ever land in the words of Shakespere?"

    -= The Last Mod of Zeeblo =-

  5. #5
    Micro is offline Retired staff (11-12-2008) Micro is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    West Midlands
    Posts
    1,301

    Re: AJAX Gaming Server?

    Really and truly you need a separate server if you want a 100ms->500ms refresh time, even then you would need to "interpolate".

    A better idea is a 3d game/2d game with XNA (Windows), and use a PHP server side, with lots of client interpolation.
    Micro

  6. #6
    Sup3rkirby is offline x10 Sophmore Sup3rkirby is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    A small town in a small city
    Posts
    181

    Re: AJAX Gaming Server?

    Ok. let me start over.

    I have a TEXT-BASED browser game. I am looking to soon integrate a system to allow users to interact with other players of the game.

    The only graphics used will be for a simple movement system. You see, text-based games do not appeal to everyone. They do have all the essential elements needed for a good game, but without the real-time interaction of graphics, a lot of people will not play.

    So to solve this I am developing a 2d graphics system. So if you want to go here in the game to do this(take your band to the studio to work), you walk your little avatar to the area that is the studio. It will give people a better feel for the game and should make it more enjoyable.

    There will be no live action/interaction. It is more showing two seperate avatars on the screen at the same time, and when one avatar(on your pc) decides to move to point B, it will show up for me on my pc. It doesn't need to be instant and can lag a bit. The game engine is text-based so if you know about the subject then you will know that there is no user interaction needed for essential game actions.

    Long story short, this is soley a browser game that isn't heavy on graphics. The graphics are a compliment to the true engine and gameplay. I simply wanted to connect users through some server scripting, and wanted to know how well ajax could handle such things. I wasn't really looking for a replacement.

    And Micro, for a 100-500ms response time I doubt I need a new server or anything. How much do you know about JS or AJAX? I can set a timer in JS that can run every 1 ms if I wanted to. And I have successfully run a timer every 1 second(1000ms) for a chat server solely written in AJAX and PHP. I'm pretty sure if I set the timeout to 100-500 then it would probably be a matter of bandwidth with all the constant server communication.
    You are a 'real' programmer not when you write a program that has no errors, but when you write a program that has no errors, and that bothers you.
    "Given billions of tries, could a spilled bottle of ink ever land in the words of Shakespere?"

    -= The Last Mod of Zeeblo =-

  7. #7
    Slothie's Avatar
    Slothie is offline Lord Of The Keys Slothie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Singapore
    Posts
    1,432

    Re: AJAX Gaming Server?

    As well as resource usage depending on the amount of users you have.

    Easiest 70 points you'll make on x10

    Feel free to add my reputation by clicking on the if you found my post helpful to you :P


    If I am not responding to your PMs, that means I am ignoring you. Take a hint.



    09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0


  8. #8
    Micro is offline Retired staff (11-12-2008) Micro is an unknown quantity at this point
    Join Date
    Jul 2006
    Location
    West Midlands
    Posts
    1,301

    Re: AJAX Gaming Server?

    Quote Originally Posted by Sup3rkirby View Post
    Ok. let me start over.

    I have a TEXT-BASED browser game. I am looking to soon integrate a system to allow users to interact with other players of the game.

    The only graphics used will be for a simple movement system. You see, text-based games do not appeal to everyone. They do have all the essential elements needed for a good game, but without the real-time interaction of graphics, a lot of people will not play.

    So to solve this I am developing a 2d graphics system. So if you want to go here in the game to do this(take your band to the studio to work), you walk your little avatar to the area that is the studio. It will give people a better feel for the game and should make it more enjoyable.

    There will be no live action/interaction. It is more showing two seperate avatars on the screen at the same time, and when one avatar(on your pc) decides to move to point B, it will show up for me on my pc. It doesn't need to be instant and can lag a bit. The game engine is text-based so if you know about the subject then you will know that there is no user interaction needed for essential game actions.

    Long story short, this is soley a browser game that isn't heavy on graphics. The graphics are a compliment to the true engine and gameplay. I simply wanted to connect users through some server scripting, and wanted to know how well ajax could handle such things. I wasn't really looking for a replacement.

    And Micro, for a 100-500ms response time I doubt I need a new server or anything. How much do you know about JS or AJAX? I can set a timer in JS that can run every 1 ms if I wanted to. And I have successfully run a timer every 1 second(1000ms) for a chat server solely written in AJAX and PHP. I'm pretty sure if I set the timeout to 100-500 then it would probably be a matter of bandwidth with all the constant server communication.
    I'm more with the 3d FPS games area, but i know my stuff.

    at a 500ms refresh time, it might not be so bad. but 100ms

    10 conns a second * clients = 20 -> 100 connections to the x10 servers a second.
    Micro

  9. #9
    Twinkie is offline Banned Twinkie is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Ft. Lauderdale, Florida
    Posts
    1,389

    Re: AJAX Gaming Server?

    Honestly, it would not run smoothly and it would be twice as difficult to make. You should use Java or flash. When you use ajax the delay is about 2 seconds just for a simple poll, it helps to use something that is more gaming friendly.

  10. #10
    mitamata's Avatar
    mitamata is offline x10Hosting Member mitamata is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    Canada
    Posts
    81

    Re: AJAX Gaming Server?

    I would advise against this, unless you find a really good server to host this on and expect only people with good computers to play the game. I've did quite some work with Ajax, we've designed an application that uses GoogleMaps + Ajax to display the position of cars on a map. It refreshes the car positions once every 5 seconds and the browsers on some computers don't like it, at least not for long. As for the delays, it depends on the query and server. With a good server, Ajax can show results instantly, without a problem. It just depends on what you're having it do.
    Anyway, in theory, it should work and it's not too hard to implement, so you could give it a try if you really like the idea. Good luck

Closed Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Website is down
    By JeffreyWalters in forum Free Hosting
    Replies: 17
    Last Post: 11-28-2007, 12:16 PM
  2. 500 Internal Server Error on my Joomla admin area
    By Veivei in forum Free Hosting
    Replies: 2
    Last Post: 09-05-2007, 11:58 AM
  3. Server consolidation and move
    By Corey in forum News and Announcements
    Replies: 36
    Last Post: 09-04-2007, 02:37 AM
  4. PHP Server Status.
    By Nathan in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 07-12-2005, 08:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers