How to make a Multiplayer game with Cocos2d-x JavaScript and Node.js

Hi,

I’ve been looking online to see how to get started with making a multiplayer game using Cocos2d-x. I have finished making a mobile game (Android + iOS) using Cocos2d-x v3.7 using JavaScript and now I want to integrate multiplayer functionality into it and I have no clue where to start.

NOTE: The type of multiplayer game I would like to do is like FUN RUN.

Do I need to use something like AppWarp or NextPeer or Photon?
If I pay for my own hosting/server would that make my life easier or harder?
I keep finding tutorials online that use C++ but since my project is in JS I would like to build my multiplayer features using node.js but having a hard time finding tutorials with node.js and cocos2d-x.

Any tips or help on where to start would be much appreciated.

I recommend start with Firebase.

1 Like
2 Likes

Awesome thanks @Gurigraphics and @eydamson those are both good suggestions.
That tutorial looks like what I need.

Do either of you guys have experience with AWS for Game Developers?

1 Like

@efares
Hey
You can use my tutorial which @eydamson suggest , this is real starter tutorial for real beginner.
I use netty for the tutorial which is Java General server .
Now if you like to get into node.js as server i can recommend you to use :
http://pomelo.netease.com/


It has Cocos2d-x-js client

Which is the most mature open source game server implementation.
I used it it is very good , but it is not easy i had to do allot of digging to learn it .

2 Likes

Thanks for the info!

I should mention, the type of multiplayer game I would like to do is like FUN RUN.

Yes, I like to get into node.js as server. Pomelo looks great it uses node.js and Cocos2d-x JS but do you think I should still do your starter tutorial that @eydamson suggested? So I can pick up on the concepts and the way multiplayer works?

In terms of hosting, I know how a website works and how it gets hosted but is it the same for multiplayer mobile games? So Pomelo is a game server framework for node.js but will I still need to set it up with a hosting provider?

Sorry for the really beginner type questions. Thanks again!

Well to set up multiplayer server it is not like hosting web site .
There are several layers and components , which make your game multiplayer game
You need to think about allot of stuff like:
Load Balancing ,
Fail Over ,
Persistency
Scaling,
Security
Network fraud
And how to setup your network elements.

BUT if you just starting and want to learn and feel how things work,
Just get 5$ virtual server in hosting like DigitalOcen for example , which gives you basically clean Linux Account.
Then you need to setup all the stuff from iptables to the servers and all the administration scripts.
Then setup or Node.js server if you come from Javascript world or Netty if you come from JAVA world.
You have the option of buying general Games servers which are build with Java for example :
http://www.smartfoxserver.com/

Hope that helps

I see.
That is a lot of information, thanks for sharing!

I come from a JavaScript background so I guess I shouldn’t worry too much about the Java Netty Server tutorial then right? Should I focus on Pomelo tutorials instead?

Also I was looking at AWS vs DigitalOcean; $5 is cheap to get started and learning but AWS offers a free tier for 12 months. Any thoughts or opinions about the two providers?

Thanks for all your help by the way! I really appreciate your responses : )

Go for the free AWS 1 year tier , you can always extent the server spec.
The main problem with AWS is you always need to track your network usage always!
Because for registration the free tier you need to give your credit card.
And if you pass the free tier limit you will pay for it . there are no alarm or stopper . ( As i know )
just you to know .
but for start it is fine .
i think you should go with node.js , it will save you time not to learn JAVA .
maybe i will do pomelo server tutorial on my site if there is demand , currently there is high demand is for Cocos2d-x javascript.

1 Like

If you do a Pomelo server tutorial with Cocos2d-x using JavaScript that would be amazing! Do let me know if you plan on doing that :smile:

Thanks for all your help.

@Gurigraphics and @Meir_yanovich What are your thoughts about AppWarp?

The reason I ask is because I’m worried that Pomelo might not have an active community. I don’t want to start working on it and not have support in case I get stuck somewhere. Do you know if Pomelo still has an active community?

Thanks again!

@efares
I don’t think Pomelo have active community at all …
the thing is if you want to adopt commercial solution it all becomes different story.
the only barrier you will have is your money

@Meir_yanovich I see.
And what is the difference (benefits pros/cons) of using Pomelo versus making my own server in node.js?
Sorry for asking so many questions. This is just a big learning process for me.

@efares
Well you certainly can build your own server , sometimes its even better to do this .
Because you will build your server for your game with your needs . where you can fine tune it as best as possible .
While servers like pomelo are general game servers which present you already allot of ready made solutions
Which will save you time to develop them .
so sometimes its over head to have those , sometimes you don’t need all of them .
and then sometimes its hard to start to dig into them when you have problem .