Meteor for Gaming: Jerbal Space Program
Two of Meteor’s strongest points are that it’s fast to learn and lets you quickly get started, which means it’s a great fit for student projects.
So when Matthías Páll Gissurarson told me he and three other University of Iceland students had successfuly used Meteor to build a game for their final school project, I immediately wanted to know more about Jerbal Space Program.
Sacha: To begin with, can you introduce yourself and your team?
Matthías: My name is Matthías Páll Gissurarson. I’m 22 years old, and I’m currently on my third and final year of my Computer Science and Mathematics undergraduate studies.
My teammates are:
- Sólrún Halla Einarsdóttir. She’s 22 years old and has finished her Bachelors in Mathematics, and is currently adding an extra Bachelors in CS.
- Haukur Óskar Þorgeirsson. He’s 21 years old, and is currently on his third and final year of his Bachelors in Mathematics.
- Bjarki Geir Benediktsson. He’s also 21 years old, and is also finishing up his Bachelors in Mathematics.
I built the website with Sólrún, and all four of us made the game.
From KSP to JSP
Your project’s name is obviously a reference to Kerbal Space Program, a popular indy game. For those who aren’t familiar with KSP, can you quickly describe the game?
Kerbal Space Program is a sandbox game where you assemble rocket parts into a spaceship, and then launch off into space. KSP has a rich solar system with many objects on which to attempt landing. The planet you start on has two moons, but the solar system has a few planets, most of which also have multiple moons.
The main fun of the game is the design and launching of rockets, but KSP has a great simulation system, so you have to build rockets that actually work (for the most part).
Our Web Programming teacher introduced Meteor as an example of what was the future of Web Programming. When the time had come for the final project, we had just finished the final project in Computer Game Programming and wanted to build something more around it, so that it would be presentable.
We realized that if we used Meteor, we could include the game code directly into the app, and not have to write any cumbersome interfaces for it to work neatly.
The First Steps
And did you find it easy to get started with Meteor? Did you encounter any specific stumbling blocks?
Meteor worked very nicely, and enabled us to create a web app around the game in record time. We did however have to rewrite some of the game’s foundation to be able to run multiple instances of the game at the same time on multiple canvases.
But it was tricky to integrate the code into the actual app structure of Meteor (at first it was just being served as static files, but after we discovered the compatibility feature, it all played out nicely).
The hardest part was probably working with Iron Router and the actual deploying of the app, as our school does not have Node.js on the servers which were provided to host. We ended up deploying initially on Heroku, but later switched to Nodejitsu (which provide free hosting for open source apps, though it was a bit of a wait before we got the approval).
The book didn’t have chapters on Iron Router nor deployment at the time, so with the updated version we could probably have avoided these problems. We used the book a lot, especially while working on publications and subscriptions.
Pagination was a bit of a problem, but we ended up finding a package and modifying it for our needs (we needed actual pages, as the game code was quite sensitive to what was displayed and what not).
What other technologies or frameworks did you use for the game? Was it easy to get them to play nice with Meteor?
I’m currently taking a course in Interactive Computer Graphics, and my hope is that I’ll be allowed to port the game from 2d canvas into actual WebGL, as the rendering of the stars in the background becomes a little heavy when zoomed out.
Meteor for Gaming
So overall, would you say that Meteor is a good match for creating games?
Not having to reload the page and then figure out where you were coming from from (e.g. the session) simplifies creation a lot, and could enable you to create an entire game with multiple tabs, all in the browser.
It only took us about 15 minutes to make the game completely playable offline
Leveraging the AppCache package that Meteor has also simplifies the playing of the game offline. It only took us about 15 minutes to make the game completely playable offline. Just create a link on the desktop and there you go!
Meteor is famous for enabling real-time updates across users out of the box. Did you make any use of this?
We make some use of Meteor’s realtime features, though not the way they were intended I think. When multiple players launch ships that have been saved to the websites database, they can see each other in game! This is made possible by having the player save his location regularly to a collection, and this then bleeds over into other players’ game.
It’s not quite realtime, but as we’re mainly doing a gravity simulation, we can make a pretty good guess of where the player should be during the time in between, and thus via a bit of tweening, we get the illusion of everyone playing at the same time (creating basically an MMO!).
We cap the amount of players you see at 5 though, as we think it might get a bit hectic while the playing area is so small.
Since this was your final project for your Computer Game Programming and Web Programming classes, I hope you at least got some good grades out of it! What kind of feedback did you get from your teachers?
We got full marks for both the game and the website around it
We got full marks for both the game and the website around it, and our teachers were quite impressed. We did go a lot beyond what was required, but we thought it was definitely worth it.
That’s great! So what’s next for you guys? Any plans to make more Meteor games?
I’ll definitely be using Meteor to make more games, and am indeed looking forward to it for the WebGL final project.
Having the whole website abstraction behind the game really makes all menus much simpler, and player cooperation and the whole social side to the game becomes much easier to implement and design, especially when leveraging such things as Collections and Bootstrap.
Thanks again to Matthías and the whole JSP team for answering my questions! It was definitely fun to see Meteor used in such an original way, and I can’t wait to check out the WebGL version!