FreezingMoon / AncientBeast

The Turn Based Strategy Game/eSport. Master your beasts! 🐺
https://AncientBeast.com
GNU Affero General Public License v3.0
1.67k stars 582 forks source link

online multiplayer research #315

Closed DreadKnight closed 4 years ago

DreadKnight commented 11 years ago

The game should have a main menu, for now two big icons on the right side of the screen with text under, aligned vertically. Somewhat similar to Heroes of Might and Magic 3, see screenie http://bit.ly/1OpNalO The first one should be Hotseat Mode and the second one should be Online Multiplayer, more will come.

The hotseat should trigger the current pre-match menu, while online multiplayer will trigger it with some changes: the turn time and time pool defaults shouldn't be infinite, the infinite options actually being greyed out, also the "PRESS START BUTTON" should be "INVITE PLAYERS". After pressing it, depending on settings, there should be 2 or 4 player slots, indicated with accordingly colored Dark Priest avatars/frames and player number (for example Player 1) under, the first slot (Player 1, red) will be automatically filled, while the other 1 or 3 would have a specific "Copy link" buttons that will be red at first, then orange when clicked and greed when player joined. The button at the bottom should be "CANCEL GAME" when the slots are not filled and should take the player back to the main menu; if the slots are occupied, it should be the "PRESS START BUTTON" again. The current time pool values are pretty low, for testing purposes.

There should also be a "Copy link" button in order to invite spectators to the game. A number next to that button will display how many spectators are currently viewing. This mode won't require accounts and should be done using node.js / websockets. The updates should be sent after each action after the server verifies it's a legit one. The whole idea is to play with friends from all around the world that you can't reach in person. Players who join see the slots but no links and a message at the bottom, saying "AWAITING PLAYERS". Disconnected players can simply rejoin from the same link or by reloading the browser. While one or more players being disconnected, the game will continue to run until end. Joining a game in progress should ideally not steal the player slot but spectate the game. Using an old link should show an error message and possibly a create game suggestion.

Having a matchmaking system with total strangers can result in agony as they can be nubs, afk or dc. Eventually there will be a Online Ladder which will offer prizes while having some microtransactions. Over there players will be required an account and be matched based on levels, so losing and bad games will be penalized. The goal will be to start generating income for the game and also filter bad players.

DreadKnight commented 11 years ago

http://worldofgnome.org/making-fancy-gnome-apps-with-nodejs-mongodb-and-webkit http://worldofgnome.org/run-gnome-html5-applications-over-network

DreadKnight commented 11 years ago

So it could basically be done with websockets http://www.html5rocks.com/en/tutorials/websockets/basics and having php server http://socketo.me , if not going for Google Play Games https://developers.google.com/games or something similar like mentioned in issue #492 which is about distribution platforms, some providing cloud storage and online multiplayer.

DreadKnight commented 11 years ago

Added category for services that offer online multiplayer among other stuff, either free or as a paid for use service.

DreadKnight commented 10 years ago

Seems that the Google Play Games multiplayer feature was only limited to Android games, but checking the website again today no longer displays that warning div and there's more online multiplayer stuff shown for the web category now https://developers.google.com/games/services/web/gettingstarted

DreadKnight commented 10 years ago

This can offer some inspiration http://www.come2play.com/visit_demo_channel.asp?game_id=2&channel_id=1 Shows number of online players near the find opponent and you can also invite friends to play against via facebook.

DreadKnight commented 10 years ago

WebRTC seems like a very viable P2P option, doing well for 2 or 4 players. The thing is that it works most of the time, but thanks to NAT / firewalls, a different backend going through a server would be needed as backup, even if a little bit costly. Here's the first game using this https://www.cubeslam.com and some info https://www.cubeslam.com/tech http://www.html5rocks.com/en/tutorials/webrtc/basics/

DreadKnight commented 10 years ago

Another game with the standard "send link to invite" http://www.cartoonnetwork.com/games/tko/index.html

DreadKnight commented 10 years ago

Will start looking more into this soon https://www.codeschool.com/courses/real-time-web-with-nodejs

DreadKnight commented 10 years ago

This might come in handy for online multiplayer as well http://incompl.github.io/cloak The nodejs server will be hosted on OpenShift https://nodejs-ancientbeast.rhcloud.com

DreadKnight commented 10 years ago

A possible idea of online multiplayer would be using this https://togetherjs.com https://togetherjs.com/docs/#technology-overview https://www.openshift.com/blogs/day-26-togetherjs-lets-code-together

This won't require for the player to have an AB account, possibly not even togheterjs account. The players most likely won't be forbidden to interfere with each others turns, there's also the issue of collecting player individual stats, allowing game modes where purchasable items will be used etc, so it could be used as temporary solution or as an limited alternative, so there would still be online multiplayer when the online servers are down or under maintenance, plus it offers some nice communication features out of the box, if there's browser support, a nice touch anyway.

DreadKnight commented 10 years ago

I tried togetherjs but it fails big time for this, made an issue on their tracker https://github.com/mozilla/togetherjs/issues/978

DreadKnight commented 10 years ago

Found out recently about https://bitmessage.org - could be used for online multiplayer if it's fast enough. Another idea for a p2p system would be using an alt-coin, this could encrypt and confirm each player move as a transaction, while also allowing for lots of spectators and match history. Down sides to it would be making it work with the browser based game without installing anything and maybe a big wallet.dat file forming because of a chain block.

DreadKnight commented 9 years ago

It seems that PHP servers can now send time based events http://youtu.be/ZlyyUqBrmXA What that basically means is that Ancient Beast could simply use that for sending updates of the gameplay to the clients (players or spectators), without needing a Node.js server or rewriting the user system. Each player will also need to send instructions back to the server during his turn though.

DreadKnight commented 9 years ago

Removing the brainstorm tag, while moving the original post's content over here http://pastebin.com/t7qWRxtq

DreadKnight commented 8 years ago

This would be handy if doing online multiplayer by using JSON https://medium.com/vandium-software/5-easy-steps-to-understanding-json-web-tokens-jwt-1164c0adfcec#.kxh5vz76v

DreadKnight commented 7 years ago

A nicely explained example using Phaser and socket.io https://github.com/Arcanorum/basic-networked-multiplayer-game

DreadKnight commented 6 years ago

A nice tutorial series about making an online multiplayer game using Phaser and hosting it on Heroku, like we do http://gojasonyang.com/post/phaserMultiplayerGamePart1.html

DreadKnight commented 5 years ago

This library https://github.com/nicolodavis/boardgame.io could be used for online multiplayer, though I'm not sure about the p2p element when it comes to it atm.

DreadKnight commented 4 years ago

Will go for nakama implementation and in order to keep things more organized, will open different issues https://github.com/heroiclabs/nakama