AppWarp multiplayer with one host - cocos2d-x

I had a question with using AppWarp that I was hoping someone could help me with.
Is it possible to have one host of a game that both users in a AppWarp room can view and send messages too in realtime? Rather then having each user have their own hosted game while sending messages to each other and altering their gameplay through those sent and received messages.
The only reason I ask is because there are random factors in my game and if you add in latency from sending messages, both users don't see the same gameplay... I hope that makes sense. If this can't be done through AppWarp can someone recommend any alternatives? Appreciate it.

If i understood the requirement correctly then you want to make a game where two or more clients should communicate with each other using AppWarp as a server. If that is the case then this is what AppWarp does. AppWarp is a server side product to which the clients can connect to communicate with each other. AppWarp has two flavours called AppWarp Cloud and AppWarpS2 which are explained in this blog.
You can go ahead and check out the tutorials and samples of AppWarp and if you face any problem you can write on its forum to get it sorted quickly.

Related

Which hook to limit the number of messages a user can send per day?

We want to use ejabberd in the context of a web application having fairly unique and business rules, we'd therefore need to have every chat message (not protocol message, but message a user sends to another one) go through our web application first, and then have the web application deliver the message to ejabberd on behalf of the user (if our business rules allow the message to be sent).
The web application is also the one providing the contact lists (called rosters if I understand correctly to ejabberd). We need to be and remain the single source of truth to ease maintenance.
To us, ejabberd value added would be to deliver chat messages in near real-time to clients, and enable cool things such as presence indicators. Web clients will maintain a direct connection to ejabberd through websocket, but this connection will have to be read-only as far as chat messages are concerned, and read-write as far as presence messages are concerned.
The situation is similar with regards to audio and video calls. While this time the call per see will directly be managed by ejabberd to take advantage of built-in STURN, TURN etc... and will not need to go through our web app, we have custom business logic to manage who is able to call who, when, how often etc... (so in order words, we have custom business logic to authorize the call or not and we'd like to keep all the business logic centralized in the web app).
My question is what would be the proper hooks we'd need to look into to achieve what we are after? I spent an hour or so in the documentation, but I couldn't find what I am after so hopefully someone can provide me pointers. In an ideal world, we'd like to expose API endpoints from our web app that ejabberd hooks can hit. However, the first question is: which relevant hooks is ejabberd offering and where are these hooks documented?
Any help would be greatly appreciated, thank you!
When a client sends a packet to ejabberd, it triggers the user_send_packet hook, providing the packet and the state of the client's session process. Several modules use that hook, for example mod_service_log.

How to database iOS app data and display it on a webpage

First time post here, so forgive me for any bad etiquette/format.
I will preface by saying:
I have (over the last few months) been developing an iOS app for work. To be more specific, I am developing an inventory app to track bar inventory (liquor, beer, wine, etc). I can give more specifics on request if needed. I have most of the functionality done, only a couple more things I would like to implement. Eventually I will be porting it to Android as well.
At the moment, I have the model objects being archived to the local filesystem for saving and loading of data. However, my goal would be to database the model objects with the ability to display the information on a webpage. My logic is that no matter where the user is, he/she will be able to sign in to a service using a username and password, and view correctly formatted current/past inventories online. This is to allow the ability for a bartender to record the inventory, and have the bar manager view the inventory instances without having to have the physical device that recorded the inventory in his/her possession.
So here is my question:
Without being too general, what kind of service would I need to pull this off? I have a good amount of relevant front-end experience, specifically with iOS, Objective-C, HTML and CSS. However, I have ZERO experience on the back-end. I have researched around the internet, and I am aware of things such as cloud databases, web hosting and MySQL, etc. However, I cannot seem to find a definitive answer without asking my specific question. I suppose I would just like to be pointed in the right direction before investing money and time into a service that may prove useless to my cause.
Any resources and help would be greatly appreciated. Thank you!
There's not a definitive answer and you have a lot of options.
For me, the simplest is to set up a server with a database incorporated (mysql for example) and with a web service (written in PHP for example) that manages the database and queries on that.
Online you can find tons of guide on how to write a script in PHP that manages a database:
http://www.freewebmasterhelp.com/tutorials/phpmysql/2
For the iOS part you can follow also this guide:
http://www.techrepublic.com/blog/software-engineer/create-your-own-web-service-for-an-ios-app-part-one/
Good luck!

Implementing a scalable multiroom chat system

I've been looking into sockjs-tornado recently and am working on a chat function for a social networking site. I'm trying to get a feel for common methods used in building scalable multiroom chat functionality. I'll outline a couple of the methods I've thought of and I'd like to get feedback. What methods are used in the real world? What are the advantages and disadvantages to these methods?
Prereqs:
running tornado
using sockjs-tornado lib
sockjs-client lib for js
Everything else is open.
Methods I've considered:
For loop
This seems like the simplest way to go. You create a user class that subscribes to certain room classes. The user sends a message class that contains a room id and the server redirects the message in the loop only to users that have subscribed to that room. This seems to me to be by far the worst because the complexity is obviously at least linear. (Imagine 500 users connected at once to 5 chat rooms each.)
Multi-tasking/multiple server instances
This also seems like a bad idea because you could have 500 server instances running at any time on... different ports? I'm really not sure on the implementation of this method.
Native support
Now granted, a lot of libraries have this built in such as socketio. However that's not an option due to the sole node.js support. (I'm on tornado server.) Socks in particular does not have built in support for multiple "rooms".
Conclusion
I'm looking for resources/case studies, and industry standards. Any help would be appreciated.
I would just use a message queue server like RabbitMQ with a fanout exchange as each "chat room".
You can see an example of using a fanout exchange in Python here.
The Pika AMQP library works with Tornado, too.
The advantage with using a message queueing system is that you can have users connected to different Tornado processes on different servers while still being in the same "room", giving you high availability on the HTTP layer.
RabbitMQ also has HA capabilities (although not the greatest).

