Online TCG Game

What is the easiest way for me to have my game connect to a server to see who else is playing my game so you can choose an opponent?

I want the game on the client’s computer to see who else is playing and let the user choose an opponent. I don’t need the players to log on or anything like that.

The user starts the game, enters a handle and then select someone else who wants to play.

What free options do I have?

I’m not really sure where to begin.

I asked a similar question before but I wasn’t sure how to do anything.

The closest to free would be hosting the central “server” on a machine you already own with a static IPAddress. But this isn’t a very good idea. I would find a cheaper hosted linux machine to act as the central server and API endpoint for you game. You may want to pre-emptively consider scalability in your design.

To be fair, this is quite an investment of time and energy and not to be taken lightly but it is certainly all doable with Xojo.

All the actual gameplay is done on the client’s machine. I just need a way for 2 computers to connect to one another.

It’s just me and a few friends who will be playing.

There’s a whole series of intellectual property involved with this type of operation. The folks that code those kind of infrastructures make serious money (one of my server side engineers went to work for a game company doing this and makes over $200K per year managing such a solution).

From a logic-problem standpoint, I would recommend that you host the “Friends” server on your system. When your friends login to the client on their systems, the game contacts your server, adds them to the “online” list with proper info (public IP address, client version, and the like) and then displays the list back to them to select from.

However, this doesn’t do anything for communication between the game clients. Have you worked out how you will handle that?

Now you really have me confused. All I want to do is have one copy of my game on one machine connect to another machine. I thought this would be easy as it is done all the time. I know due to NAT and firewalls I can’t do a direct peer to peer connection.

You cannot do server either unless you turn off the built-in firewall and configure port forwarding in your router. Your server needs to have a manually assigned IP address on the local network, not a DHCP address.

It is not a good idea, since it opens the machine to the whole wild world and the hackers that troll it.

But as you seem intent not to hear about a much safer cheap hosting server…

You’ll either need to handle all of that networking connectivity yourself, or find a game SDK that already has the communication layer provided so that you’re not reinventing that wheel. Currently, you can’t do that with simple code in Xojo.

Anything is easy if you already know how to do it and have the tools. :slight_smile:

Now I’m even more confused.

I was told that a simple PHP script could be used to handle the part of what players are ready to play or I could use a web app to handle it. I was even told I could modify the web app chat relay to do what I needed but I don’t know where to begin.

The way I want it is when a player runs the game, they can enter their handle and when another player does the same, one player can select the other and they can verse each other.

Building a multi-player game

This isn’t what I am looking for. I just need a way for my game to see who’s online so players can verse each other. The game itself is residing on the user’s computer and will be written in RealBasic.

Would Google’s App Engine be suitable for helping my Game to allow users to play against each other? This way anyone with a Google Account can play and doesn’t need another login. Would this work?

At first glance you could set up a server that way. Then every player could connect to it. But you will have to write the software for that in Python, php, or the half dozen other languages listed there.

I’ll probably look into something that’s already written for this purpose. Know of any PHP or Python scripts that can the job?

I still need help in setting this up as I don’t know any programming language other than RealBasic. Does anyone know of something that’s already written that could me out?

I guess the real question is how much data do you want to pass? Its pretty simple to just have a database that has game_id, users_connected_to_game_id, current_game_state.

If client_username=array(users_connected) and client(game_id_wanted)=game_id then send game state…

I mean, this is all pseudocode, but the game itself and its complexity of the server is all up to you. A chess game would be fairly simple if you have a FEN position for a board and black_player and white_player, and who’s turn it is. You could have a record of previous moves if desired, but it is not necessary.

A TCG could just pass the state of the table (location spots of cards like graveyard, exiled, deck, spot1-200 in front of player, etc) and what’s in the player’s hand. It seems rather simple to create it in PHP and make a simple API for it from the database, or have a Xojo HTTP server work with the data before sending it out in json format.

I made a very simple card game using only the Webapp. Its dumb but it works. Or worked… Not sure if I even have it anymore.

I say simple though… its not really if you’ve never even seen or thought about it before.

I don’t know PHP or any other language other than RealBasic. Without some kind of source code example I have no idea what to do or what I need. The TCG Game I am working on is based on the Yu-Gi-Oh Card Game.

My biggest issue is getting Player A to connect to Player B over the internet.

Player A connects to Server C. Player B connects to Server C and requests a connection to Player A. Server C informs Player A and the game begins. Player A informs Server C of his move. Server C relays that information to Player B. Then Player B informs Server C of his move. Server C relays that information to Player A. Etc.

Player A and Player B never connect directly to each other. They both talk to Server C independently.

I still don’t have any clue where to begin or what I need as this online stuff is new to me. I learn by example and am very visual.