Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Can anyone point me towards examples of Browser Games / Browser Game Sites that use RESTful web services?

I have been convinced time and again that building web sites using RESTful principles is a good idea. And I agree. But I just can't wrap my head around what RESTful means when the service you're providing is just a single (or a few) games.

Any ideas or thoughts would be nice, but I'd also love to see some solid examples.

share|improve this question
    
I don't understand what the question is. Maybe you should make an example what your web-service should do? A RESTful implementation for a game works exactly the same way as other RESTful services. –  bummzack Apr 26 '12 at 6:42
3  
I think he's ASKING for an example :-) –  Wouter Lievens Apr 26 '12 at 15:35

2 Answers 2

up vote 3 down vote accepted

I think the network protocol is really irrelevant, each game uses its own protocol, REST or any other standard is only important if you need to interoperate with third party software - which game servers mostly do not.

For example, if you published the API, using REST might be a good idea. But otherwise, I don't see any reason to do so.

share|improve this answer
    
I guess that is kind of my concern. While publishing an API for a game might add a level of uniqueness to the game, I'm not sure if it would always be desirable. Perhaps the RESTful portion might be to allow users to access different games on the site. But, I'm not seeing the real benefit for RESTful anything in my case, and I'm assuming that means I don't understand something well enough. –  theJollySin Apr 26 '12 at 16:06
    
Publishing an API would be a bad idea, because if people started using it, you'd need to maintain backwards compatibility forever, which would certainly limit your ability to upgrade the game. –  MarkR Apr 27 '12 at 11:42
    
Yeah, I've decided I'll create an API for things outside the game like getting character profiles and high scores and... things like that. But I can't see the benefit of exposing in-game functionality in a RESTful way. –  theJollySin Apr 27 '12 at 15:37

You would have REST services for all the moves one could make, or for the game information requests.

Something like:

POST /game/45093/move?x=3&y=2

POST /game/45093/surrender

GET /game/45093/status

GET /games

etc...

share|improve this answer
    
Also remember about security unless you want me to surrender your game or move your player. –  Kamil Apr 26 '12 at 11:30
    
@Kamil that's relatively easy. You will POST "surrender" which means "the player making this request surrenders". You would never add "self" as parameter, as that can be deduced from the session after login. Of course you still need to validate the rest of the application state... but that's the case for any web service. –  Wouter Lievens Apr 26 '12 at 15:35
    
That's interesting Lievens. You would use the REST for in-game actions. My real question is, would YOU design a browser game this way? Is there a reason to design a game to have this kind of convenient API? My current bias is that you only create RESTful systems so users can access a online tools more easily. And I'm not sure if I see the benefit of RESTful whatever if the user isn't going to be using your website to... whatever, search the web or organize their bookmarks. –  theJollySin Apr 26 '12 at 16:03
    
Now I am considering that perhaps the game itself wouldn't have to be that RESTful. But perhaps I could design other parts of the site that way. Like the user-stats, grabbing screenshots, sharing in-game items or skins between characters, or even just choosing your game. –  theJollySin Apr 26 '12 at 17:11
    
I would design a browser game that way because I don't know any other way. What's your alternative? –  Wouter Lievens Apr 27 '12 at 8:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.