rpiller Posted April 17, 2014 Share Posted April 17, 2014 This is extremely early but I have a multiplayer game in the works. I'm wondering if anyone could test this out in chrome. When I test and bring up the console after about a few mins I get an error ERR_CONNECTION_RESET and ERR_CONNECTION_TIMED_OUT. I'm curious to see if it's my connection or if everyone gets these errors. The client pushes it's position to the server 5 times a second via setInterval(). The server also pushes out movements of all clients every 5 seconds. If you open up multiple tabs you should be able to move around and see that (if you don't get this error like I do). Curious of the results others are seeing. Thanks! http://www.your-world-game.com/ Link to comment Share on other sites More sharing options...
IndenturedSmile Posted April 17, 2014 Share Posted April 17, 2014 I didn't notice any errors after a minute or so, but I'd definitely look into something like Websockets or Long Polling. Sending a full request like that so often is going to be awful for clients on slower connections, and if the game needs to support more than a handful of people, your server will be saturated as well. Link to comment Share on other sites More sharing options...
rpiller Posted April 17, 2014 Author Share Posted April 17, 2014 See this is what I'm confused about. http://shootr.signalr.net/ can have a bunch of people on it. SignalR makes programming this stuff so easy so that's why I'm using it. I think there are a couple other options for this, but to start with at least I want to get something going quickly and SignalR seems to provide that. Thanks for testing. Will keep updating things slowly to make a game out of this. There are optimizations I can do with this. I send a GUID ID myself to ID the users when updating position (5 times a second), which will take up more space than a simple integer value would. SignalR claims to support thousands of connections and I guess has optimizations that can be done with it so I'll look into that as well. Link to comment Share on other sites More sharing options...
rpiller Posted April 17, 2014 Author Share Posted April 17, 2014 How are you seeing the full request that's being sent? Link to comment Share on other sites More sharing options...
IndenturedSmile Posted April 18, 2014 Share Posted April 18, 2014 You can see the requests in the Network tab of Chrome's dev tools. There should also be a network tab in Firebug or Firefox dev tools as well. When I say full request, I mean a full HTTP request. There's a lot of overhead involved in those. This is a good starting point: http://stackoverflow.com/questions/11077857/what-are-long-polling-websockets-server-sent-events-sse-and-comet I'm not familiar with SignalIR, but it looks like it does use Websockets for its requests. Sorry if I jumped the gun and you're already using Websockets. Link to comment Share on other sites More sharing options...
rpiller Posted April 18, 2014 Author Share Posted April 18, 2014 Yeah, it looks like SignalR has a hierarchy of technologies it uses in case something isn't supported by the browser. I think I have things a little more stable now. Just need to work on the interpolation as that's giving me a rubber band effect Link to comment Share on other sites More sharing options...
IndenturedSmile Posted April 18, 2014 Share Posted April 18, 2014 Cool. Nice concept so far. I'm currently working on the same style of z-ordering as your game has: you've got the character walking behind the tree, then in front, depending on the y-coordinate. Link to comment Share on other sites More sharing options...
rpiller Posted April 18, 2014 Author Share Posted April 18, 2014 I use layers & groups to get that. The map is made with Tiled with 3 layers. Ground, Object, Foreground. The base of the tree that is collidable is in the object layer. The top part of the tree is in the foreground layer, and between those layers I make a group where I put all actors so that they'll be drawn before the foreground layer. The concept of the game is a Sims like game but you'll be able to buy "land" (tiles) and be able to plant trees, chop them down, harvest other resources, make buildings that'll aid in making other, more advanced things. The idea is to just create a world. There'll be farmers making wheat, millers milling wheat to flower, bakers using floor to make bread to eat. All of these will be ran by real people. Next on my to do will be to buy tiles/land. This requires login though so I can track who owns what. Lots of work to do Link to comment Share on other sites More sharing options...
IndenturedSmile Posted April 18, 2014 Share Posted April 18, 2014 Very cool. Interesting way of doing the z-ordering. Thanks for sharing. I might steal that from you, haha Link to comment Share on other sites More sharing options...
jpdev Posted April 18, 2014 Share Posted April 18, 2014 On the topic of websockets: I chose to just go native websockets for the following reasons:- it's a game, connection needs to be fast, so most fallbacks (like full html requests) won't be enjoyable anyway- phaser needs a modern browser, so if the game itself runs in the browser, then there is websocket support also So by using native websockets I only exclude people behind "evil" proxies or firewalls.By using 443 as my websocket port on the server I even got it to work in some of those "evil" scenarios. (Those are just my requirements, but my games are pure hobby, so the requirements for professional games are surely different.) Link to comment Share on other sites More sharing options...
rpiller Posted April 18, 2014 Author Share Posted April 18, 2014 I use SignalR because development is so easy. I can focus on my game functions and not the network implementation. It uses RPC with automatic hookups between javascript and C#. There are scaling out benefits that it has built -in also which is nice just in case the game catches on, but my main benefit is ease of use to get stuff up and running quickly. The negative is that it sends data via plain text json and not binary. Link to comment Share on other sites More sharing options...
Recommended Posts