What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
You know how the current HighScroe APIs work? You need about two lines of code, and is increadibly easy to use. I’m thinking we could do something simmilar for Multiplayer APIs.
Basically, what I am suggesting is an API that allows users to easily pass variables through the server. For instance, take a simple pong game. In each frame, player one will have the code for moving his own racket, for dying, for lives, and for the ball bouncing off of either racket. Now, player one would have this in his code:
_root.enemyracket._x = \_root.kongregateStats.getvar(“position”,2);
and player 2 would have
_root.enemyracket._x = \_root.kongregateStats.getvar(“position”,1);
Ok then. For somebody who knows, I have these questions.
1) Would it be hard to make an API like that?
2) Would the API work quickly, or make the game lag seriously?
3) Would there be a reasonable way to make a “lobby”?
4) Do any games on Kong do this, or did I come up with an original idea?
It could be pretty straining if used badly – if someone made an (inefficient) game which sent/requested the positions and other statistics of, say, 10 soldiers every frame, and was running at 35fps, each person playing the game would be sending a large number of requests every second. And if you’ve got hundreds of people playing these games…
Well, that is a reasonably easy way, however if done this way, the API would have to throttle the connection to prevent flooding and server overload as Kalinium pointed out. It _could_ wait and construct a packet then send the data at its own intervals, but that removes a bit of control for the developer. It may be wiser to construct your own packet with all the data you want to send, then let the API know you want to send the packet. Technically, you could send a packet using a ‘givevar’ type method, however encouraging and allowing users to send var by var could be severally detrimental to the server.
_root.kongregateStats.send ( “charPacket”, userData );
If you wanted to go the ‘givevar’ way so that the user could avoid the complexities of packet construction, a send() or flush() method could be added that lets the API know its time to send. Meaning you could queue up the data with givevar() but it wouldnt actually _send_ that queued data till the user instructs it. eg:
_root.kongregateStats.givevar ( “x”, racket.x );
_root.kongregateStats.givevar ( “y”, racket.y );
There are lots of ways to go about it, and the implementation would depend largely on whether the developer or the API has more control. However, in the end making it totally ‘dumbed down’ for the developer is not completely an ideal, since a person should know a bit about coding before attempting to make a multiplayer game. Otherwise, we’ll be killing our Kongregate servers for everyone, all for a bunch of crappy multiplayer games that dont work well.