Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

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?

1 decade ago by BlackDolphinMedia

what about just stream the keystroke to the server and do the positioning per stream ?

1 decade ago by mgiglesias

If you stream the keystroke to the server, and then the server decides your positioning based on that, that's essentially saying you have the level logic on the server. Unless you are only saying the server should report the position, and then the client would update the player position and have the normal level logic, on which sense I think it's unnecessary lag, since:

1. the client still has the level logic, which means they decide who won, and that's what we are traying to solve here.

2. Updating the client position only when the server responds could produce unexpected player movement if the traffic is high

1 decade ago by BlackDolphinMedia

1.) the server would decide who won in fact he knows the pos and just got keystrokes / so he would know who hits the target first

2.) that what clouds and loadbalancing is there for ..
+ in reality its a good problem to have
Page 1 of 1
« first « previous next › last »