2 played games, connected with WIFI

Hi!
I’ve always wanted to make a 2 player game, which they play through internet. I saw a web function in reference, so i started wondering if its possible. I was thinking maybe i host wix site, with like 10 “sessions”. User would access info from site, and put his own info on it.

I know it would be really hard, since it would have to use ports and stuff, but id really appriciate it. Thanks!

You might want to check out some previous two player or multiplayer games posted to the forum – for example:

Hi, I have experience in creating many applications and online games, what kind of game do you want to do exactly? I can guide you on how to start and what libraries to use.

To start you have to know that there are two main architectures or infrastructures for games or applications on the network … there is the so-called “centralized server” and the so-called “shared logic”. Each has advantages and disadvantages over the other, but it is clear that there is one of the two that is easier to program, in your case and with no experience in the subject you should opt for the structure of “centralized server” which is simply create a server program that is actually the one that is running the game, is where the characters and all the objects really exist, and the clients simply connect to it and send the keystrokes and little else, and it is the server that will be responsible for sending the necessary data to the clients to represent the scene close to each player.

Another concept that you should know is if you use UDP or TCP? for a network game you need to know that TCP is usually a kind of slow connection because of its type of SYNC … it is error-proof and synchronous, which is very reliable and safe, but it is very slow because it forces you to that all the information arrives at its destination, and that it arrives without corrupting and that it arrives ordered. UDP instead is a protocol that is designed for raw streaming where the important thing is the amount of data that is transmitted and not so much the reliability of the information.

A good enough library to create a network game would be one that allows you to send large amount of data “ordered” by UDP to a server, and that the server interprets and responds to the resulting scene. I recommend using ArtNet, I have created an auxiliary module for this library that provides everything necessary to transmit data packages ordered in the form of simple messages, but if your intention is to do something simple and find information without problems in the processing forum, better start using oscP5 which is well documented and is just as easy to use, I started with it in processing for simplicity of use, but with time and the need to make applications and games for Android I had to change to ArtNet and create an own module that adds an event manager in the reception of packages and an automatic manager to pack and unpack text messages as does the oscP5.

Start looking at examples of the oscP5 library and above all, think carefully what you want to do exactly, because a network game is not something you can do on the fly, it needs planning, much encouragement and forward!

Finally, you need to know that in professional network games what is normally done is to create messages with several “items” nested in it, and it is the first item that you should call “command” and the following items should be the parameters to execute with that command … so for example, conceptually speaking you would have to send:

m = new message ();
m.setDestination ("192.168.1.xxx");
m.add ("multiply");
m.add ("10");
m.add ("5");
m.send ();

This when arriving at its destination would be processed as follows:

command received “multiply” …
then … 10 * 5 = …

I do not know if it’s clear enough, but go … which are ideas that you should start to consider;)

1 Like

sorry for not replying for long, ive been busy with other stuff and didnt check the forum that much. I really appriciate your reply, and that you took a lot of your time helping me.

a few different stuff:

  • sending “packets” of info to a website or wherever, and collecting them with other program
    so like:
    online rock-paper-scissors where there are like “channels” where user types his channel ID (1-1mil)
    and a set password shared between 2 users (too advanced, for starters just to know how to
    “broadcast” info on website, and how to receive it)

    leaderboard, where program submits score to website and sort it.
    
    2 player game like just moving arround and chatting (sending string msgs) preferably fast speed
    

thanks