intrepidcoder / monopoly

A fully functional Monopoly game in JavaScript and HTML/CSS. Play online: https://www.intrepidcoder.com/projects/monopoly/
MIT License
341 stars 211 forks source link

Add Networking #8

Closed jenke15 closed 6 years ago

jenke15 commented 8 years ago

Adding networking to this game would be amazing! I am not sure if it is entirely possible without having to rewrite the entire game, but a possible suggestion would be to use socket.io. Is this possible? I would love to help, but I am fairly new to javascript.

intrepidcoder commented 8 years ago

I agree, networking would be a great feature, but it wouldn't be easy to implement.

Looking at socket.io, you could definitely use it to send game state data between players, but you'd need to write server side JavaScript to keep track of the game, remember whose turn it was, and make sure the players can't do anything against the rules.

Anyway, I don't have any plans to write networking, but if you design how the server part works and communicates to the clients, we can talk about modifying the existing JavaScript code to make that work.

Also, a great site to learn JavaScript is https://www.codecademy.com/.

arielsegura commented 8 years ago

Hi guys, have you started working on this feature?

jenke15 commented 8 years ago

No... Do you know how?

aimran96 commented 7 years ago

You could potentially use PHP or Python but you'd definitely need some server-side component. You can do it without using sockets through the use of simple AJAX requests

jenke15 commented 7 years ago

I am not familiar with AJAX like at all, however I would be able to do the PHP end. Any idea on how the AJAX part would work?

arielsegura commented 7 years ago

It's also doable with node and you may be able to reuse some code on both sides. I think we should use sockets since it enables us pushing statuses instead of (long) polling them, but that's a networking thing we can do after implementing this using Ajax.

aimran96 commented 7 years ago

Well, you'd need to send AJAX requests to the server in order to synchronize the state between multiple clients. So each time any user does anything significant in the game, you'd send one of these requests to the server. Now @arielsegura, using sockets is not a bad idea. HTML5 Server Sent Events can also be used and both of these options are better than polling. However, I do have somewhat of a personal bias against using Javascript for server-side code

arielsegura commented 7 years ago

We can also use spring-boot if you don't like node. Sockets are supported there too. Anyway, to start working on this we need to define what changes we need to do. What goes to the back and what stays at the front.

jenke15 commented 7 years ago

Any of them work for me. I could look into HTML5 Server Sent Events if we wanted to go that route. Entirely up to us. What do you guys think? @arielsegura @admin96

aimran96 commented 7 years ago

Personally, I would prefer HTML5 SSE + PHP. It would be very simple to get started... all you need is WAMP/LAMP and you're ready to get started. PHP is kind of slow, so, I am open to using Python instead of PHP because it has better performance and the syntax is much better. Java might not be the best choice because writing ridiculously verbose OOP code for this web app would decrease productivity and increase the time needed to implement different functionality. Oh also, I'm presuming there's a need for a database.

jenke15 commented 7 years ago

I haven't used Python, but I'm sure I could figure it out. Did you want to get started? How much slower is PHP than Python. Regardless, let's get going! I am down to help! @admin96

arielsegura commented 7 years ago

It would be very simple to get started... all you need is WAMP/LAMP and you're ready to get started

You still need to download and configure the server. Node.js or spring-boot allows apps are by far easier to deploy. If someone only wants to download and run the app, they can do it w/o any server nor configurations.

arielsegura commented 7 years ago

What is the "develop" branch? gh-pages? So I fork the project

aimran96 commented 7 years ago

Its the same with python, you can do HTTP servers really easily without having apache!

aimran96 commented 7 years ago

gh-pages is the main branch. The game which can be played online is available through this branch!

jenke15 commented 7 years ago

Has somebody forked the project? Do we want to share emails or skype's to communicate outside of this? @admin96 @arielsegura

arielsegura commented 7 years ago

join https://crazymonopoly.slack.com

jenke15 commented 7 years ago

Joined! @arielsegura