Tag Info

Hot answers tagged

13

I have created a framework specifically for creating HTML5 realtime multiplayer games, based on the Client/Server model. In this model, players send only input to the server (keys being pressed) - and the game occurs on the server. The server sends timed world-snapshots to all clients, and clients render themselves say 75 ms back in time from the current ...


10

I recently made a asteroids/geometry wars crossover with Node.js / JavaScript: http://github.com/BonsaiDen/NodeGame-Shooter It has a fat Server which processes the game and thin clients which are basically just views. The client does some interpolation and things to make it look smooth. You may want to look at these two files, which contain the underlying ...


8

I'd suggest to keep things apart. In Stendhal which is a 2D MORPG written in Java, we did the following things and it works out pretty fine: The client uses a fast loop for drawing. It does smooth animation and some predictions to minimize lag. The server uses a loop to process all the game logic. In our case it can be a lot slower than the drawing loop. ...


8

I have in mind a traditional MMORPG like World of Warcraft. Save after every command from each player and autonomous thing (e.g. NPC) Constant backup. The server could go down at any moment, and the state of the game is saved up to that moment (or as recent as possible, anyway). Impact to server performance; even if it's non-blocking (i.e. on another ...


8

The server should maintain all the positions to "make sure" anyway -- this is how you prevent trivial cheating. Most browsers have a "debug mode" they can be put into. It's trivial for me to hit F12 on my copy of IE, for example, and have access to a JS debugger I can use to halt execution, inspect variables, and change them. So you should be aware that a ...


7

Each pixel doesn't have to be its own node in your navigation mesh/graph. You should be able to subdivide areas by sections, and each section becomes a node in the graph for the A* algorithm. This leaves you with far fewer nodes and much faster searches, however you do have to calculate how to move through these nodes naturally with AI, as you won't just ...


7

There is a Google Techtalk featuring Rob Hawkes, creator of Rawkets, who talks about the problems he ran into while creating his game with Websockets and Node.js. He also comes up with some pretty slick solutions for the problems that he faced.


6

Nic explained this to me briefly yesterday. Check out the explanation on his blog. http://nic-gamedev.blogspot.com/2011/11/mmo-architecture-creating-ghosting.html


6

Sure it is an overhead, but if your packets generally ain't much larger than the example you give it is not much overhead, pretty insignificant relative to general overhead of sending a package. Of course a denser format is a small performance improvement, and it should be considered. At the early development however I'd stick to something like JSON for ...


5

Principles for reducing effects of lags are the same regardless of the transport protocol. Packet loss is a another topic - for many kinds of packets losing some is not critical because the next update is probably already on its way - here UPD has the advantage, but when you need to make sure a certain packet is delivered, you need custom acknowledgement ...


5

Rather than a mesh, you might just consider a hierarchical A* approach. A mesh's biggest advantage is in dealing with game worlds that aren't grid aligned, rather than in reducing complexity from a grid. With a hierarchical approach, you subdivide your world repeatedly (much like a quad tree), and generate connectivity information between the nodes. You ...


5

There are several things you could do to reduce the visible effects of lagging. Just some ideas: Send the current acceleration, velocity and position values to the client, and let the client calculate the new velocities and positions until it receives a new data package. Avoid using frequently changing acceleration. You should consider defining states of ...


5

I take it all the variable name are broadcast as well. Isn't that a huge overhead? That's the case, and yes that's quite an overhead. Wouldn't it be better if I glued all data together using delimiters like this (...)? The disadvantage here would be that I have to split the string each time I receive it. But isn't that much better for latency? ...


5

If you're willing to ease on the requirement that a client should be informed of other clients that are exactly 200 blocks away or closer, then here's an idea: split your map to squares of, say, 200 blocks each side. Then you can keep track of where the client is, and inform the client of all other clients in the adjacent squares. More detailed discussion ...


4

It's quite an advanced topic, and as word of warning I'm hesitant to indulge too much in to this because I only know some theory and haven't actually produced an MMO. In MMOs, optimization is perhaps the primary factor in decision making on the technical side. The more users you are able to host, the better. It's easy to accidentally use poorly scaling ...


