Giter VIP home page Giter VIP logo

Comments (6)

MengelCode avatar MengelCode commented on May 10, 2024 1

Hello @kenrick95 ,
sorry for not working on this yet.
I considered quite a few approaches for the challenge on how to make remote machines connect to each other.

  1. Use WebRTC.

After the initialization of the connection, you have a peer-to-peer connection between two browsers.
Advantages:
+Direct connection
+Most of the time, there is no load a server needs to handle.
+Transfer of binary data possible.
Disadvantages:
-This technology is quite new, so possibly unstable and not good in regard of browser-compatibilty.
-Because we are online, we would require a server which negotiates the connection details between two clients.
-EVERY data transfer is encrypted. This might be additional load client-side wise which might not be worth it.

  1. Use XMLHttpRequests (additional web requests).

When the "game" (the website and the script files) are successfully loaded in the browser, additional HTTP requests will follow for everything else.
Advantages:
+HTTP traffic can go through almost all firewalls.
+If you are running a web server anyways, depending on the technology you use for this, offering the online mode after implementation is not a big feat.
Disadvantages:
-Headers. You cannot avoid to transfer them every time.
-Both sides are required to poll independently the server to find out if the other side is still connected, made a move, etc.

  1. Use WebSockets (continous data transfer).

Another connection to a special server can occur after the game being fully loaded.
WebSockets are, somewhat special. They are no true sockets, but they allow for asynchronous data flow between servers and clients / web browsers.
Advantages:
+Event-based handling of data is possible.
Disadvantages:
-Web servers do not really support this protocol, but you can use them as reverse-proxies.
-Also, WebSockets are not too old yet.
-The need to most likely always need an additional server for the protocol.

I would definitely prefer option 2) for this small game. 1) and 3) might be way too complex for this. And I think we cannot avoid adding any complexity at all with online modes, as the web application is just client-only now.
I plan to either use Node.js, Java or PHP (most likely Node.js) to implement the required server.

I will start when I am at full strength.

EDIT: When I say "additional server", I mean additionally to the server you loaded the game from, if you do not have it locally saved.

from c4.

kenrick95 avatar kenrick95 commented on May 10, 2024

Hi @Mengel38 , thanks for your suggestion. That's definitely in my wish list! But unfortunately I'm not able to work in this at the moment. Feel free to fork this project out (and send a PR, maybe)? Thanks!

from c4.

MengelCode avatar MengelCode commented on May 10, 2024

Hi @kenrick95, I will do so. Thank you for your quick response and your approval.

from c4.

kenrick95 avatar kenrick95 commented on May 10, 2024

Hi @Mengel38, do you have any plan to share regarding this? Thanks

from c4.

MengelCode avatar MengelCode commented on May 10, 2024

Hi @kenrick95.

I am sorry I am keeping you waiting here alot. I think I do not have too good news in regard of this issue:

  • Both given my lack of competence with especially TypeScript and my queue in regard of a project very important to me, I think I might not be able to actually implement what I thought of. This is rather embarrassing to admit publicly, but I think the only right thing I can do now is to let you know of this.

  • I should have checked the pre-requirements more carefully before basically jumping into this.

I am sorry for wasting your time here.

from c4.

kenrick95 avatar kenrick95 commented on May 10, 2024

Hi @mengel38, it's ok, no worries! 😁

from c4.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.