Menu login and Chargen (contribs)

244 views
Skip to first unread message

Griatch Art

unread,
Nov 6, 2011, 6:35:07 PM11/6/11
to eve...@googlegroups.com

Hello,

I have added two new contributions to Evennia's contrib folder. Contributions are useful code snippets (as well as full systems) that are useful but don't fit in the main server since they are likely to be used differently in different games.

contrib/menu_login.py

Evennia's default login screen (using create/connect with email etc) is not the final word in login design by any means. The menu_login contrib implements a menu-driven login system where you select what you want to do. You will be prompted for your username and password in sequence and can go back and forth. It doesn't require a user to enter an email at all.
Also, the default login system auto-creates a Character for you with the same name as the Player. This is just for convenience, to get people into the game quickly. The menu_login don't create a Character but simply dumps you into OOC mode (yes Evennia has that out of the box). From there on the Player is supposedly to be put into some sort of character generation system.

Which brings us to ...

contrib/chargen.py

This is a (very simple) character creator and a way for handling multiple characters. Goes well with menu_login above. You will be able to see all your available characters and do @ic <charname> to "become" them. Use create <charname> to create a new Character (I demand Character names to be unique in this snippet). You can also see a list of your characters as well as look at their descriptions (caveat: Only characters created by create will be visible in the list, so if you switch from the old system, the previously created chars won't be visible (although you can @ic to them just fine - @ic and @ooc are default commands coming with Evennia).


The snippets are easy to try out - just a change in the settings file's CMDSET_UNLOGGEDIN and an import of the extended OOC commands into the CMDSET_OOC will do it - three lines or so, just @reload to see the changes.

Interestingly, the creation of these contribs lead to plenty of small fixes and cleanups in the server, most useful. Had I not been diving into into the server all the time, both fully functioning systems would have taken just a few hours to write. I guess it goes to show how easy it is to change also pretty fundamental functionality in Evennia. :)
.
Griatch

ken

unread,
Nov 7, 2011, 10:38:42 AM11/7/11
to Evennia
excellent work! thanks for the head start on this.

there are a few updates required for the comment section on the
implementation.

line 17 of menu_login.py: CMDSET_UNLOGGEDIN =
"contrib.alt_login.UnloggedInCmdSet" should be
CMDSET_UNLOGGEDIN = "contrib.menu_login.UnloggedInCmdSet

line 20 of chargen.py: self.add(character_creation.OOCCmdSetExtended)"
should be
self.add(chargen.OOCCmdSetCharGen)

with those two items resolved I was able to use the contributions
correctly.

also, could you elaborate on the rest of the comments section for
chargen?

"""
You could also add/edit this line to your game/settings.py file:

CMDSET_OOC = "contrib.character_creation.OOCCmdSetExtended"

(uncomment the super() statement in OOCCmdSetExtended in this case
too)
"""

though, i looked closer and found OOCCmdSetCharGen and am running
self.add(chargen.OOCCmdSetCharGen) successfully

On Nov 6, 6:35 pm, Griatch Art <gria...@gmail.com> wrote:
> Hello,
>
> I have added two new contributions to Evennia's *contrib* folder.
> Contributions are useful code snippets (as well as full systems) that are
> useful but don't fit in the main server since they are likely to be used
> differently in different games.
>
> *contrib/menu_login.py
>
> *Evennia's default login screen (using create/connect with email etc) is
> not the final word in login design by any means. The menu_login contrib
> implements a menu-driven login system where you select what you want to do.
> You will be prompted for your username and password in sequence and can go
> back and forth. It doesn't require a user to enter an email at all.
> Also, the default login system auto-creates a Character for you with the
> same name as the Player. This is just for convenience, to get people into
> the game quickly. The menu_login don't create a Character but simply dumps
> you into OOC mode (yes Evennia has that out of the box). From there on the
> Player is supposedly to be put into some sort of character generation
> system.
>
> Which brings us to ...
>
> *contrib/chargen.py
>
> *This is a (very simple) character creator and a way for handling multiple
> characters. Goes well with menu_login above. You will be able to see all
> your available characters and do *@ic <charname> *to "become" them. Use *create
> <charname> *to create a new Character (I demand Character names to be
> unique in this snippet). You can also see a list of your characters as well
> as look at their descriptions (caveat: Only characters created by *create *will
> be visible in the list, so if you switch from the old system, the
> previously created chars won't be visible (although you can *@ic *to them

Griatch Art

unread,
Nov 7, 2011, 11:03:28 AM11/7/11
to eve...@googlegroups.com
@ken

Ah, the documentation kept the old filenames I used during development. Thanks for the heads up! It's been fixed in the latest push.

I extended the rest of the comment section in chargen.py too. The background is this: To add the new menu system you just need to set settings.CMDSET_UNLOGGEDIN to point to the new cmdset. One would thing this should work also for CMDSET_OOC, but there is a critical difference between the two. CMDSET_UNLOGGEDIN is a dynamically created cmdset that all new connections get. It is not saved anywhere (since at the point it is used players are not authenticated so we don't know who to save things for. So changing the setting will immediately update what you see at the login screen.
Not so for CMDSET_OOC. This default set is stored permanently on the Player object when it is first created. After that, the value in the settings file is not used anymore. The reason for the saving is that we need to be sure that the Player always have access to commands. And we cannot automatically update it when the settings file and Player object no longer match, for there could be any number of reasons for the cmdset to change on the Player (using a Menu is one). So changing settings.CMDSET_OOC once some Players have already been created will not change those, but only those created later. Cmdsets are however easily expandable at runtime, so the first install method in the docstring - adding the commands to the old settings.CMDSET_OOC - will work just fine for all Players, new and old.

Not sure if that cleared things up or not. :)
.
Griatch
Reply all
Reply to author
Forward
0 new messages