Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Connect a two-player QML game through Wifi
Forum Update on Monday, May 27th 2025

Connect a two-player QML game through Wifi

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 4 Posters 782 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tomy
    wrote on 1 Jan 2019, 13:06 last edited by tomy 1 Jan 2019, 13:08
    #1

    I started learning QML and after a while wanted to test myself through writing a good QML app by what I'd learnt up to that time.
    It's my app, called Pingpong.

    0_1546344533297_2.PNG

    It embraces six QML files: main.qml, Racket.qml, Ball.qml, WinBox.qml, Counter.qml and Light.qml:

    0_1546347377558_1.PNG

    It's good, has an icon and works fine on Android devices.

    For the second major version, I want to develop it so that the game can connect by Wifi and two players can play the game installed on their smartphones through a shared Wifi.

    Actually, @J.HILK suggested that I consider that for the next progress in the app.

    Now, what to do for that goal? Where should I start, please?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 1 Jan 2019, 21:21 last edited by
      #2

      Hi,

      Don't get hellbent on WiFi rather on network in general.

      You can start by studying the Qt's network related example, specifically the TCP related ones. @VRonin's chat example will also be of interest (not so much for the chat part itself but for the network related stuff).

      Next question is whether you want to have a server somewhere or the game instances being able to handle each other.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • T Offline
        T Offline
        tomy
        wrote on 1 Jan 2019, 21:40 last edited by
        #3

        Thanks.
        Wouldn't it be easier if I used Bluetooth instead of Wifi?
        I'm myself new in QML I fear the stuff relating to networking (and Wifi) are too complex for this time of me. Aren't they, please?

        J 1 Reply Last reply 2 Jan 2019, 05:55
        0
        • T tomy
          1 Jan 2019, 21:40

          Thanks.
          Wouldn't it be easier if I used Bluetooth instead of Wifi?
          I'm myself new in QML I fear the stuff relating to networking (and Wifi) are too complex for this time of me. Aren't they, please?

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 2 Jan 2019, 05:55 last edited by
          #4

          @tomy hi,

          First of:
          Happy new year, if you follow the gregorian calendar.

          I personlly find Networking(LAN and WLAN) a good bit easier to use and implement than Bluetooth, but that just my opninion.

          What @SGaist says it true, TCPSockets (with or without a server) is probably the way you want to go.

          Here are some helpfull links.

          Fortune Client example
          Fortune Server example

          install the client on one phone the sever on the other and see if you manage a connection, should be relatively easy, but can be a challenge. At first, do not try to cross OS's - for example windows <->Android, because that can be a lot more complicated.

          Video Turotial QTcpSockets


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          4
          • W Offline
            W Offline
            wink
            wrote on 3 Jan 2019, 09:07 last edited by
            #5

            Hello,
            I'd use the new Qt Remote Objects. They hide away all the network stuff so you can focus on the game.

            citation from the doc:
            "Qt Remote Objects (QtRO) is an inter-process communication (IPC) module developed for Qt. The idea is to extend Qt's existing functionalities to enable an easy exchange of information between processes or computers."

            QtRO Documentation

            cheers wink

            1 Reply Last reply
            0

            1/5

            1 Jan 2019, 13:06

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved