1 decade ago by mgiglesias
I've been wondering how will ImpactJS approacht the distributed gaming logic. Let me give you a for instance. Just the other day we entered the Node Knockout contest and built a funny little game with ImpactJS:
http://nodeknockout.com/teams/team-gauchos
This is a multi player, running game. Using Node.js + Socket.IO on the server, each player sends a DELTA of its movement updates to the server, which distributes that delta info on all connected clients (to that room), and each client then uses its local impactjs logic to render the actions in the entity.
The problem with this is that the level logic is still at the client side. If a player wins (by reaching a certain entity area), it broadcasts that it won. This is obviously not optimal.
Ideally, you'd want to have the level logic in the server. Same concept as now: you send the DIFF of actions to the server, but the server, at the very least, decides if you won. Collisions could be handled locally. But certain parts of the level logic, if not all, needs to stay in the server.
Some ideas I've seen floating around, and my opinion on them:
1. Have one of the clients acting as a host. So his level logic decides the logic of the rest of the player connected: this sort of sucks. If the host dies, you need to find a new one. If the player is JS ready, he could get away with modifying the game play for everybody else.
2. Redo the parts of the logic that you need centralized: on my example, this could be a hacky, fast solution: i detect that the player reaches a certain spot, and i do something. But this sucks, since you really wanna have the level logic available in the awesome level editor impactjs has.
Ideally you would want to be able to run the game on the server through NodeJS, or some other server side javascript solution. Without the need to render (NodeJS has no DOM elements anyhow), the server would be running the game logic.
I've seen people here in the forum complaining that it's hard to make impact run on node. Does anybody else attempted to take it further?
What does Dominic think on level logic on the server side?
http://nodeknockout.com/teams/team-gauchos
This is a multi player, running game. Using Node.js + Socket.IO on the server, each player sends a DELTA of its movement updates to the server, which distributes that delta info on all connected clients (to that room), and each client then uses its local impactjs logic to render the actions in the entity.
The problem with this is that the level logic is still at the client side. If a player wins (by reaching a certain entity area), it broadcasts that it won. This is obviously not optimal.
Ideally, you'd want to have the level logic in the server. Same concept as now: you send the DIFF of actions to the server, but the server, at the very least, decides if you won. Collisions could be handled locally. But certain parts of the level logic, if not all, needs to stay in the server.
Some ideas I've seen floating around, and my opinion on them:
1. Have one of the clients acting as a host. So his level logic decides the logic of the rest of the player connected: this sort of sucks. If the host dies, you need to find a new one. If the player is JS ready, he could get away with modifying the game play for everybody else.
2. Redo the parts of the logic that you need centralized: on my example, this could be a hacky, fast solution: i detect that the player reaches a certain spot, and i do something. But this sucks, since you really wanna have the level logic available in the awesome level editor impactjs has.
Ideally you would want to be able to run the game on the server through NodeJS, or some other server side javascript solution. Without the need to render (NodeJS has no DOM elements anyhow), the server would be running the game logic.
I've seen people here in the forum complaining that it's hard to make impact run on node. Does anybody else attempted to take it further?
What does Dominic think on level logic on the server side?