Tag Info

Hot answers tagged

12

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


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.


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


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

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

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

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


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

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


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


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

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


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

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


2

Here is another good resource, how A* search was used in Left 4 Dead (A popular game by Valve). It contains some overlap with Nic's answer, but is still interesting. http://www.valvesoftware.com/publications/2009/ai_systems_of_l4d_mike_booth.pdf


2

Why don't you just register events? Different objects act upon events they listen to, and you can attach some datas to these events (an object like {key: 'value', key2: 'value2'}, for example). If basic events (click, change, etc) don't satisfy you, you can register custom events. An example of how to do this here : ...


2

You should check out this article about Real Time Multiplayer Games in HTML5 posted on the buildnewgames.com site by Sven Bergstrom, he talks about the same things and he is using Node.JS. I have something similar going myself. I am just now researching more about the client-side prediction and interpolation and the like myself before trying to tackle the ...


2

Just some short ideas: Only re-calculate the Player's stats when buffs/debuffs occure, not when you need the value. Much likely to what Sequel-based Databases do with indicies (MySQL for example updates the index cache on each write execution providing a verry fast interface for reading data). When you have multiple Types of values, you need to think of a ...


2

A little example for you, i hope it will be helpful. // Base game object var GObject = function () { // Entities storage this.entity = { hp: new GEntityHp() // ... }; // Storage for buffs, debuffs this.buffs = []; }; GObject.prototype.addBuff = function (buff) { buff.applyTo(this); this.buffs.push(buff); }; // ...



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