Simple multiplayer game example

I am a PhD student in computational/applied maths and pretty new to Meteor and web development in general (with good experience in Matlab and Python programming for mathematical modeling).

I am really fascinated by this learning process and I am trying to build an online experiment (multiplayer online game) to test a theoretical model that we developed. As I am going through the official guide and learning about best practices, I am struggling to find examples of multiplayer games with: 1) lobby; 2) synchronous multi round games; 3) exist survey; and at the same time 4) following the best practices suggested by the guide (or using Meteor 1.4+ in general).

I would highly appreciate if you guys could point out some examples for me to learn from.

1 Like

You can try for mini military or COC. This is multi round games. Hope you’ll enjoy it.

Can you please share with me the link of the project? I am looking for implemented examples to learn from them how to structure the project and how to perform some of the functionalities for a real-time game.

I think @SkyRooms has a multi-player online game / engine built on Meteor at StarCommanderOnline.com.

1 Like

Thanks @martineboh

I can answer this for you:

1) lobby;

Meteor

The idea of a lobby in Meteor doesn’t really exist by natural useage. I suppose if you were running multiple server instances because your CPU load was insane, as 10,000 players we online, you would split your servers up. This could be a “lobby”.

Of course, you can build this as part of your app because you want to, for what ever reason. Take a game like Counter Strike for example, it sets you up in a lobby, runs you through a game, and destroys the lobby. This is by design. But you can also technically do 10,000,000 connections and not need a lobby.

Meteor does NOT do peer to peer connections (although you could hybrid it, which I’ve attempted).

WebRTC

Web Real Time Communications is a lobby based technology that on the surface kind of looks like what Meteor does. A signal server is used to connect IP address to another IP address. Then you can even turn the signal server off - and the two systems are still connected to each other. It’s a up-and-coming technology already in many places for things like Facebooks video chat.

Food for thought as you do your research.

  1. synchronous multi round games;

I have a demo of WebRTC Star Commander for something like a multi round game. I plan to release Star Commander War Games with this exact idea. Real time P2P combat for my game. My previous project (skyrooms, now closed), used Meteor + WebRTC to deliver video streaming group conferences, resumes, business cards, project management. I took it to Dragons Den, they weren’t interested, so I left that for SCO, my new game.

  1. exist survey; and at the same time
  2. following the best practices suggested by the guide (or using Meteor 1.4+ in general).

Not sure what you mean here. But I will tell you that Meteor is an unforgiving, bitch of a platform. I have a lot of love for it; but I have a lot of hate too. Mostly because I didn’t follow EXACTLY the instructions, but also because some stuff in Meteor doesn’t work 100% - and also that moving from your loving localhost:3000 to a domain is a massive under taking, unless you use their pre-existing Meteor Galaxy system. But even still, it doesn’t give you simple things like File Storage - or even hosting a database. You have to pain stakingly create a MongoDB account some where, which is free to start, then $200 bucks a month for a simple server. So I built my own custom hosting architecture. It’s a friggin night mare.

But, in the end, Meteor seems to live up to it’s brands mission and vision - you can see www.StarCommanderOnline.com “The Meteor MMO” in action. I’ve some-what easily ported it to PC and Android, IOS is easy too, but takes some trickery.

If you want to chat on a conference, let me know. I’d be happy to be named in a study :wink:

1 Like

I have here the demo running for a WebRTC version of my game, it’s pretty crazy. There’s no central server (other than signalling)

http://wargames.starcommanderonline.com:8080/

could you give some examples?

sorry dude but that is plain wrong! compose.io gives you a simple server for 35$ a month.

I assume you talk about mongo here? I hosted dbs on mlab, on compose and self-hosted on DO droplets and not once have I had a single issue with any of them. Could you elaborate what nightmare you are talking about?

OpLog Caching for self hosted solutions is a complete nightmare. To get MongoDB Replicate set running is difficult. Then to top it off, it doesn’t tell you if it’s actually working. So, took me like 3 months to understand, build and produce this key piece of infrastructure.

Meteor sells itself as an “Easy to use out of the box, be all solution”. Your localhost install runs perfect, infact, it has AutoPublish and OpLog running by default. But when you move to production - nightmares begin as you have to rebuild all this sort of ‘out of the box’ stuff. Even switching to Galaxy yields problems. For example, file storage on my web app is no problem. 2TB drive. But put that on Meteor Galaxy, you get 500mb in /tmp. Now you have to use Amazon Cloud buckets or Cloudinary (easier IMO). No where does it mention this. And every update you push out, builds a new container, which clears /tmp and all your files.

These are nightmares for guys like the OP who come in to Meteor.