4

The biggest mistake, is simply playing the games on the client side, and allowing them to communicate their information as they see it. Have the clients simply communicate their input, and render a model sent from the server at discrete intervals. (Store these models in an array with a server-timestamp, then interpolate between two known timestamps to ...


4

To continue from where we left off - the ideal solution is to do all the important work on the server. Since you haven't really said what your game is (Action RPGs can be along a wide spectrum) here are thoughts on how to hide the delays for the user without compromising security in a general way. It is worth it to investigate what working on games in the ...


4

Do I send a command to move right every frame? Sure. Why not? As long as the player is moving right, of course. If that's spamming the server too much, you could of course just send the command to move right and the command to stop moving right, but you're risking some troubling behavior if you miss the "stop moving" command. You could compromise between ...


4

Node.js runs on the V8 JavaScript engine: Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. V8 ...


3

I think you might be overcomplicating this. You probably don't need to generate navigation meshes on the fly. Instead have a static navigation mesh for your base world. Pathing around obstacles can be solved using steering behaviours (use obstacle avoidance). If on the off chance your obstacle is so large it fills or completely blocks off travel from one ...


3

Stop thinking in terms of frameworks and start thinking about what you want your game to do. Does slapping a sticker on the box (okay, website) that says "Runs on Node.js!" or "Built for Box2D!" help sell more copies? Nope. Most users won't know and won't care. You rattle off a lot of technologies, but it seems to me you're just excited to be building a ...


3

Use socket.io, it's a handy WebSockets abstraction library that provides fallbacks for browsers that don't support it. Also, if you are going for an online model like that, I would recommend moving game processing to the server. That way you only need to communicate graphical changes and mouse/keyboard input. It also helps quite a bit to prevent cheating.


3

SockJS has a test suite which includes some smoke tests that report latency. For example, here's a test that does cursor tracking. Select 'websockets' from the drop down and click 'connect'. Mind that it's hosted in Europe; I get about 30ms. Also note that it polls at 5Hz, so the cursor movement is not an indication of latency, only the 'latency' field is. ...


3

I am assuming here that you're keeping your world data in memory (with occasional load/save). As it's in memory, you'll need to do the work in the same process, or you won't be able to have a consistent view of the data. So you'll want to set up a timed task on the server to handle MOBs etc. You don't use process.nextTick, just set a timer using one of the ...


3

Since it is a single player game, you can do it without any lag at all (assuming you send/receive asynchronous messages). coming to difficulty, its fairly simple implementation. All you do is cross check the action (like price, item available etc.,) which 99.99% will be valid. Now you decide what should happen when some thing fishy happens (like something ...


3

Use a fixed time step to start. Fix Your Timestep The server/client need to estimate the RTT (round-trip time) of the connection to correct times. The server is receiving commands from the (very recent) past. Its simulation needs to account for that. It knows where the client was and wanted to move to, not where the client is and wants to move to. The ...


3

Socket.io will emit connected event for every connected socket. So in your case you will create loads of loops there. It is better to have list of sockets, and one loop separately. As you've said - your case is simple - so keep it simple, do not overcomplicate. var sockets = { }; server.on('connected', function(socket) { // runs for every connection ...


3

Yes, it's quite possible. In essence, this would just be extensive scripting, and scripting is very common in game development. You can do whatever you can in JS, and use C/C++ for the stuff you can't get to behave with JS. I wouldn't bother with Node.js and go straight for V8, which is not that hard to integrate. V8 has recently added isolates, which make ...


2

Does this mean I have to maintain a list on the server which player can see another? Basically, yes. The way we did it on a previous project was that each character had 2 lists: one of IDs of the characters that it knew about, and one of IDs of characters that knew about it. (Obviously it's possible to derive the 2nd list from the 1st but it's quicker ...


2

Take position of player A. Subtract position of player B. Get the length of the resulting vector. If it's under the sightrange, add the other player to a list that a player can see. This will help you with all updates, ie you don't need to send all movement/socials that a player that isn't visible is doing. You can do the initial check fairly seldom(say once ...



Only top voted, non community-wiki answers of a minimum length are eligible