FreeOrion

Forums for the FreeOrion project
It is currently Mon Nov 20, 2017 6:56 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Mon Oct 16, 2017 1:29 pm 
Offline
Space Squid

Joined: Sat Dec 10, 2011 5:46 am
Posts: 58
I'm preparing authorization model of the game after authentication was implemented and accepted.

I could distinguish several roles:
  • ROLE_HOST - Can save and load games. Edit other player settings. Stop server.
  • ROLE_MODERATOR - Can attend game as a Moderator.
  • ROLE_PLAYER - Can attend game as a Player.
  • ROLE_OBSERVER - Can attend game as a Observer.
  • ROLE_GALAXY_SETUP - Can change galaxy and AI settings in lobby.

Currently the game have those roles in normal mode:
  • Host:
    • ROLE_HOST
    • ROLE_MODERATOR
    • ROLE_PLAYER
    • ROLE_OBSERVER
    • ROLE_GALAXY_SETUP
  • Other players
    • ROLE_MODERATOR
    • ROLE_PLAYER
    • ROLE_OBSERVER

In the hostless mode all players have equal roles:
  • ROLE_MODERATOR
  • ROLE_PLAYER
  • ROLE_OBSERVER
  • ROLE_GALAXY_SETUP

Next I'm going to customize role for player based on authentication information or default settings for unauthenticated guest players.

Is it complete model? Maybe there should be more detailed roles or they supposed to have different distribution on players?

_________________
Gentoo Linux amd64, gcc-5.4.0, boost-1.63.0
Ubuntu Server 16.04.3 x64, gcc-5.4, boost-1.58.0
Welcome to multiplayer public server at 78.47.71.237. Version 2017-11-13.b6940d0
SMAC participant: play multiplayer with us!


Top
 Profile  
 
PostPosted: Tue Oct 17, 2017 7:44 am 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4241
Location: Sol III
On a quick glance, sounds like a reasonable start.


Top
 Profile  
 
PostPosted: Thu Nov 02, 2017 10:21 pm 
Offline
Programmer

Joined: Sun Feb 14, 2016 12:08 am
Posts: 341
Looking at #1834, are the roles planned to be restricted to specific capabilities (or assigned some new capability flags)?
e.g. CanKickPlayer() might check for one explicit role or capability flag, without some complicated checking (host || (moderator && player) || ...)

Not sure of the implication of using enum as bit flag without offsets. Seems like there would be some clashes between flags.
Would something akin to the following be preferred?
Code:
constexpr std::size_t NUM_ROLETYPES { 5 };
enum RoleType : std::size_t {
    ROLE_HOST      = ( 1u << 0 ),
    ROLE_MODERATOR = ( 1u << 1 ),
   ...
}
typedef std::bitset<NUM_ROLETYPES> role_set_type

_________________
Any content posted should be considered licensed GNU GPL 2.0 and/or CC-BY-SA 3.0 as appropriate.


Top
 Profile  
 
PostPosted: Fri Nov 03, 2017 4:43 am 
Offline
Space Squid

Joined: Sat Dec 10, 2011 5:46 am
Posts: 58
Yes, roles are restricted and any capabilities are going to be tested against only one role.

I thought that way but I ended up with using enum's integer value as a offset in a bit flag.

_________________
Gentoo Linux amd64, gcc-5.4.0, boost-1.63.0
Ubuntu Server 16.04.3 x64, gcc-5.4, boost-1.58.0
Welcome to multiplayer public server at 78.47.71.237. Version 2017-11-13.b6940d0
SMAC participant: play multiplayer with us!


Top
 Profile  
 
PostPosted: Mon Nov 06, 2017 2:05 pm 
Offline
Space Squid

Joined: Sat Dec 10, 2011 5:46 am
Posts: 58
I want to add availability to join to a playing game as a Observer or a Moderator. Should I use ROLE_OBSERVER and ROLE_MODERATOR or I need to add new roles to distinguish observers and moderators since a game started and those who connected after it.

_________________
Gentoo Linux amd64, gcc-5.4.0, boost-1.63.0
Ubuntu Server 16.04.3 x64, gcc-5.4, boost-1.58.0
Welcome to multiplayer public server at 78.47.71.237. Version 2017-11-13.b6940d0
SMAC participant: play multiplayer with us!


Top
 Profile  
 
PostPosted: Mon Nov 06, 2017 3:24 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12014
Location: Munich
o01eg wrote:
I want to add availability to join to a playing game as a Observer or a Moderator. Should I use ROLE_OBSERVER and ROLE_MODERATOR or I need to add new roles to distinguish observers and moderators since a game started and those who connected after it.

The point of the roles is to control what the player connection can do in game, right? So if there is no difference in what they can do, I don't see why they'd need a separate role label.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group