Game server for the js13kGames Competition.
Download the skeleton. Extract the files and install the third party libraries with npm
.
npm install
You can run the server locally with the following command:
npm start
You can reach the test server at http://localhost:3000
All your code must be in the public
folder. Put your server side code into the server.js
file. The shared.js
file is loaded at the begining of the server.js
file. You can also use this code on the client side.
The server.js
is a standard Node.js module. You can use the following structure to create new Express routes or Socket.io connection handler.
module.exports = {
// Express route to /hello
hello => (req, res) { ... }
// Socket.io connection event handler
io => (socket) { ... }
}
The server category entries can use 13kByte persistent storage. The key and value size also counts into the limit!
The storage uses SQL database to save the key/value pairs. By default it's SQLite but on Heroku you have to use the Postgres add-on!
In the server.js
file you can access the storage
interface. The API documentation is inside the lib folder.
All server category entries must be hosted on Heroku. You can either use free or paid plan.
- Push your files to your GitHub repository
- Create new WebApp on heroku
- Add Heroku Postgres add-on (optional)
- Connect your WebApp with the GitHub repository
- Deploy your code
You can find more information about the platform on the Heroku Dev Center site.
- Zip all files in the
public
folder. - Submit your entry on the js13kgames.com site.
- Add [email protected] games as collaborator to your Heroku WebApp.
-
Sandbox server
- You can find the official sandbox server at https://github.com/js13kGames/js13kserver.
-
Package size still below 13 kB
- Game package will contain all the game code and assets, for the client and the server.
-
Sandboxed environment
- Your game will run in a node.js based sandbox environment. That means you will not really use node. You cannot require modules and your own modules shipped by your 13k pack.
-
Do not leak the sandbox
- This is not a hacking competition. This is a way to help the competition admins, the site persistence, and you. Do not touch the
procfile
and the skeleton code.
- This is not a hacking competition. This is a way to help the competition admins, the site persistence, and you. Do not touch the
-
Socket.io client lib
- You can use it. Simply add
<script src="/socket.io/socket.io.js"></script>
to your HTML and that will be loaded. No server configuration will be needed. The sandbox already did it.
- You can use it. Simply add
-
Can I test the sandbox before submitting?
- Yes, you can and you must! Installing and getting it running is simple. Visit the project page at https://github.com/js13kGames/js13kserver.
-
Is there any example? How do I develop my game using the sandbox server?
- There's a simple "Rock, Paper, Scissors" example in the public folder.
-
I have more questions!
- Feel free to send them to [email protected].
-
Can I minify the server side code?
- Yes, but you have to keep the readable code also.
-
Can I add more npm packages?
- Yes, but you cannot use them in your game code.
-
What files count in the 13kb limit?
- All files in the
public
folder.
- All files in the
-
Can I deploy new code after I submited the entry?
- Yes, but you have to resubmit your entry on the site also.
-
Can I modify the
procfile
or the skeleton code?- No