How to do a ONLINE „Buzzer“ in Unity - unity3d

Ok so I want to have a pressable Button. And whenever someone presses it (on their computer in another network) I want my game to react to it.
It should work like this website:
https://buzzin.live/
People should be able to log in with a username and press a button. I tried searching how to do smt like this but I haven‘t found an answer.
Networking is a really weird topic with very few tutorials (and most of the tutorials are about online fps‘) so I hope to get help here :)

I see two options
Unity's client server networking seems a bit intense for a simple event implementation.
What I would do if I were you is look into WebSocket servers (more than pure tcp servers since usually websocket libraries are easier to use than pure tcp)
Either that or you could look into Unity messaging API which doesn't require to support the whole multiplayer shebang, just simple message passing. I would do some research into Unity's Network Messages and look around.
https://docs.unity3d.com/Manual/UNetMessages.html
Setting up a simple client-server project is pretty straight forward and Unity manages the connection for you.

Related

Unity backend options for Mirror Networking?

I've been looking around for backend services to use for an MMO project I have in mind. I've been doing some research on backend providers to help speed things up, and have noticed a few things such as PlayFab, Multiplay, Amazon's way of Playfab (forgot the name), etc.
However, these things are really only good for session-based games. So the servers shuts off when all players disconnect. That's not something I really need, they also allow you to add a matchmake system to your game, but that's also not something I really want to use or need for the game I'm making. I'm wanting just a server to be constantly running, players connect or leave, doesn't matter, the server(s) still run.
I'm wondering, does Multiplay also only cater towards session-based games with their hosting services? Or is it possible to also keep my server constantly running on Multiplay without it shutting down due to no players on? I'd really like to just use these services for their player cloud data features, where I can keep track of items, etc. for character customisation and it would also be handy to use the same product for server hosting too.
Am I wrong in saying that these options just won't work for what I'm going for? Would I have to just use AWS instead and use: DynamoDB, AWS hosting, Cognito for authority?
If it helps, I'm also using Mirror for the networking management, the above is just for backend / dedicated server hosting.
Thanks.

Network Programming: Nomenclature Questions

So I am looking to get into network programming.
Specifically for a real time strategy game (in Unity 3D). I've done some basic GET and REQUEST stuff before, but I'm curious as to what I will need for doing real time game programming over a network.
My questions about the programming nomenclature are:
-What is the name of programming ("network programming" is too broad) involved in coding real time game networks?
-Can I do real time network programming with JSON or is there another technology I need to use?
-What search terms should I use to research network programming further (as what I've been pulling up has been to broad)?
Thank you!
Update:
Adding to the helpful question below, here is a good link explaining the different types of Authoritative Servers.
http://www.gabrielgambetta.com/fast_paced_multiplayer.html
Unity 4 uses a built-in version of RakNet to achieve network programming, typically referred to as Unity Networking.
Rather than using GET requests or sending JSON messages, you generally use the various Network APIs that Unity offers:
The host starts up with Network.InitializeServer.
Clients connect to the host with Network.Connect.
GameObjects that need to be synchronised across all players should have a NetworkView component attached to them; objects are then synched automatically without needing much effort on your part (for a basic object anyway).
Remote Procedure Calls let you invoke functions on clients.
Data is transferred with UDP packets since things need to happen quickly without ACK packets being sent back and forth, though there are different options to ensure the packets are ordered reliably within Unity if needed.
The Unity Network Reference Guide is a good read.

Instant messaging ping

I'm working on a project 'Instant Messaging' which works totally on UDP. I would like if there is any good tutorial regarding this. Also can anyone explain how does the client inform the server that it is up without using another port.
Just take any tutorial on socket programming for your favourite language. Informing the server the client is up can be achieved by a simple Hello message.

what type of network programming is necessary in iPhone online multiplayer game?

I am asking this question as a small part of my question series regarding game programming .
Refer this question as the main one .
Now suppose I want to develop a game on iphone - a simple online multiplayer board game.
Suppose its a casino table.
In the main question ChrisF has tell me of sort of Client - Server architecture for iphone online multiplayer game.
I want to know what sort network programming I have to do for this type of application .
What will be the responsibilities and activities carried out by client and server .
You can provide me link, tutorials or to the point answers , anything will be great help for me and will be really appreciable .
thanks
You'll want to write a socket application running on a server. When you have access to a wifi access point or edge/3g you can send data to it from your iphone application. This server can then handle the incoming data and send an appropriate reply to the people connected.
For server socket programming, take a look at this guide - http://beej.us/guide/bgnet/.
For iphone specific socket programming, take a look at the samples supplied with the Iphone SDK. This link also has some basic information.
A simple online multiplayer board game
Given that the iPhone isn't always connected to the internet, you might need a server to store state. Alternatively you could always stipulate that if one person loses their connection the game finishes.
Client to client would be the obvious choice for the latter. Both clients have a port they listen to, and send the other commands based on the board state. Like almost all online games the obvious choice would be to use UDP as it's fast and compact.
For the server architecture you will of course need some kind of server listening for commands and a game number. It would store your state in a datastore on the server, a mySQL database for example. UDP or even SOAP or JSON over HTTP would be the two obvious choices for this.
This second approach using JSON/SOAP route would be a lot easier for you to get started with, assuming the iPhone has a decent JSON or SOAP library which is not likely. I have no idea about UDP in Objective C, however in C it requires a certain level of knowledge which won't get you something to play with quickly.
As you already said, you will need a server, but you can have two kinds of design:
The server can serve only as a gateway between the players to connect one to each other: it's two uses are, first, to list the running games, and second, to list the IP addresses of the players so that each client will read the IP addresses and connect to them. This will require less bandwidth and processing power for the web server and more for the client which will host the game. In this configuration, one of the clients will act as a server and will send data to the others. If your game has only one of the players playing at a time, and not a huge lot a players, this is what you should use as what you pay is the server's power.
The server can also store all games' states: it might require far more processing power and/or bandwidth depending on your game.
Anyway, most of the time you will want only one machine (which can change during the game as in the first case) to do the processing and the others will only receive the computed data.
To program a networked game, you will need knowledge of sockets (deep knowledge in the first case because you will have to deal with NAT issues, routers blocking the way between clients). The guide to that is Beej's Guide to Network Programming, the number one ressource on this topic, although it doesn't focus on games.
If not too much processing is needed on the WWW server, you could deal with it with server scripting languages like PHP along with MySQL, but you're most likely to use your own server programmed in C++ (or in C). If you use C++, you might want to use an already existing library such as RakNet.
The client will obviously be programmed in Objective-C as it's on the iPhone. I believe there is a good networking framework looking at the number of online games, so you might as well not want to use an external server networking library.
It might be a bit too much for what you want to do, but you could also use the well known Torque Engine.

How can a web page communicate with a local rich client application

I need to implement a process where users punch in a few details into a web page, and have this information fired as some
sort of an event to a Java rich client application (SWING) on the same host.
One idea was perhaps implementing an applet that would initiate socket communication with a listener implemented by the SWING
application, but not sure whether this is possible at all.
This sort of puzzling piece of integration is basically a given fact.
Essentially both the web application and the SWING one are already active and in use.
The only missing bit is sharing info between the two, in a way that would be easy to implement. no matter how dirty.
Any ideas?
Thanks!
Sounds a little confusing to the user if nothing else.
I would go one of two ways.
Have your rich client communicate over the network. And put whatever form you were going to have in the browser there.
Put your rich client into an applet.
Have both connect to a server somewhere (even locally), which your rich client can poll to see if the form has been filled in.