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 Xaan

Hey guys,

Say you had a multiplier game made with impact. I've already gotten a demo working with nodejs and socket.io without impact - that is, I made a small demo from scratch where players can see each other and talk to one another.

Now, after I'm done with this little proof of concept, I want to start on a real project with Impact.

However, just thinking about it, I see a problem. In order to prevent cheating, in my demo a lot of the logic was done on the server. The way it works is: the player sends input to the server, and the server calculates the next state of the game and sends any changes back to the client. Meanwhile, the client would simulate it's own version of the game world for smoothness, and the simulation would be corrected by the server every once in a while.

How would you go about doing that with Impact? Things like collision checking especially would have to be done on the server. Is there a way to run Impact on a nodejs server? Is there some really obvious solution in regards to cheat prevention I'm overlooking?

I'd greatly appreciate any input.
Thanks,
Xaan

1 decade ago by paulh

yes, you just "confirm" the move on server side an let client do the ingame checks?

1 decade ago by Xaan

And how would I confirm the move on the server? That would require the server to have and run Impact (since I would be using Welt for collisions), no?

1 decade ago by alexandre

And how would I confirm the move on the server? That would require the server to have and run Impact (since I would be using Welt for collisions), no?

Welt is only needed to create levels. Technically, server has no need for it. But yes, a server-side version of the app would be running, arbitrating (arbitraging?) between the clients.

1 decade ago by Xaan

I see. Is there a way to run an impact app in nodejs?

1 decade ago by paulh

If your checking only for collision you could probably run some JSON to track a players location server side.

1 decade ago by Joncom

Quote from Xaan
I see. Is there a way to run an impact app in nodejs?


Honestly this would be overkill. Paulh has the right idea about reading in some JSON and tracking what the player is doing.

Relevant.

1 decade ago by Xaan

But collisions for example - how would I be able to use Impact's collision detection features on the server? Of course, I would have to send data between the client and server as JSON and then track the player. But how can the server tell when the player hit an obstacle if it doesn't have at least some part of Impact running in it?

1 decade ago by jswart

The only solution I can think of is to store the location of entities in a table on the server.

id
entity_id
entity_name
pos_x
pos_y

then add methods to the entities ( psuedo code )
getPos () {
 $.ajax {
    // call to server to get stored locations
    // server query & retrieval code here
    ...
    this.pos.x = pos_x_from_server;
}}

It seems like that would get taxing, and you may have to come up with some sort of caching.

1 decade ago by techtech

You can't use Impact's client-side physics and collision detection on your server. So ignore those features of Impact. They won't hurt anything if you don't use them.

Update the x,y positions of your client-side entities with values sent periodically from the server. Then do your own movement logic and collisions on the server. Designing your own, server-side, simple 2-D movement & collision system is easy compared to designing your own client-server networking system, so I assume if you are writing a client-server game, you can handle this task.

1 decade ago by Neil

Jstewart perhaps a key/value storage like Redis or Postgres and its Hstore could be used for quick read/write of position data storage. The clients/servers will have to ensure that only data that originates from the official server is used for calculating the collisions and that JSON responses from other sources aren't eligible.

1 decade ago by tarrent

I agree with the guys here. Impact will be more for the client-side game play. You can use AJAX (I would recommend jquery's $ajax for this) and PHP scripts for the server-side computations and checking.

The idea is to let $.ajax (client-side) communicate with PHP (server-side) to know what will be the outcome(s) for your game. I hope this helps :)
Page 1 of 1
« first « previous next › last »