1. Post #1
    Dennab
    March 2009
    1,572 Posts
    I'm currently moving via the server (xajax powered), a move sends in a request, calculates if you can move, sorts out enemy battles and so on and sends it back. The problem is, this makes moving rather slow compared to a javascript solution. However, with javascript, people can basically set their own battles up, which I definitely can't have. Plus I need to update other players on the same map, so I need to send the players position in anyway.

    I could just leave it of course, just slightly slow, it's not *too* bad, and there's always trains/etc to get around fast.

  2. Post #2
    Gold Member
    Vampired's Avatar
    February 2005
    374 Posts
    Send key presses to the server instead of positions, then send the positions of all players back to the client and do predictions there.

  3. Post #3
    Dennab
    March 2009
    1,572 Posts
    Well currently it kinda does:

    Key >> server, server calculates position >> updates all players on the map, sends a battle if there is one

  4. Post #4
    Dennab
    May 2007
    1,532 Posts
    Send key presses to the server instead of positions, then send the positions of all players back to the client and do predictions there.
    wouldn't that be really insecure?
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 1 (list)

  5. Post #5
    Gold Member
    Robber's Avatar
    January 2006
    6,123 Posts
    Why?

  6. Post #6
    Dennab
    March 2009
    1,572 Posts
    It sends all positions back anyway, it's using a series of 901 html squares, each 16px by 16px with an id, the server just sends back the id's and players inside.

  7. Post #7
    Gold Member
    Darkimmortal's Avatar
    April 2009
    2,737 Posts
    Open a socket with Flash
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Disagree Disagree x 1 (list)

  8. Post #8
    Dennab
    March 2009
    1,572 Posts
    Never used flash in my life, and really don't want to learn xD Is that the only way?
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Dumb Dumb x 1 (list)

  9. Post #9
    Gold Member
    The Inzuki's Avatar
    August 2008
    4,585 Posts
    There's also Java.
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 1 (list)

  10. Post #10
    Hibame's Avatar
    January 2006
    40 Posts
    There is always comedy option ActiveX.
    Reply With Quote Edit / Delete Reply United States Show Events Funny Funny x 13Friendly Friendly x 1Dumb Dumb x 1 (list)

  11. Post #11
    Alex22's Avatar
    October 2005
    90 Posts
    Silverlight :3
    Reply With Quote Edit / Delete Reply Germany Show Events Funny Funny x 3Agree Agree x 2Dumb Dumb x 1 (list)

  12. Post #12
    DrDaxxy's Avatar
    October 2007
    491 Posts
    Open a socket with Flash
    Why?
    As a Comet alternative that works without Flash there's long polling (well, kinda like Comet, but requests are aborted and re-made after a timeout, or after information has been sent, whatever comes first).
    Reply With Quote Edit / Delete Reply Germany Show Events Agree Agree x 1 (list)

  13. Post #13
    Gold Member
    CrashLemon's Avatar
    November 2007
    991 Posts
    Send Key Push and Key Release and use prediction on the client. You update the pos when a key is pushed/released so if anything goes wrong on the client it'll fix itself.

  14. Post #14
    Dennab
    March 2009
    1,572 Posts
    Nothings going wrong, it's merely lagging. But moving on the client and updating the other players is also a mess, since it'll all get out of sync with the server. What I need is an always open http socket, possible (without running hacky methods like php scripts which never end...)

  15. Post #15

    August 2009
    129 Posts
    Neat sounding game.

    Using client side prediction sounds like the obvious choice here.

    Do you have a link to your game?

  16. Post #16
    Dennab
    March 2009
    1,572 Posts
    It's private beta right now, there's images though:

    http://winsaucestudios.com/forum/ind...sa=album;id=12

    It's definitely the most complicated PHP I've coded :P
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Artistic Artistic x 1 (list)

  17. Post #17

    August 2009
    129 Posts
    It's private beta right now, there's images though:

    http://winsaucestudios.com/forum/ind...sa=album;id=12

    It's definitely the most complicated PHP I've coded :P
    Cool!

    Are you doing gradual per pixel movement, or moving instantly between grid blocks?

    I reckon some nice client side prediction would work really well, prediction does not mean people can cheat.

    As for AJAX, look in to 'Comet' I think the lingo is (this is what GMail uses), it maintains a connection to the web server. This may be better for your game to increase response time (no need to setup a connection for each 'move'), but of course then you need to maintain that many concurrent requests.

  18. Post #18
    Dennab
    March 2009
    1,572 Posts
    Instantly between blocks. Yeah I'm looking into it, the response time is the only issue, on localhost it's perfectly fast.

  19. Post #19
    Ban me if I have a NWS avatar
    User.'s Avatar
    January 2006
    600 Posts
    this is what you want: http://code.google.com/p/moo-comet/

    it's a realtime data streaming script written in js and php (uses the mootools framework)

  20. Post #20
    TheWall's Avatar
    May 2007
    11 Posts
    Pardon my ignorance, but it's a multi-player game, right?
    If it were single-player, none of the computation would be performed by the server, but rather entirely by the user downloading the program, to my understanding.
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 1 (list)

  21. Post #21
    Gold Member
    Joerdgs's Avatar
    July 2005
    372 Posts
    Pardon my ignorance, but it's a multi-player game, right?
    If it were single-player, none of the computation would be performed by the server, but rather entirely by the user downloading the program, to my understanding.
    Exactly right. Server - client programming is only required for multiplayer. It'd be stupid to use it for pure singleplayer games.
    Reply With Quote Edit / Delete Reply Netherlands Show Events Agree Agree x 1 (list)

  22. Post #22
    Gold Member
    jjsullivan's Avatar
    December 2008
    3,536 Posts
    Open a socket with Flash
    Because flash is for rich people with the money and the time to buy it.

    Most people however do not posses this.
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 1Disagree Disagree x 1 (list)

  23. Post #23
    Plastical's Avatar
    August 2009
    583 Posts
    Silverlight is actually pretty good.
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 2Informative Informative x 1 (list)

  24. Post #24
    DrDaxxy's Avatar
    October 2007
    491 Posts
    What are the up/down/left/right buttons for?
    I'm pretty sure you can capture up/down/left/right keypresses with JS.
    Reply With Quote Edit / Delete Reply Germany Show Events Agree Agree x 1 (list)

  25. Post #25
    Dennab
    March 2009
    1,572 Posts
    What are the up/down/left/right buttons for?
    I'm pretty sure you can capture up/down/left/right keypresses with JS.
    Already am, but they were from when I wasn't, I'm just leaving them for those who want to click I guess.

    Also, of course it's multiplayer, otherwise it'd be stupid to have server calculate stuff.