Answer the question
In order to leave comments, you need to log in
Application structure and architecture
I am writing a game portal, I actually finished all the features, now I need to deal specifically with games. Before I start, I would like some advice on how best to do it.
I came up with the following:
- the user enters the game (goes to the game page)
- then on the game page there are all applications from other users and the opportunity to create their own application
- then the user enters or creates his application and waits for the opponent / co
- when the opponents have all logged in, the users are thrown to the game page on the game starts.
For the implementation of games, the node.js solution was chosen, the yii site itself
is now the actual questions.
1) When the user is waiting for opponents while in his application for the game, what is better to use a socket + node or check with Ajax once every 3 seconds, for example?
2) when the game starts, php will throw the data about the players to the node. What is better to pass an array of players' user_id or specifically the order number, so that the node itself would get it from the database? Applications and everything on the site we have muscle, game logs - mongo?
Answer the question
In order to leave comments, you need to log in
1. A socket is better, since it will not be necessary to fumble the server every 3 seconds in vain. But we must remember about the support of the socket by browsers
2. Application number. I used a similar scheme - the transfer from php through the socket works relatively slowly, especially if there is a lot of data. Getting PK out of a muscle is a very cheap operation.
hmm interesting, thanks for the answers, I'll try to implement it, if anything I'll describe what how. Well, waiting 1 - 2 seconds is not critical. Although looking at what kind of delay is speech. ?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question