0 Favourites

TankWars php multiplayer test

  • 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.

  • 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:

    updateplayerspositions|2889.08[]3183.02[]22.5[]b1dedc6272fbb0ba802ddcb5db1804b2[]2[]e6564ad047faccfe230da31b5826e3c9[]no[]player4[-]4642.81[]208.802[]270[]b1dedc6272fbb0ba802ddcb5db1804b2[]3[]b26a443cc7798405afde6bb257c6ff1c[]no[]!SS[-]1845.19[]4292.37[]180[]b1dedc6272fbb0ba802ddcb5db1804b2[]4[]ad44179f3358f4c80fa82c1e42148644[]no[]68.199.98.133[-]2038.25[]4302.03[]157.5[]b1dedc6272fbb0ba802ddcb5db1804b2[]5[]7e07dde6566ccf42f178a8638631d10a[]no[]219.75.53.247[-]2423.08[]3227.92[]22.5[]b1dedc6272fbb0ba802ddcb5db1804b2[]6[]e06e9580ee5529f6259c9dec01097740[]yes[]105.236.73.132[-]2440.18[]3094.52[]180[]b1dedc6272fbb0ba802ddcb5db1804b2[]8[]78361406b92a573d40abea47360d4274[]yes[]94.212.140.34[-]2726.23[]2036.82[]90[]b1dedc6272fbb0ba802ddcb5db1804b2[]9[]612e3cedf58a712066ffc5084b18807d[]no[]187.36.215.248[-]4544.25[]1724.13[]360[]b1dedc6272fbb0ba802ddcb5db1804b2[]10[]1dbf40699d17574be7891ca1ee61ebbe[]yes[]193.137.231.191[-]1115.46[]4439.68[]247.5[]b1dedc6272fbb0ba802ddcb5db1804b2[]11[]7a1d32a70d8f751ee0b9c289279c430c[]no[]145.255.240.129[-]4449.16[]3280.28[]90[]b1dedc6272fbb0ba802ddcb5db1804b2[]12[]42983e2d07484bfc20662d54ab8659a2[]yes[]SEASKY[-]3079.69[]2417.08[]270[]b1dedc6272fbb0ba802ddcb5db1804b2[]13[]4e28da739c3cc9ebc965b2236c58acbf[]no[]2.93.201.35[-]4081[]2949[]0[]b1dedc6272fbb0ba802ddcb5db1804b2[]14[]07e8c5b8618e36ff3add73fc3c4c3bcf[]yes[]173.186.88.229[-]2538.03[]3312.48[]225[]b1dedc6272fbb0ba802ddcb5db1804b2[]15[]efc5061b1061bec763adceeea0548a60[]yes[]IE10[-]1052.6[]3845.79[]67.5[]b1dedc6272fbb0ba802ddcb5db1804b2[]16[]cae64f25838aba6d827cc855bf7f0964[]yes[]213.74.166.193[-]3456.91[]3371.39[]247.5[]b1dedc6272fbb0ba802ddcb5db1804b2[]17[]a70532243d999affb1d8a2866cf3d774[]no[]84.78.209.51[-]1202.2[]495.407[]360[]b1dedc6272fbb0ba802ddcb5db1804b2[]18[]bf8e23befdb95d0aae2a507a7db40e25[]no[]84.61.176.195[-]|dbac50bd5637c4f39e371cc8a6035896|gameshots||alive|30|19|

    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

  • DUTOIT

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

    whahaha

    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 ;)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

    DUTOIT

    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)