Online multiplayer game Urgent help needed

Online multiplayer game Urgent help needed
0

Hi I am working on a game where i have completed the client side of the game. now I want to load the game resources from a remote server also I want to use a database to store the game related data. I dont uderstand how to connect the game to the server to store and fetch the data. Also I want to make the game multiplayer like snake and ladders. I am not getting any supportive samples/resources to understand the code. Please help me
Thanks,
Josprachi

SQLite, REST, Firebase, some other database, write a simple c++ app on the server that responds to a certain port and processes the data, and many other ways.

1 Like

Any tutorial available please?

This isn’t cocos specific really. Any tutorial on any one of these would be fine.

There are so many different tools, setups, and architectural decisions to this question.

You can always use a BaaS (Back end as a service). There are many, also some geared towards gaming. This would involve downloading an SDK, and you would probably setup your architecture in a web portal online UI. Then import SDK to your project and integrate.

If you decide to build your own (recommended), you basically would use cocos2d-x network libraries to interact with your backend. My ideal setup always consists of node.js api, HTTPS REST, session-based validations, Redis cache, and web sockets. I really like NOSql databases for games such as mongodb. Note if you build yourself, there are lots of things to consider for scalability. 1 single server likely won’t handle 1 million concurrent games, and you will want to make the core data stateless so any server is just a node in the whole.

Good luck

I am using AWS Lambda for backend, AWS S3 to store resources and dynamodb as database.

1 Like

That’s a pretty good setup there. I use AWS ElasticBeanstalk to balance/manage AWS EC2 instances and environments. I was considering Lambda in the past but I haven’t made the switch yet to cloud functions.

You can also use open-source server https://github.com/heroiclabs/nakama

There are clients for cocos2d.

1 Like

If i am not wrong your question is not how to build database - backEnd architecture ,
your question is how to implement the connection or you might say the “HttpClient” service to the BE.

first of all you can create “service” that will output the API requests and return async when the BE retrive or save data to the DB, cocos is able to support ES6 when using browsify and then you will be able to use Fetch,promise etc…

the way you will create this service can be in a javascript Class that can handle requests from variety of layers when imported into that specific layer.

for example if you would like to build login you can just at the login layer create method that called doLogin which will go to that service and return after user was authenticated in your BE-DB architecture.
upon return you can enter user to the game.

and if this is not what you meant you should listen to the other posts here all good suggestions.

Best Regards
Avish