I have written a Tic-Tac-Toe app and have also learned a good amount of Firebase in the last 2 weeks. However, I am thinking of adding Multiplayer Matchmaking and real-time turn-by-turn TicTacToe online using Firebase.
So here is what I am thinking:
There's a play button.
Click on it.
It will show a "Searching for opponents" TextView.
So I think I should do something to show it open state and then see another player that clicks and shows that open -- Two open then connect them. But what if there are more players? What if 5-6 players click at once when there's no one and it thinks it is empty?
I want that 2 players can be matched out of any number of players. As I am relatively intermediate in Firebase, can anyone help me a bit with the logic and also pretty good if with the workflow and a code snippet.
Thanks in advance,
Android Programmer :)
You can make 2 List
available Games
players available to join.
Then pick them up on First Come First Serve basis. Assign first player to first available game. Then Change the status of a player to busy (remove it from list) & also change the status of Game to ready (remove it from list)
Related
It has been a super long time since I last coded anything for Android.
Anyways, I have a number of apps which I get free stuff. For example the Google Play points we get each week.
I can't find an app to just help automate some of this. So I'm thinking about making an app which more than less reminds you and send you to the proper app when you press the notification.
I wonder if I can automate it even more. Is there a way record your actions, and then use that to get the app to do it on request?
Like for example the Google Play thing. Where when you press the notification or whatever button. It will follow the steps you took exactly. This making it where if you have daily rewards from multiple places. You can press a button, wait a few minutes, and that is that.
I'm just trying to figure out if Android even lets you run this. I know a few years back Google went heavy handed which ran off apps like Cerberus. Like they are doing some privacy stuff. So I wanted to check if it is possible before wasting my time.
You want to perform actions on another app by recording them in your app.
It is very possible but not the easy way. The only possible solution I understand is to train a Deep Learning model that detects user actions and save them. Then you can perform same actions with the help of OpenCV through your app. For that you have to screen record the app and pass the recording to Deep Learning model to detect user actions.
Also look on this question for better understanding
Capture the global touch screen events?
I am making an Android app, with multiplayer, and need some sort of matchmaking. I am using Firebase, and would prefer to not have to make an external matchmaking server.
My best ide so far is, using the firebase realtime database with transactions:
When a player presses "play" - go through lists of open matches. If no games exists in the list, or if all the games in the list has been filled while the client is searching for an open one - create a new open match.
When someone fills the open space in a match, remove the match from matchmaking.
The only hole i can see in this method, is when there are few players creating games at the same time, all thinking that the list is empty.
If anyone with some experience with firebase and/or matchmaking can point out any more holes in this strategy, or perhaps suggest a better strategy for matchmaking, i'd be very happy as i can't test out the strategy at scale yet.
In advance, thanks for helping out - it would be much appreciated.
It is the first time, that I'm working on a multiplayer mode to my game, so maybe this is reason why I so many questions have.
So, I have read all the existing tutorials(also YouTube videos), but have some questions.(Because libgdx has already changed a lot since tutorials have published.)
How should a project folder structure look like? Which packages should I add to my android folder in libGDX project?
My existing single player game has 2 different roles. One for player and one for computer, with different motivations. It is a graph based game, they all playing by signing its vertices with two different colours.(The game has a mathematic base, a graph algorithm.) So, in this way all the two players codebase should be the same?
Maybe I need a screen with some listeners for the multiplayer game, and that is all? Can you please tell me some basics, about building this screen?
libGDX's changed project structure make it hard and complicated to interpret older AppWarp tutorials.
You can follow our documentation for integration. I can suggest the steps that would help you in conversation of single to multiplayer Game.
Initialize AppWarp SDK at home screen.
Connect User when he open the application after the initialization
Once User will connected you can create/Join Room API and enter in the Game Scene once join Room succeeded.
In Game scene whenever you play your turn you can send turn data with sendMove API.
Whenever game data is received you can check the nextTurn User and update the respective UI on your Game screen
So these are the steps you can use for single Player to multi Player conversion.
Let me know if you need more helps in game integration.
I ve tried to ask the same question on github at the official unity google play games plugin but i dont see any answers.So i hope i ll find more ideas here.
I use google play games plugin for unity from their official github page and i run the Tic Tac Toe sample.It is a turn based game for Android-Ios devices.
From what i see the gameplay is like:
player connects to google tries to hit the desired square with his ball and when the ball stops moving the turn is passed to the next player.The next player accept the challenge and the turn based game continues...
My Question is really simple. When the player tries to hit the desired square with his ball if he fails he can simply press the home button just before the google sends the turn to the other player,go to google play games and accept his turn again.Now he can make his move all over again until he hits the desired block.
Google play game services are live one and a half year now.How noone reported this?Am i doing something wrong?Is there anyone out there using this plugin or am i alone :P ?
Umm. let's call it a feature :) . Seriously, there is a lot of moving parts between accepting the invitation and taking a turn. It would be very tricky to do this consistently given network connections that come and go in the mobile environment and not lose a turn or end up with what you described.
I think there are a couple of options:
Allow a "mulligan". Sure, there maybe some players that just keep trying, but overall, the game will probably be more fun.
Save the game state using Saved Games to an "autosaved" file. Then always load it when starting. This way even if TakeTurn() is not called, they will come back to the game as they left it. Using Saved Games also has the advantage of working across devices, so they can't just switch devices and play again to bypass any local state.
One simple solution for this issue that you can try is to
Application.runinBackground = false"
Hope this Helps!!
I am looking to use one of the social networks in my Android program.
Most important for me is the ability to build a continuous leadership board in which players move up and down depending their wins/loses to others.
The idea is for players to challenge others head-to-head. The winner gains points and the loser loses points.
Equally important, I want this feature to include the possibility to "charge" the player game coins.
Scoreloop includes the possibility of challenges but they are there in order to win coins off other players. In other words, they are the means to the end.
In my case I need it to be the other way around. The "ends" is to be higher in the leadership board and the "means" are to play others with coins.
Scoreloop do have a continuos leadership board but it is not accessible from the program.
I tried looking at OpenFeint but their site is a real mess. It is impossible to understand from there exactly what is and isn't available.
I signed up and tried to add my program. I ended up adding it four times and cannot delete it!
Check out Swarm, which provides a similar feature set to the others you mentioned (Scoreloop, OpenFeint), but also specifically includes a virtual goods system (coins), that you could use to have users purchase challenge attempts (which sounds like what you're looking for). The docs are extremely well written, integration is a snap :)
Create a leaderboard using either OpenFeint or Scoreloop (we started off with Openfeint but quickly moved on to scoreloop - If you want the details, I'll be happy to explain our reasons).
Once its up, make sure its a leadarboard that allows overriding scores with worse scores.
Implement an ELO rating calculator. see: http://en.wikipedia.org/wiki/Elo_rating_system
Each player starts with a certain score (I use 1500, so that ratings will resemble the chess ratings range).
On a match end, you re-calculate each user's new Elo rating, and post it to the leaderboard.
You end up with a leaderboard that ranks each user according to their skill. i.e. the more they win, the higher their score is.
EDIT: per user request - her are some of the reasons that made us move to Scoreloop:
OF documentation looks like it was ported from iOS, and very badly so. For example, the docs gives an example of initializing OF in your Application class. This will cause their "Join / Don't like fun" full screen dialog appear out of the blue, when users are busy using other applications, as android will kill and re-create your application in the background as memory availability change.
ScoreLoop automatically creates a "userId" for the user, without them having to register / login. This allowed us to post user's highscores and display their highscores without having to bother the user for logging in.
Scoreloop have an "offline" mode, which makes it much more robust, efficient, accurate and easy to use.
In flaky network situations, OF login process took a very long time, and affected the game performance. (see #3 above).
OF does not allow you to fetch a score rank. If you want to get your user's rank, you have to fetch the complete leaderboard, cycle through it until you find your user's entry. This "solution" pretty much makes this option not-available.
Scoreloop provided us with grate support. I've opened several tickets, they all got answered promptly and professionally. These guys rock.
I wrote this code a while back, so there might have been other reasons which I forget.