Rivalis is open source framework for building multiplayer game servers.
- Extensible - Rivalis can work with multiple protocols at same time.
- Scalable - Rivalis provides interfaces for integration with any external databases and services
- Easy to use - Rivalis provides extensible & well designed API, read more about that in the documentation
- JavaScript & NodeJS knowledge
- NodeJS (v12.0 or higher) installed on your local machine
- Code Editor
- Create empty npm project using
npm init
in empty directory - Install rivalis-core library using
npm i --save @rivalis/core
- Install rivalis websocket protocol library using
npm i --save @rivalis/protocol-websocket
- Create simple entrypoint for your project like:
server.js
const http = require('http')
const { Node, AuthResolver } = require('@rivalis/core')
const { WebSocketProtocol } = require('@rivalis/protocol-websocket')
// http server is used only for websocket protocol
const server = http.createServer()
// AuthResolver is the place where you need to implement your authentication/authorization logic.
class CustomAuthLogic extends AuthResolver {
async onAuth(ticket, node) {
// --- EXAMPLE (IMPLEMENT YOUR LOGIC HERE) ---
let { roomId, actorId, data } = this.getFromTicket(ticket)
let room = await node.rooms.obtain(roomId)
return room.actors.join(actorId, data)
}
}
const webSocketProtocol = new WebSocketProtocol({ server })
const rivalis = new Node({
transports: [ webSocketProtocol ]
})
rivalis.run()
server.listen(2345)
Follow the official documentation.
Let's begin with hacking!
The project is licensed under MIT License