There are significantly difficult learning curves to Meteor. I’m sure in the future at like, Meteor 2.0+ this will all be smoothed out, but for the time being. YIKES! :slight_smile:

I still love Meteor, but it can be frustrating.

Clearing the build cache, when building my Android App for example, the --meteor-server doesn’t actually get updated, which resulted in weeks of friggin problems. You have to start a new Meteor project to get the setting updated. It’s has a current open issue.

Meteor Galaxy smallest tier is $35 a month for a single instance. Mlab free database is slow. But even still with Compose.io you’re looking at $70 for a slow, basic server. As I’m building an MMO with a server tick, it requires some CPU and fast connections. In my case, minimum requirements put it at $200 to operate with out problems. I’d imagine many large scale apps are in the same range. I’m now hosting off my own internet connection and Alienware 17 for the time being…

TLDR; I’m not complaining. Things cost money. Just saying it can be expensive and hard to start. It’s a long journey, and people seem to have a hard time admitting it.

1 Like

Thanks for the information. This is very useful.

The game that I am trying to develop is much simpler though. It is an online economic game (things like public-good-games, prisoner’s dilemma, etc) to test theories about network structures (i.e., from a graph theoretic sense) and cooperation levels.

What I mean by a lobby, is a ‘waiting room’ as the game will not start until N players join. Each group will have that N number of participants … Then each group will play those economic games with their neighbors on the network synchronously, before the game ends and then we pay them based on their performance.

The closest thing I’ve seen to what I am trying to build is this public good game but the file structure is very different from what is suggested in the guide, using an older version of Meteor, and implements TurkServer to integrate it with Amazon Mechanical Turk, which makes it harder to take it as an example given that I won’t use Mturk.

I am looking for code examples to follow and learn how to use Meteor from. Also, I am happy to chat about our research :wink:

You can totally do this with Meteor.

As for code examples, there’s a LOT of projects out there with their own style of building things. Here’s what my current structure looks like:

As you can see it’s pretty… in depth. Lots of stuff going on. Lots of short cuts and custom written scripts.

The truth is there’s no right way to Meteor, like there’s no right way to program. I try to follow “The Meteor Way” as much as possible, and for the most part it works.

You can email AndrewNormore@gmail.com and we can set something up. For science.

1 Like

just googled “file storage galaxy” and this is the first hit: http://galaxy-guide.meteor.com/file-storage.html
It states every thing you describe very clearly.

You say that but to me it sounds like you’re complaining. Not so much about Meteor itself but about Mongo self-hosting being hard and DaaS being expensive. I dont know man, but telling newbies who ask questions that

is off putting and gives the wrong impression. Deploying to galaxy takes 3 minutes. Setting up mlab 5 minutes. Most apps operate just fine on the smallest tiers on galaxy and mlab and never need more power. Yours might, I dunno, but most don’t. So please, don’t go putting those things out there and scare people just because you have a hard time.

That’s exactly what I mean to do. Meteor is not easy. They make it sound easy, but it’s problem after problem. You have to google for things that you’d expect to just work. Then you have to build solutions around that, while Meteor claims to 1-click-host an app. It really doesn’t. You have to get file storage running. So when you update your web app, you actually delete everyones data. Until you google and come across that article that hey, no, you need a storage solution.

Hey, 1 click deploy to galaxy? Sounds great. Hey wait, where’s the database?

I’m saying there’s a deep learning curve to understand with Meteor. I don’t care that super high code nerds like I assume you must be, ‘get it’. But there are problems after problem after problems. Take for example OpLog caching, which is a nightmare to self configure.

The pay off is big, but it takes a LONG time - and I think Meteor Newbs should be aware of that. This may not be the right platform for noobs. If you’r JS skills aren’t up to par, good luck. If you’re a seasoned programmer and infrastructurer, still - good luck. Meteor is very difficult to master.

Anyway. I’m done this conversation. Cheers,

For example, open case about hot code pushes not working correctly.

I’ve been dealing with this for weeks trying to get my app to update, and it just wont do it. So now you have to dig deep inside Meteor.

Hell you have to create a cordova hack file to get the version to update on Google Play. It takes weeks of research in to each of these topics.

Buyer beware.

@SkyRooms and @tomsp Thank you for the fruitful discussion. Both points seem to be valid … Meteor seems like an awesome framework to learn and people have done great things with it, however, things are almost never 1 click deployment. I am not discouraged, but I do expect a learning curve to do the things I want to do with it.

Again, thank you both for the help and support. Also, should you encounter examples of open source projects of online synchronous experiments, don’t forget to point out to them in this thread :wink:

Cheers.