1 decade ago by Elvar
Hi Guys.
I'm currently working on multiplayer Tower Defense game, and its coming along great. The only thing thats really left is the server part, but boy its it giving me trouble!
This is how i should work.
Users join the lobby, and can now see active games, the user can join a game, and once its full, the game starts.
As a Tower Defense game is not simple as a platformer, its insufficient to just keep positions in a array. There are many more factors, such as where is the creeps and towers on map, how fast does the towers shoot etc.
So this is what i had thought
When the game starts, the server initialize a new instance of the TD, this instance is the master plan, meaning it has the last word. Each client now load there game, and when the client places towers etc. its send a message to the server, which adds it to the server instance.
Every like 500ms, the server sends a sync, syncing the client game to the server server, so should the client have been changing something he wasn't suppose to, its simply replaced.
So the question is, how do i make this happen?
I have tried deakster's node-impact-emu(https://github.com/deakster/node-impact-emu) running this code, when a new game is started
but i get
Also is it even possible, to run impactjs without a canvas element?
I'm currently working on multiplayer Tower Defense game, and its coming along great. The only thing thats really left is the server part, but boy its it giving me trouble!
This is how i should work.
Users join the lobby, and can now see active games, the user can join a game, and once its full, the game starts.
As a Tower Defense game is not simple as a platformer, its insufficient to just keep positions in a array. There are many more factors, such as where is the creeps and towers on map, how fast does the towers shoot etc.
So this is what i had thought
When the game starts, the server initialize a new instance of the TD, this instance is the master plan, meaning it has the last word. Each client now load there game, and when the client places towers etc. its send a message to the server, which adds it to the server instance.
Every like 500ms, the server sends a sync, syncing the client game to the server server, so should the client have been changing something he wasn't suppose to, its simply replaced.
So the question is, how do i make this happen?
I have tried deakster's node-impact-emu(https://github.com/deakster/node-impact-emu) running this code, when a new game is started
ig.requires( 'impact.impact' ); console.log(new impact());
but i get
impact.js:491 })(window); ^ ReferenceError: window is not defined
Also is it even possible, to run impactjs without a canvas element?