Y
Y
Yourmind2019-08-14 01:38:23
Game development
Yourmind, 2019-08-14 01:38:23

How to organize a client account in the game?

How is it usually done in this case?
I am writing an online checkers game. Client-server application. The client logs in with his username / password (if not, then he first registers), enters and then can choose from the list of players the one he wants, and he is free and offers to play, or he is offered.
But there's a problem. But what if the client under the same record entered the same account (for example, from a computer and from a phone). And then they offer him to play. At us on both clients should on idea the same be displayed? After all, he is listed only once in the list of players? Type we remember the list of hosts and ports of this client, and then we throw all messages for it on these hosts?
Or is it better to just not allow more than one client to log in with one account? (In general, it is supposed to make clients only as mobile for iOS).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2019-08-14
@Yourmind

At us on both clients should on idea the same be displayed?

Not necessarily. It all depends on what you want and how your server is set up. You can not allow this, or you can allow two different people (devices) to log in with the same login / password, but act as two different people (although the nickname will be the same). As you do, so shall you. And you can do whatever you want.
According to the mind, you need to do it so that when you enter from another device, it throws it out in the first one. It is unlikely that a player will play from two devices at the same time. Usually in games this is how the account is arranged. But in theory, it is also possible to allow a simultaneous game in the same way as normal instant messengers are arranged.
In any case, you need to master the concepts of a (gaming) session. Because it is attached to the device. Usually, at the time of authorization by login / password, the device is given a certain key (token), and then access is carried out using it. For greater reliability, you can number the packets, then the session cannot be transferred to another device at all, but these are security subtleties, in a simple version this is not at all necessary.
Further, when you have normal sessions, you can already twirl them as you see fit. For example, you can program a limit of 3 simultaneous sessions, or end the session after some time of inactivity if there are two, or simply prohibit playing with yourself, etc. etc.
In general, the answer is: 1) make sessions 2) kick from the old session when creating a new one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question