TankWars php multiplayer test

0 favourites
From the Asset Store
Paypal PHP Supports multiple platforms, Web/html5 Android, IOS. (Including storing transaction data)
  • For another game I am making, I need to test php connectivity, so I am doing some tests for some php performance with this dummy game to see if it can support my ideaof multiplayer gaming

    current online webvesion: Tankwars

    1 large map 5kx5k, unlimited players

    (though information says only 16, I would love to see it break :P)

    Embeded screen size 800x600

    Ajax posts to https php page with mysql back end with shared security tokens.

    Events should get updated around every second or so, depanding on user internet speed and web server performance.

    The tanks move a bit slow, but it helps sync :P

    Got some familair tanks *pokes scirra*, sadly only the 0,90,180,270 tank angle images are aligned with the shots, so with the other angles the shooting looks a bit crooked :

    Its for fun and tests, feedback appreciated.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the help from the c2 community <img src="smileys/smiley19.gif" border="0" align="middle" />

    par a few who clicked ... thanks anyway :P

    I did however had more peeps testing and giving crucial feedback which lead to a day of freaking and adjusting hehe

    now .. a kewl result might intrest some, ...

    I used functions to call ajax post to a https php page (encrypted ssl), I eventually rigged the whole system to instantly do a new update request for data, executing a load of queries on php, where my ajax return data generally looks like:


    and bigger, as this batch has no notifications ...

    Anyway ... it might intrest some that all my requests got processed avereging ~210ms


  • lennaert

    I clicked yesterday :)

    Couldn't find anybody to blow up :(

    Ran out of time so comment is late...

    Very cool, would love a tutorial on this - ha ha, as it is extremely good multiplayer (I didn't have anyone else online though) but if there game play was like mine, it is super cool.

    210ms isn't bad at all.

  • Hi, thanks for the reply :D

    Early yesterday I had to redo a lot of the mechanics, so in various moments other enemies werent getting generated. they are now though, also it should show names somewhere around the tanks :)

    Scores are being kepped permanent, if you die, you can restart now and play on with your scores, it also tracks how often your killed.

    I'll add a highscore later on just for kicks.

    I also added information displaying who killed who on the fly and when someone enters the game.

    Each page refresh positions you somewhere random on one of the distribution points. This is to accomoate for the enormous space.

    Problem with this thing is it needs a lot of players to battle and have fun hehe.   

    For each browser you open the link in it will create a new profile and will be permanent on that device in that browser as long as the local storage is available :)   Only thing I noticed here is that CS2 hoold/resume with focuss can take a punch at the ajaxing.

    And yes, everyones game play is the same, par IE11 glitches, but thats microsoft related hehe.

  • Cool, got 1 kill. Damn walls/maze takes forever to get out - ha ha.

  • Quit many ajax request will be expensive if you have more player. Wouldn�t node.js be there better ?

  • Darklinki

    Well, it seems to work fine, I just broughtt 20 players to life, (whom had died and not returned yet) and gave it a whirl.

    Had 27 players being updated rapidly, I think my cs2 will be the first bottleneck. On full screen movement was a bit choppy, small screen it worked ok :)

    Also, Havent dont anything yet with node.js, got it installed, but thats it.

    I want to have it running on a decent server, with lots of mysql databases.

    I'm a php programmer by nature, and so many stuff I can do with php mysql in minutes what takes hours for js techniques.

    If these tests would be terrible, I would have made a switch, but so far so good hehe :D


    Cool, got 1 kill. Damn walls/maze takes forever to get out - ha ha.


    you can use the refresh to start at another location, mind you, your old tank will take 3 seconds to be updated to the new location, in which time you cna still be killed :P   (prevent quick flee lol)

  • I did restart to refresh, but I refreshed at another point in maze.

    As for ajax request being expensive, if you got a good server it shouldn't be too much of a problem. Obviously if it goes into thousands players, it should get problematic.

  • lennaert DUTOIT yes thats what I think, what will you do if 1000 or more player will connect at the same time. I�m also a php developer but I prefer node.js cause it just fits there better. But I think it will works why not, lets try it ;)

  • Yeah I think with over 50 players it wwould become problematic already, not so much on the php side, but more on the app/client side.

    Every update it fetches all the info from the players alive and process/updates it.

    Perhaps I should look into doing targetted update requests.

    IE, only update/process the units in x distance around the viewport.

    That might actually work and greatly improve performance, allowing support of more users.

    Perhaps for a later stage, so far still good hehe

  • A good server with above average specs should handle a hundred or so no problem.

    A 1000 or more players. Load balancing and server clustering - Probably Load balancing switches. I'm not an expert in this :) would be needed.

  • A 1000 or more players. Load balancing and server clustering - Probably Load balancing switches.


    PHP/mysql is able to process sooo much information in half a second, with the current mechanics I have, I doubt it would become an issue up to 1000 players. As long as your using a dedicated host (not private single server) Generally, good webhosts have so much capacity nowadays ....

    That lennaerthohe.nl address, hosts 2 sites, several other highscores and mmorpgs, and this tank game, and so far I can see its hardly having any impact :)

    Good times ^_^

  • As long as your using a dedicated host (not private single server) Generally, good webhosts have so much capacity nowadays ....

    And not VPS.net lol, 4gig ram with them is equavalant to 1gig elsewhere. I was with them for over a year and it was the worst experience ever. I also had mediatemple, etc and could compare very accurately that VPS>NET suck.

    I like wpengine at the moment(I favor wordpress as cms) and those guys can sure take on some serious server load. And one less thing to worry about - updates, caching, etc etc etc. Guess you get what you pay for.

    Agreed, good times, and only getting better.

  • Updates:

    Added high score table, which shows when you are kiled.

    Your high score will consist of the kills you did during an active session, if your killed, your kill score gets reset.

    If you reload to replace yourself, your kill score goes to 0.

    Added a red dot on the radar to indicate self position.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)