Can I make a chatroom for a network?

As an example if I have a small group of people at a college and I want to create a chat room application which each user can download and then open to view list of all available users to talk to and click one of the users in a list then a window pops and any text you enter goes to that specific person. How can I make this? I have made a chatroom using AJAX and html etc but I have never done a chatroom for a network such as the one you have in schools or work places. What language would I need? All help is appreciated since I am total new to this.
I read something on internet about winsock connections but there wasn't much I could find.
You can use sockets for network programming in java.
Look at this Deitel's tutorial about a java messenger application.
http://www.deitel.com/books/jhtp7/DeitelMessenger.pdf

Using Pusher/Pubnub with an authoritative game server

I'd like to build a 2-player turn based game with an authoritative server to manage the game state/logic. The flow I have in mind is something like:
Players are subscribed to a unique game channel (via pubnub/pusher/something similar)
Players submit their turns over HTTP directly to the game server
The server runs the game logic and publishes the result to the game's channel (which both players are subscribed to)
The client handles the response and renders the outcome
matchmaking kind of confuses me though. Any suggestions?
Is that the "right" way of using a pub/sub service in this scenraio? Is there a better approach (something other than polling the server constantly)?
This is a heated topic at our office! I've been using PubNub as an authoritative game server using creative choice of channel names. It works like this:
Run a node.js server (doesn't have to be node; can be anything) that serves your content, and also acts as an authoritative entity.
When a client connects, generate a UUID (can be done either server-side or client-side) and have both the client and server listen on that channel (something like "my_game_[UUID]").
Because no other clients know this channel name, the client and server can communicate freely on this channel.
The server can talk to everyone, and clients can perform secure actions through the server and communicate with each other using an "unsecure" vanilla pubnub channel.
Your proposal sounds great and is the "right" way. The challenge you face is shared from the beginning of the computer epoch, where synchronizing data is a requirement between multiple devices such as a mobile smartphone. Polling is SLOW and expensive (and does not make sense for a large number of players). Multiplayer games is a great example need to pair players and provide game rooms. Your solution is to:
Create a Game Lobby, where players can create game rooms and join game rooms.
Create an Auto-Pair of players (Quick Join) [Recommended]
You may solve this technical challenge with products such as Socket.IO and some other open source options. However you want to just build your game rather than focus on deploying a Node.JS server and hooking it up to Express.
Instead use a Cloud Service like PubNub, PusherApp or Beacon Push. Utilize the Pub/Sub API to synchronize users in a multiplayer environment easily.