udamir / magx Goto Github PK
View Code? Open in Web Editor NEWMultiplayer game server framework
License: MIT License
Multiplayer game server framework
License: MIT License
I'm looking at your state management logic. Based on what I'm seeing can I assume the following is how it works:-
But I have the following questions
Also
Examples would be appreciated. Thanks in advance.
A project with potential, I use first
So I'm using cors and https to run the server( port 2567) while I run the game on a different server( port 3000).
While the logs show I'm able to create a room
Process 70: Get avalible rooms
Find process for room:
Current process load: {}
All cluster pids []
Process 70 requested: Create room pullowar
The client side seems to return a
Request URL: https://localhost:2567/magx/rooms
Request Method: POST
Status Code: 400 Bad Request
Remote Address: [2803:1500:e00:f22f:ba27:ebff:fede:91d0]:2567
Referrer Policy: strict-origin-when-cross-origin
with the following payload.
{"name":"pullowar","options":{}}
Did I need to set additional options for the room to be initialized?
Hi,
I was looking for a simpler alternative to Colyseus and came across your package which seems to have what I am looking for...Is it production ready?
I see in your code you create and serial a state. Can you patch track multiple states?
e.g.
createStates () => { Player, House }
createPatchTracker(state: State) {
// create state change tracker
return Mosx.createTracker(state, { serializer: SchemaSerializer })
...
or do I need to manage the house state from within the player
class PlayerState {
this.player = new Player
this.house = new House
}
So I'm using the latest magx with the following setup
gameServer = new Server(server),
gameServer.define('pullowar', PullOWarRoom);
server.listen(port, () => console.log(`Listening on http://localhost:${ port }`));
the PullOWarRoom
class PullOWarRoom extends Room {
constructor(options) {
this.maxClients = options.maxClients || 2;
}
createState(){
// create state
return new State()
}
createPatchTracker(state) {
// create state change tracker
return mosx.Mosx.createTracker(state, { serializer: mosx.SchemaSerializer })
}
onCreate(params ) {
console.log('on create', params)
}
onLeave() {
this.state.removePlayer();
this.state.resetGame();
}
onJoin() {
if( this.state.game.players == this.maxClients && this.state.game.state === false )
{
this.state.setGameState( GAME_READY)
this.state.startNextRound()
} else {
this.state.addPlayer()
}
}
onClose() {
delete this.state
}
}
And I connect to the server using
// http://localhost:2567/magx"
client.authenticate().then((d) => {
console.log(d)
return (ROOM_ID ? client.joinRoom(ROOM_ID) : client.createRoom('pullowar'))
}).then(room => {
.....
I'm not sure how auth works but the but i get a "timeout" trying to connect via "http://localhost:2567/magx/auth"
I'm also using the magx-monitor but in accessing the url "http://localhost:2567/magx/monitor" the page loads but I get the error
net::ERR_SSL_PROTOCOL_ERROR
monitor:61 Uncaught ReferenceError: MagX is not defined
at monitor:61
I'm assuming the first error is due to not setting up auth? Can I disable auth at least on localhost?
The second maybe due to not using https? Can I also disable this at least on localhost?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.