Multi-Connection bluetooth application - java

I am developing a J2ME MIDP 2.0 game that can can be played over bluetooth,
it is similar to tic tac toe where players exchange turns until the game is over,
the problem is that i want to give the both players the ability to restart the game or quit
at any time but i only have one connection for transferring game related data, and i wonder if i could have two separate connections between the two devices at the same time, one for eg. game management (restart, quit, etc ..) and the other for game data to separate the logic.
or you could put it this way : is it possible to have multiple bluetooth connections between two MIDP devices at the same time ?
Thanks in advance

I think for bluetooth.Via j2me mobile application the Midp device is connected at most only one device and at most at a time only one connection is enabled.So there is no chance of going to multiple connections.

Related

Display activity on 2 android devices simultaneously over a network

I have to create a simple single and multiplayer game in android about tilting the phone and recording the quickest time in a certain direction. I have successfully managed to create the single player version in Java. However I have no clue where to start with the multiplayer option where the game starts simultaneously on both devices where one is a server and the other the client (decided beforehand by the 2 people). I did take a look at the Android p2p website, but it wasn't much help. I have used Android Studio for the project.
I have all the math and logic ready from the single player, I am only struggling to how I can start the multiplayer by displaying an activity on 2 separate devices simultaneously. Unfortunately I don't have code to show for multiplayer as I have no idea where to begin.
Any help or advice will be highly appreciated.

How to add multiplayer in Android?

I'm making a Tic Tac Toe game in Android with three options:One player, two players and multiplayer.
The first two options were easy to make but I'm having A LOT of troubles with the last one, I have no idea what to do.
I am a beginner java programmer and I've never worked on networking with java, I know some basic things like MySQL and web stuff but I dont think it has anything to do with android.
So my questions are:
Do I have to use a server for this type of game? how and where do I find servers for this?
What do I need to learn in order to have the knowledge for developing multiplayer games?
Is it possible to make players play with other random available players? just hit play and be ready to go.
Can you recommend me some good guides that could help me?
Thank you very much !
Try Firebase
Firebase can act as a server where the users are connected
Firebase provides Realtime Database which would help your app. for eg
when a player makes a move, the changes would be effected to all the other player devices in Realtime by Firebase itself, you won't have to write the code to keep them in Sync
I recommend you take a look at Google Play Games Services.
It comes with a tone of features, and, most important for you, it has a Turn Based Multiplayer option that you could maybe use in your Tic Tac Toe.

Java Tic Tac Toe architecture

I'm currently having a major brain fart :).
My plan was to build a simple swing based tic tac toe application in Java. I had planned for the app to allow for one player, two player local and two player remote options. I've got the one and two player local versions working fine but am struggling to get my head around the two player remote option.
Worth noting in the Netbeans project I have the gui in a separate package from the logic.
I've fried my brain thinking about all the options.
Like having a client server architecture but then if the client is running on a different pc than the logic this slows down the one player and two player local versions for no reason.
I'm thinking the entire application (gui + logic) should be distributed amongst the various pc's on the home wirless network. That way players can play one and two player local games without any unneccesary lag time and see if anyone else is available for a two player remote version. The question if I go this way is who's logic acts as the server - how does that work?
Is option 2 the best / only way of going about this because this isn't just a networked game?
Are there any other ways of going about this?
I know doing a tic tac toe game with just a remote game option would be a simple case of a client server architecture but having one player and then a networked version in the same app is tricky.
Thanks,
Paul.
Technically, you could do this without actual server -- you can make it like client/host.
When user wants to be host, he sends UDP broadcast packet, with information on what ip, and what game he wants to play. everyone who wants to join can catch this packet.
When user wants to join, he listens to broadcast packet, and joins to the one he recieved.
Every player could do his own logic, and send his move to other player -- other side should only check is the move legal -- because maybe someone wants to hack your game :D
The application should be installed on each client. For the remote 2-player mode, you should implement your own P2P protocol to send actions from one player to the other and to keep track of the evolution of the game.
In a few words, each client should have its own model of the game locally which it updates whenever either the local player makes "a move" or the remote user sends (through the protocol) "a move".
Of course, if you need to keep track of statistics like scores, points, etc, you will need a central server to store this. But the actual game should take place in a P2P mode, with no need for a server.

Java multiplayer card game AI integration

I have developed a Multi-player Client/Server Variation of Trumps Card Game using QuickServer library. It works well with 4 human players. But when I finished the AI player, I didn't find a way to integrate it into the server: Should I create a separate thread for each player?
I hope my question is clear. Any suggestions would be highly appreciated.
A server should just be a server. In this case, it updates the clients as to what happened and what happens next.
If it were me, I would have a AIClientPlayer, which gets passed a client, and acts using your fancy AI logic when the client signals it to act.

java : voice chat and text chat

I want to make a card game made in Java. People can run it on their pc. They can add their friends to their contacts list and when there are 4 players online they can begin a game by one of the players hosting the game. The players can communicate by text or by voice chat Think of it like a chat client that allows users to play a card game and allows voice chat between the 4 players at the same time.
i dont know how do go abt the above project.Can anyone suggest me
some framework or other things that i can use to devlop the above app?
Will it be like a p2p application?
Start with chat using this tutorial. Run your own jabber client or use gTalk and write some code for the client side.
As I understand you are going to make some kind of browser or desktop game app with both text and audio chat options.
For chat app you will need a backend and client-side solutions.
If I understand you right, you have not much experience with chat apps, so preparing everything from scratch might be tricky for you.
Therefore, I'd recommend trying a ready backend and SDK for developing chat and audio chat part of your app. That should spare a lot of effort and work for you and you will be able to concentrate on UI implementation of your chat and audio chat.
Since you need both text chat and audio chat solutions, I can recommend ConnectyCube, since there you can find both at one place.
For browser or desktop apps you can use JS SDK. Here is the documentation how to connect it to your project.

Categories